python - Checking if a person and getting details -


i'm new sparql , want details of on dbpedia such birthplace etc, first want check type person. query far looks like:

select ?person ?birthplace {     {?person dbpedia-owl:person.}     union     {dbpedia:stephen_fry dbpprop:birthplace ?birthplace .} } 

i want details of on dbpedia such birthplace etc, first want check type person.

if want persons first, , then get, e.g., name, can take advantage of fact sparql sub-select queries evaluated first:

select ?person ?name {   { select ?person { ?person dbpedia-owl:person } limit 10 }   ?person foaf:name ?name . } 

sparql results

that has advantage can select number of persons first, , whatever names might have. e.g., results query above have more 10 results, since persons have more 1 foaf:name property.

however, you're asking rather unusual. you're looking names of persons, you'd typically write query says find persons , names:

select ?person ?name {   ?person dbpedia-owl:person .   ?person foaf:name ?name . } limit 10 

sparql results

you don't need "check" person person first or that. query requires ?person person , has foaf:name property. can't non-persons it.

if want ?person bound particular values, can use values clause:

select ?person ?name {   values ?person { dbpedia:daniel_webster dbpedia:new_york }    ?person dbpedia-owl:person .   ?person foaf:name ?name . } 

sparql results

the values clause specifies values ?person can have. if 1 of specified values ?person doesn't allow match, e.g., new york in query above, won't see results value in output.


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -