Extract list of person on wikipedia list using dbpedia/sparsql - extract

i'm new with dbpedia and sparsql, i was wondering how i could extract a list of passengers (https://dbpedia.org/page/Passengers_of_the_Titanic) from dbpedia.
As far as i know the resource of the dbpedia doesn't include the list? Would it only be possible to extract all the person with hyperlinks?

Related

Getting specific fields of nested elasticsearch document

We have access to an api of all companies in denmark. There is a lot of data, necessary and unneccesary. We need to get a list business owners and directors.
The relevant list of Owners are nested four fields deep in the document. We loop over every 'organization', and loop over all the 'attributes' of the organization. If the attribute field 'type' is the string 'function' AND the field of a 'value' in 'attribute'(values is also a list, we however only want the first one) is on a whitelist(One of five strings) then we want the Value of the organizations 'name' field along with some other fields(the whole organization object would also be acceptable).
We currently take all these steps in a python loop, with 4 nested for loops for everything. This is a major PITA. I wan't to make this into an elasticsearch query(the api we query is alreasy es) but i have no major experience with DSL. Anyone know how this would be done?
Here is a gist of the 'path' we take to a given field: https://gist.github.com/mrcpj1998/e65c6988cf8aea9fcea4c4fb6c007c6f i also have a copy of the whole document In JSON here

Finding a particular string in HTML

I need to extract data from a website and display it to the user. I'm recieving HTML, and I need to find a particular number inside it.
For example the string would be : "Canada = 50, USA = 60, France = 70". I need to search for "Canada" and find only the number 50.
I've been searching online for how to actually search the returned string of HTML and can't seem to get anything to work.
I dont know how this could be done in App since you want the App to look for specific words in a text file.
However I know this can be done using data analysis tools like R which can filter large amount of texts to create word clouds.
http://georeferenced.wordpress.com/2013/01/15/rwordcloud/

Return ordered dictionary to django template

Suppose you want to display posts as in Disqus.
(It seems you can comment on any post in any depth)
How do I pass a such data to django template and let it draw the data as Disqus?
e.g. You want to display all posts which belong to a thread in a way which reveals the parent-child relationship.
How can you do that in django? (python/json/..)
Have you looked into using django-mptt? I have found that it works quite well for this type of tree structure.

How to get overall category of business in JSON object after request in Yelp API

In the category list in the documentation, there are overall categories (Food, Restaurants, Health), and many sub categories within them. However, when I make a request and parse the JSON, the only categories that are returned are the sub-categories.
Even the example json in the documentation doesn't have the overall categories
"categories": [
[
"Local Flavor",
"localflavor"
],
[
"Mass Media",
"massmedia"
]
],
If I search for restaurants, the categories will return things like "italian, french, american", but not "restaurants". Is there a way to get the overall category in the json so I can use it?
Thanks
Use the search API instead, and set a category_filter according to this list.
This should give you all the "objects" in the given category.
Something like this http://api.yelp.com/v2/search?category_filter=restaurants.
Update
It seems like I misunderstood a little... so you want to get the root category.
(eg. for "italian"–>"restaurants", "french"->restaurants, "car dealers"->automotive etc.)
I think you have two options:
Hardcode the dictionary of all restaurant subcategories (french,italian...) into a file (plist, json, whatever) and after getting the "object" you could check if the subcategory is included in the hard-coded subcategories dictionary.
Use the search API and provide the bussiness id and category_filter set to restaurants and check if it returns any result - if not, then the object is not in the right category.
The reason why I am suggesting to hard code it is, because Yelp doesn't provide an API to get complete list of categories.
In my opinion I would try the approach #1, because it is less intensive on the network side and a dictionary is blazing fast.
But to answer your initial question, no it is not possible to have the root category in the JSON file.

Parse string as Json?

I have a json string but the format is strange
[[5706,[
[1132001,"Aston Villa","West Ham",5706,'2010-08-14T15:00:00.0000000',[[1966752,0],[1977724,1]],[],"","","","",64,63],
[1132002,"Blackburn","Everton",5706,'2010-08-14T15:00:00.0000000',[[1966753,0],[1977721,1]],[],"","","","",83,66],
[1132004,"Bolton","Fulham",5706,'2010-08-14T15:00:00.0000000',[[1966755,0],[1977727,1]],[],"","","","",88,85],
[1132005,"Chelsea","West Brom",5706,'2010-08-14T15:00:00.0000000',[[1966756,0],[1977712,1]],[],"","","","",503,94],
[1132006,"Liverpool","Arsenal",5706,'2010-08-14T15:00:00.0000000',[[1966757,0],[1977733,1]],[],"","","","",59,58],
[1132007,"Man Utd","Newcastle",5706,'2010-08-14T15:00:00.0000000',[[1966758,0],[1977730,1]],[],"","","","",19,70],
[1132008,"Sunderland","Birmingham",5706,'2010-08-14T15:00:00.0000000',[[1966759,0],[1977715,1]],[],"","","","",60,86],
[1132009,"Tottenham","Man City",5706,'2010-08-14T15:00:00.0000000',[[1966760,0],[1977739,1]],[],"","","","",62,77],
[1132010,"Wolves","Stoke City",5706,'2010-08-14T15:00:00.0000000',[[1966761,0],[1977718,1]],[],"","","","",81,342],
[1146485,"Wigan","Blackpool",5706,'2010-08-14T15:00:00.0000000',[[1998244,0],[1998321,1]],[],"","","","",350,328]],
[[1015824,8],[1035605,126]]]]
So, How can i parse and extract it value?
Thanks
Just eval it using whatever library is relevant to the language you're parsing it into. The format is a list of values and lists - so from the resulting structure you'll just need to traverse the lists to get to the pieces that you're interested in. Without more context, I can't provide any brilliant insight into what the values mean in those lists, but doing a little googlin' digging makes me thing you're looking at data related to football club tickets and/or games.