Suggestions

Some suggestions for SPARQL extensions.
Source: http://www.inria.fr/sophia/edelweiss/software/corese

Olivier


Construct with result of an expression

construct { ?x ?p ?var }
select fun(?y) as ?var
where {
  ?x ?p ?y
}


Group by on result of an expression

select
  fun(?x) as ?val
  count(?doc) as ?count
where {
  ?x c:author ?doc
}
group by ?val



Distinct on result of an expression

select distinct fun(?x) as ?val
where {
  ?x c:author ?doc
}



Several results returned by an expression

select
    fun(?rho, ?theta) as (?x, ?y)
where {
...
}



Get rid of transitivity

?x direct::rdfs:subClassOf ?y

?x direct::rdf:type ?y



Construct with graph

construct {
  graph ?g { ?y ?p ?x }
}
where {
  graph ?g { ?x ?p ?y }
}



Enumerate triples from a path using a (special) graph pattern on a path 
variable

select ?a ?p ?b
where {
?x $path ?y
filter(match($path, 'rdfs:subClassOf *'))
graph $path { ?a ?p ?b }
}

Received on Tuesday, 10 March 2009 17:41:59 UTC