RE: SPARQL vnext new feature? cascadedQueries

I've been experimenting with some syntax for expressing rules in sparql that
can also handle cascaded queries/subselects.


It looks like:


prefix rdf: <>

prefix rdfs: <>

with (

            construct {?a rdf:type rdf:Property. ?x rdf:type rdfs:Resource }
where {?x ?a ?y}

            construct {?y rdf:type rdfs:Resource} where {?x ?a ?y.

            construct {?x rdf:type ?z} where {?a rdfs:domain ?z. ?x ?a ?y}

            construct {?u rdf:type ?z} where {?a rdfs:range ?z. ?x ?a ?u

            construct {?a rdfs:subPropertyOf ?c} where {?a
rdfs:subPropertyOf ?b. ?b rdfs:subPropertyOf ?c}

            construct {?x ?b ?y} where {?a rdfs:subPropertyOf ?b. ?x ?a ?y}

            construct {?x rdfs:subClassOf rdfs:Resource} where {?x rdf:type

            construct {?a rdfs:subClassOf ?c} where {?a rdfs:subClassOf ?b.
?b rdfs:subClassOf ?c}

            construct {?a rdf:type ?y} where {?x rdfs:subClassOf ?y. ?a
rdf:type ?x}


select * where {?s ?p ?o}



which deals nicely with triple rules (WITH syntax is similar in concept to
CTEs in SQL Server). I'm also supporting non-triple rules with a
named-select syntax




            select ?s where {?s ?p ?o} as ex:myselect


select * where {?s ?p ?o. ROWSET ex:myselect (?s)}


The ROWSET operator allows you to reference a named select but also allows
you to make use of built-in, non-functional relations that don't fit nicely
as functions in a filter (e.g. a builtin to expose a relational table to
sparql queries).


Anyone doing anything similar (e.g. rules in sparql?). Does this look like a
reasonable approach?



Received on Tuesday, 6 November 2007 12:18:30 UTC