Skip to Main Content

Database Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

comparing SEM_MATCH and SPARQL syntax

687900Oct 15 2009 — edited Oct 16 2009
Is there any reference that summarizes the differences between SPARQL syntax and SEM_MATCH in 11gR2? The dev guide talks about SEM_MATCH but I'm hoping there's a consise summary somewhere. Or does SEM_MATCH support full SPARQL syntax now?

Brian

Comments

Matperry-Oracle
There is no summary of differences between SPARQL and SEM_MATCH in the Dev guide, but the main differences are as follows:

Basically, the graph pattern parameter of SEM_MATCH accepts a SPARQL WHERE clause, including OPTIONAL, FILTER and UNION. However, SEM_MATCH does not support the following "syntactic sugar" graph pattern shorthands.

1. Predicate-Object Lists

Using

?x foaf:name ?name ;
foaf:mbox ?mbox .

as shorthand for

?x foaf:name ?name .
?x foaf:mbox ?mbox .

2. Object Lists

Using

?x foaf:nick "Alice" , "Alice_" .

as shorthand for

?x foaf:nick "Alice" .
?x foaf:nick "Alice_" .

3. RDF Collections

Using

(1 ?x 3 4) ns1:p "w" .

as shorthand for

?a rdf:first 1 ;
rdf:rest ?b .
?b rdf:first ?x ;
rdf:rest ?c .
?c rdf:first 3 ;
rdf:rest ?d .
?d rdf:first 4 ;
rdf:rest rdf:nil .
?a ns1:p "w" .

and using

(1 \[ns1:p ns1:q\] ( 2 ) ) .

as shorthand for

?a rdf:first 1 ;
rdf:rest ?b .
?b rdf:first ?c .
?c ns1:p ns1:q .
?b rdf:rest ?d .
?d rdf:first ?e .
?e rdf:first 2 ;
rdf:rest rdf:nil .
?d rdf:rest rdf:nil .

4. RDF Type

Using

?x a :Class1 .

as shorthand for

?x rdf:type :Class1 .

5. Blank Nodes

Using

\[ ns1:p "v" \] . or \[\] ns1:p "v" .

as shorthand for

_:bnode ns1:p "v" .

The SPARQL-like syntax of SEM_MATCH also does not support xsd:type constructors. We support the alternative syntax of expressing the RDF term for xsd typed literals.

For example, we do not support

FILTER (?x > xsd:float(3.5))

but we do support the equivalent expression

FILTER (?x > "3.5"^^xsd:float)
687900
Thanks much for the detailed answer. It helps considerably!
1 - 2
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Nov 13 2009
Added on Oct 15 2009
2 comments
2,346 views