On 2/27/13 5:28 PM, Ben Companjen wrote:
Hi Amir,The reasoning you want is the classic deductive reasoning using classes and subclasses. Settlement is defined as a subclass of Place (although maybe not directly). That means that all Things that are Settlements are also Places. Tehran is a Settlement, so it is also a Place. If you want to see whether some Thing is a Place, you should look at the rdf:type and reason your way up via rdfs:subClassOf and see if you end up at Place. The class Place in DBpedia has URI <http://dbpedia.org/ontology/Place>. DBpedia has an option "transitive", that can be used to make subclasses of subclasses match as well. I'm not sure that that option is part of SPARQL, so this option may not work everywhere. To select 100 items that are in a subclass of Place: select distinct ?Concept where {?Concept a ?p . ?p rdfs:subClassOf dbpedia-owl:Place OPTION (transitive).} LIMIT 100 With SPARQL ASK you can ask whether there is a match. Is dbpedia:Tehran in a subclass of Place? (DBpedia says "true") ASK {dbpedia:Tehran a ?p . ?p rdfs:subClassOf dbpedia-owl:Place OPTION (transitive). } But in case you're looking for something that is only defined as a Place and not as a subclass of Place, you need to know whether Place is a subclass of Place. ASK { dbpedia-owl:Place rdfs:subClassOf dbpedia-owl:Place OPTION (transitive). } ... says "false". So you want to ASK if some Thing is a Place or a subclass of a Place. ASK { { ?thing a ?p . ?p rdfs:subClassOf dbpedia-owl:Place OPTION (transitive). } UNION { ?thing a dbpedia-owl:Place . } } Replace ?thing by the URI of the Thing you want to check. I think you can construct the queries for Person and Organisation yourself:) Good luck! Ben
Adding to the above, some live examples: 1. http://lod.openlinksw.com/c/GMXCVM4 -- SPARQL using option (transitive)2. http://lod.openlinksw.com/c/GTXSMU6 -- SPARQL 1.1 Property Paths (meaning: you can do away with the option [transitive] due to SPARQL 1.1 syntax offering a slot for this functionality) .
Note:You can just change "&query=" to "&qtxt" in the SPARQL protocol URLs above to end up in the SPARQL query editor which exposes the actual SPARQL query.
The examples above use the LOD cloud cache instance we maintain. This instance has more computing resources behind it and it includes SPARQL 1.1 support which we haven't rolled out the the main DBpedia endpoint, just yet.
-- Regards, Kingsley Idehen Founder & CEO OpenLink Software Company Web: http://www.openlinksw.com Personal Weblog: http://www.openlinksw.com/blog/~kidehen Twitter/Identi.ca handle: @kidehen Google+ Profile: https://plus.google.com/112399767740508618350/about LinkedIn Profile: http://www.linkedin.com/in/kidehen
smime.p7s
Description: S/MIME Cryptographic Signature
------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________ Dbpedia-discussion mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/dbpedia-discussion
