الجمعة، 20 مارس 2009

Proposed features for SPARQL

The W3C has published a wiki page with proposed features for the RDF query language SPARQL. My favorite is “Parameterized Inference”: I've always found how inference is done in RDFS and OWL very cumbersome (i.e. by creating statements). My needs for inference have always been very basic, but just having transitivity available directly in SPARQL would be great.
Other interesting proposals:
I am missing two things:
  • A way to get matches that are only in the default graph. One can do graph-based restriction, but only for named graphs. That is, the variable involved in the GRAPH construct always has to be bound. A work-around that I use in Hyena is to look for matches in all graphs and then exclude a match if it also appears in a named graph.
  • A more object-oriented way of returning query results. That is, one should be able to return one resource per row, where some columns (“all values of rdf:type”) contain multiple values (are in non-first normal form). LIMIT per resource mentions this feature, but does not go into detail.
Update: To clarify the work-around.
Query: all subjects that *only* exist in the default graph.
SELECT DISTINCT ?subj
WHERE {
?subj ?pred ?obj .
OPTIONAL {
GRAPH ?__graph__ {
?subj ?pred ?obj .
}
}
FILTER( !bound(?__graph__) )
}
A simpler version would be (where one does not have to write the same pattern twice which quickly becomes cumbersome with larger patterns):
SELECT DISTINCT ?subj
WHERE {
GRAPH ?__graph__ { ?subj ?pred ?obj . }
FILTER( !bound(?__graph__) )
}

ليست هناك تعليقات:

إرسال تعليق