Hello Michael,
*> and +> are SPARQL-BI syntax sugars.
Consider an expression ?subj+>pred that belongs to some group pattern.
Compiler will substitute it with an implicit variable (name
it ?subj_pred) and additionally place a triple pattern
?subj pred ?subj_pred
to the end of the mentioned group pattern. (Multiple occurencies of
same ?X+>y will result in single new pattern.)
?subj*>pred is similar but adds
optional { ?subj pred ?subj_pred }.
Hence the cited statement is equivalent to
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT DISTINCT
?id_prop_rel ?id_prop_rel_name ?id_prop ?id_prop_name
?id_prop_master
?id_name
WHERE {
?id_prop_rel rdfs:label ?id_prop_rel_name .
?id_prop rdfs:label ?id_prop_name .
<http://xmlns.com/foaf/0.1/Person> rdfs:label ?id_name .
{
?id_prop rdfs:domain <http://xmlns.com/foaf/0.1/Person> .
?id_prop rdfs:range ?id_prop_rel
} UNION {
?id_prop rdfs:range <http://xmlns.com/foaf/0.1/Person>.
?id_prop rdfs:domain ?id_prop_rel
}
optional { ?id_prop rdfs:domain ?id_prop_master }
} group by ?id_name ?id_prop_name ?id_prop ?id_prop_rel_name
?id_prop_rel
(Note also that PREFIX bif: is reserved in Virtuoso-BI, so I cut it away
from the text.)
Best Regards,
Ivan Mikhailov
OpenLink Software
http://virtuoso.openlinksw.com
On Tue, 2011-10-11 at 11:53 +0100, Michael Kerrin wrote:
> Hi All,
>
> I am migrating an application from one SPARQL endpoint based on virtuoso
> to one based on Jena ARQ. In the process I have come across a query that
> uses a SPARQL extension specific to virtuoso that I can't figure out
> what it means and I am hoping that one of you guys can explain it to me.
>
> I want to know what the select clause "?id_prop*>rdfs:domain as
> ?id_prop_master" means. It is coming from the full query here. google et
> al strip *> from the query so it is every hard to look this up.
>
> PREFIX owl: <http://www.w3.org/2002/07/owl#>
> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
> PREFIX foaf: <http://xmlns.com/foaf/0.1/>
> PREFIX bif: <http://www.strange.com/#>
> SELECT DISTINCT
> ?id_prop_rel ?id_prop_rel_name ?id_prop ?id_prop_name
> ?id_prop*>rdfs:domain as ?id_prop_master
> ?id_name
> WHERE {
> ?id_prop_rel rdfs:label ?id_prop_rel_name .
> ?id_prop rdfs:label ?id_prop_name .
> <http://xmlns.com/foaf/0.1/Person> rdfs:label ?id_name .
> {
> ?id_prop rdfs:domain <http://xmlns.com/foaf/0.1/Person> .
> ?id_prop rdfs:range ?id_prop_rel
> } UNION {
> ?id_prop rdfs:range <http://xmlns.com/foaf/0.1/Person>.
> ?id_prop rdfs:domain ?id_prop_rel
> }
> } group by ?id_name ?id_prop_name ?id_prop ?id_prop_rel_name
> ?id_prop_rel
>
> Thanks in advance,
> Michael