[Wikidata] "Implementing" OWL RL in SPARQL (Was: qwery.me - simpler queries for wikidata)
On 12.11.2015 16:30, Paul Houle wrote: This is really great stuff that gets to the heart of the matter. There is a horrible misconception that SPARQL is complex. People often show you queries that make your head spin, but it is astonishing how really simple they are. Here are a set of SPARQL queries that implement OWL 2 RL: http://topbraid.org/spin/owlrl-all.html this shorter and far more human readable than anything has been written about OWL. As far as I can tell, this is a SPARQL-based copy of the inference rules given in the OWL standard [1], which, to be fair, should probably be counted as something that "has been written about OWL" ;-) On a more technical note, it should be remarked that the queries do not really "implement OWL RL". First of all, you would need to run these queries recursively and add their results to the database in each step, which is not something you could do through a public SPARQL endpoint. The queries are actually SPARQL-encoded inference rules that need to be executed in a way that is not the usual mode of answering a SPARQL query. Secondly, these rules only implement certain aspects of OWL RL (instance retrieval). They do not, in particular, correctly implement retrieval of subclass-of axioms. In fact, it is not possible to implement correct subclass-of reasoning for OWL RL by using RDF-based rules in this way, even if they are executed recursively [2]. It is possible to do it with rules, but these are beyond SPARQL CONSTRUCT, unless your "SPARQL rule engine" implements some more complex redundancy checking before adding CONSTRUCT results to the database. On the other hand, it is entirely possible to implement correct OWL QL (note: *QL* not *RL*) reasoning in SPARQL without even using "rules" that need any recursive evaluation [3]. This covers all of RDFS, and indeed some of the patterns in these queries are quite well-known to Wikidata users too (e.g., using "subclassOf*" in a query). Depending on how much of OWL QL you want to support, the SPARQL queries you get in this case are more or less simple. This work also gives arguments as to why this style of SPARQL-based implementation does (most likely) not exist for OWL RL [3]. (I come to bury, not praise OWL -- if there are some OWL features you like copy them into your rules. If your data gets "big" at all, you do not want to mindlessly infer facts that aren't part of expected reasoning chains.) I am afraid that the rules you cited are actually an example of some such "mindless" inference. They infer some types of axioms, such as subclass of, that are not part of their intended output (that is: which are never inferred completely anyway). There are other inference rule sets that avoid this useless extra inferences and still obtain all instance-of relations in OWL RL. I write this not to praise or "bury" any technology, just to clarify some apparent misconceptions. (In particular, I completely agree with the fact that SPARQL is not that hard to grok, and that nicer interfaces and maybe further tutorial-style introductions would be useful.) Regards, Markus [1] http://www.w3.org/TR/owl2-profiles/#Reasoning_in_OWL_2_RL_and_RDF_Graphs_using_Rules [2] http://korrekt.org/page/The_Not-So-Easy_Task_of_Computing_Class_Subsumptions_in_OWL_RL [3] http://korrekt.org/page/Schema-Agnostic_Query_Rewriting_in_SPARQL_1.1 ___ Wikidata mailing list Wikidata@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikidata
Re: [Wikidata] "Implementing" OWL RL in SPARQL (Was: qwery.me - simpler queries for wikidata)
On 12/11/2015 17:10, Markus Krötzsch wrote: I write this not to praise or "bury" any technology, just to clarify some apparent misconceptions. (In particular, I completely agree with the fact that SPARQL is not that hard to grok, and that nicer interfaces and maybe further tutorial-style introductions would be useful.) There's a start at a practical introduction on-wiki at https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries to queries on the Wikidata SPARQL system. Everyone is very welcome to jump in and improve it ! (A wiki page isn't a proper wiki page until lots of people have made it their own). -- James, ___ Wikidata mailing list Wikidata@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikidata
Re: [Wikidata] "Implementing" OWL RL in SPARQL (Was: qwery.me - simpler queries for wikidata)
On 11/12/2015 09:10 AM, Markus Krötzsch wrote: [...] > On the other hand, it is entirely possible to implement correct OWL QL (note: > *QL* not *RL*) reasoning in SPARQL without even using "rules" that need any > recursive evaluation [3]. This covers all of RDFS, and indeed some of the > patterns in these queries are quite well-known to Wikidata users too (e.g., > using "subclassOf*" in a query). Depending on how much of OWL QL you want to > support, the SPARQL queries you get in this case are more or less simple. This > work also gives arguments as to why this style of SPARQL-based implementation > does (most likely) not exist for OWL RL [3]. Does OWL QL cover *all* of RDFS, even things like subproperties of rdfs:subclassOf and rdfs:subPropertyOf? peter ___ Wikidata mailing list Wikidata@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikidata
Re: [Wikidata] "Implementing" OWL RL in SPARQL (Was: qwery.me - simpler queries for wikidata)
On 12.11.2015 22:09, Peter F. Patel-Schneider wrote: On 11/12/2015 09:10 AM, Markus Krötzsch wrote: [...] On the other hand, it is entirely possible to implement correct OWL QL (note: *QL* not *RL*) reasoning in SPARQL without even using "rules" that need any recursive evaluation [3]. This covers all of RDFS, and indeed some of the patterns in these queries are quite well-known to Wikidata users too (e.g., using "subclassOf*" in a query). Depending on how much of OWL QL you want to support, the SPARQL queries you get in this case are more or less simple. This work also gives arguments as to why this style of SPARQL-based implementation does (most likely) not exist for OWL RL [3]. Does OWL QL cover *all* of RDFS, even things like subproperties of rdfs:subclassOf and rdfs:subPropertyOf? No, surely not. What I meant is the RDFS-fragment of OWL DL here (which is probably what RDFS processors are most likely to implement, too). I think I recall you showing P-hardness of RDFS proper a while ago, which would obviously preclude translation into single SPARQL 1.1 queries (unless NL=P). Markus ___ Wikidata mailing list Wikidata@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikidata
Re: [Wikidata] "Implementing" OWL RL in SPARQL (Was: qwery.me - simpler queries for wikidata)
On 11/13/2015 01:21 AM, Markus Krötzsch wrote: > On 12.11.2015 22:09, Peter F. Patel-Schneider wrote: >> On 11/12/2015 09:10 AM, Markus Krötzsch wrote: >> [...] >>> On the other hand, it is entirely possible to implement correct OWL QL >>> (note: >>> *QL* not *RL*) reasoning in SPARQL without even using "rules" that need any >>> recursive evaluation [3]. This covers all of RDFS, and indeed some of the >>> patterns in these queries are quite well-known to Wikidata users too (e.g., >>> using "subclassOf*" in a query). Depending on how much of OWL QL you want to >>> support, the SPARQL queries you get in this case are more or less simple. >>> This >>> work also gives arguments as to why this style of SPARQL-based >>> implementation >>> does (most likely) not exist for OWL RL [3]. >> >> Does OWL QL cover *all* of RDFS, even things like subproperties of >> rdfs:subclassOf and rdfs:subPropertyOf? > > No, surely not. What I meant is the RDFS-fragment of OWL DL here (which is > probably what RDFS processors are most likely to implement, too). > > I think I recall you showing P-hardness of RDFS proper a while ago, which > would obviously preclude translation into single SPARQL 1.1 queries (unless > NL=P). Yes indeed, and hence my query. > > Markus > > peter ___ Wikidata mailing list Wikidata@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikidata