W3C home > Mailing lists > Public > public-rdf-dawg-comments@w3.org > May 2005

SPARQL: extracting a subgraph is practically non-trivial, perhaps too hard

From: Nicolas F Rouquette <nicolas.rouquette@jpl.nasa.gov>
Date: Thu, 05 May 2005 16:21:11 -0700
Message-ID: <427AAA67.1060803@jpl.nasa.gov>
To: public-rdf-dawg-comments@w3.org

I've been trying to use SPARQL extract bits and pieces of OWL ontologies 
like this one:

http://www.loa-cnr.it/DOLCE.html

DOLCE is particularly interesting because the comments indicate it is 
"modular"
Modularity came up in the context of a recent discussion here:

http://ontolog.cim3.net/cgi-bin/wiki.pl?ConferenceCall_2005_04_28

With SPARQL, I tried to write queries that "chopped" DOLCE
along the lines of the structure the authors indicate:

The ontology graph in this version is the following: 
------Backbone:
http://eis.jpl.nasa.gov/~rouquett/Ontologies/DOLCE/DOLCE-Lite#
 http://eis.jpl.nasa.gov/~rouquett/Ontologies/DOLCE/TemporalRelations#
 http://eis.jpl.nasa.gov/~rouquett/Ontologies/DOLCE/SpatialRelations#
 http://eis.jpl.nasa.gov/~rouquett/Ontologies/DOLCE/DnS#
------Basic extensions:
  http://eis.jpl.nasa.gov/~rouquett/Ontologies/DOLCE/InformationObjects#
  http://eis.jpl.nasa.gov/~rouquett/Ontologies/DOLCE/Actions#
   http://eis.jpl.nasa.gov/~rouquett/Ontologies/DOLCE/SocialUnits#
    http://eis.jpl.nasa.gov/~rouquett/Ontologies/DOLCE/Plans#
     
http://eis.jpl.nasa.gov/~rouquett/Ontologies/DOLCE/FunctionalParticipation#
     http://eis.jpl.nasa.gov/~rouquett/Ontologies/DOLCE/Collections#
      http://eis.jpl.nasa.gov/~rouquett/Ontologies/DOLCE/Collectives#
       
http://eis.jpl.nasa.gov/~rouquett/Ontologies/DOLCE/CommonSenseMapping#
-----Experimental extensions:
  http://eis.jpl.nasa.gov/~rouquett/Ontologies/DOLCE/Systems#
  
http://eis.jpl.nasa.gov/~rouquett/Ontologies/DOLCE/SemioticCommunicationTheory#
  http://eis.jpl.nasa.gov/~rouquett/Ontologies/DOLCE/Causality#
  http://eis.jpl.nasa.gov/~rouquett/Ontologies/DOLCE/ModalDescriptions#

I thought it would be easy with SPARQL, but it is turning out into 
something practically difficult.

1) Extracting the list of the ontologies defined in DOLCE.

The list is mentioned in the comments. It is also included in the list 
of namespace prefixes
that a simple SPARQL query returns. Yet, it is surprisingly difficult to 
get just that list.

http://www.loa-cnr.it/ontologies/DOLCE-Lite#
http://www.loa-cnr.it/ontologies/TemporalRelations#
http://www.loa-cnr.it/ontologies/SpatialRelations#
http://www.loa-cnr.it/ontologies/DnS#
http://www.loa-cnr.it/ontologies/InformationObjects#
http://www.loa-cnr.it/ontologies/Actions#
http://www.loa-cnr.it/ontologies/SocialUnits#
http://www.loa-cnr.it/ontologies/Plans#
http://www.loa-cnr.it/ontologies/FunctionalParticipation#
http://www.loa-cnr.it/ontologies/Collections#
http://www.loa-cnr.it/ontologies/Collectives#
http://www.loa-cnr.it/ontologies/CommonSenseMapping#
http://www.loa-cnr.it/ontologies/Systems#
http://www.loa-cnr.it/ontologies/SemioticCommunicationTheory#
http://www.loa-cnr.it/ontologies/Causality#
http://www.loa-cnr.it/ontologies/ModalDescriptions#

2) Ok, assume we have the list somehow, now we want to go from: 
DOLCE3941.owl to, say, DnS.owl, the subset
of DOLCE limited to this graph: http://www.loa-cnr.it/ontologies/DnS#

I tried to slice it and dice it various ways but I didn't manage to get 
"just" DnS from SPARQL.

I managed to get the list of these ontologies relatively easily;
however, I haven't managed to get each ontology separately.
I've included a script that I wrote to play around with this idea.

The problem boils down to a context-sensitive graph query
to retrieve things like:

ns1:requisite
      rdf:type      owl:ObjectProperty ;
      rdfs:domain   [ rdf:type      owl:Class ;
                      owl:unionOf   (ns1:information-object ns1:course 
ns1:role ns1:figure)
                    ] ;
      rdfs:range    ns1:parameter ;
      rdfs:subPropertyOf  :immediate-relation-i ;
      owl:inverseOf  ns1:requisite-for .

In this case, there's a triple:

ns1:requisite rdfs:domain _:x

where _:x corresponds to this:

[ rdf:type      owl:Class ;
  owl:unionOf   (ns1:information-object ns1:course ns1:role ns1:figure)
]

I understand that SPARQL was specifically designed for context-free queries
that could be executed very efficiently and that extracting _:x in this 
example
requires tracking _:x and all of his "descendent" triples. Be as it may,
it does not change the fact that this type of "projection" or "extraction"
from an OWL ontology is  a reasonable thing to ask for. It is rather
disappointing that it is beyond the scope of what SPARQL can do.
IN practice, it means that for certain types of query, we might use
SPARQL and life will be wonderful and for other queries, we will
be in a quandary wondering which tool (if any) can actually solve
a conceptually simple problem in a practical simple manner.

Any suggestions?

-- Nicolas.

http://eis.jpl.nasa.gov/~rouquett
Received on Saturday, 7 May 2005 07:06:09 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:14:48 GMT