Follows SPARQL 1.2 SEP 0006. It is behind a sep-0006 feature in spargebra and sparql-smith and enabled by default in oxigraph. Apache Jena tests are passing. SEP 0006: https://github.com/w3c/sparql-12/blob/main/SEP/SEP-0006/sep-0006.mdpull/341/head
parent
3f3523963d
commit
76dd879ea6
@ -0,0 +1,5 @@ |
|||||||
|
@prefix ex: <http://example.org/> . |
||||||
|
|
||||||
|
ex:s1 a ex:T ; ex:p 11 , 12 , 13 . |
||||||
|
ex:s2 a ex:T ; ex:p 21 , 22 , 23 . |
||||||
|
ex:s3 a ex:T . |
@ -0,0 +1,6 @@ |
|||||||
|
PREFIX ex: <http://example.org/> |
||||||
|
|
||||||
|
SELECT ?s ?o WHERE { |
||||||
|
VALUES ?s { ex:S } |
||||||
|
LATERAL { VALUES ?o { ex:O } FILTER(BOUND(?s) && EXISTS { FILTER(BOUND(?s)) }) } |
||||||
|
} |
@ -0,0 +1,6 @@ |
|||||||
|
PREFIX ex: <http://example.org/> |
||||||
|
|
||||||
|
SELECT ?s ?o WHERE { |
||||||
|
VALUES ?s { ex:S } |
||||||
|
LATERAL { GRAPH ex:G { FILTER(BOUND(?s)) . VALUES ?o { ex:O } } } |
||||||
|
} |
@ -0,0 +1,9 @@ |
|||||||
|
PREFIX ex: <http://example.org/> |
||||||
|
|
||||||
|
SELECT ?s ?o WHERE { |
||||||
|
VALUES ?s { ex:S } |
||||||
|
LATERAL { |
||||||
|
{ VALUES ?o { ex:O } } |
||||||
|
{ FILTER(BOUND(?s) && !BOUND(?o)) } |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,68 @@ |
|||||||
|
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . |
||||||
|
@prefix : <https://github.com/oxigraph/oxigraph/tests/sparql/lateral/manifest#> . |
||||||
|
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . |
||||||
|
@prefix mf: <http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#> . |
||||||
|
@prefix qt: <http://www.w3.org/2001/sw/DataAccess/tests/test-query#> . |
||||||
|
@prefix ut: <http://www.w3.org/2009/sparql/tests/test-update#> . |
||||||
|
|
||||||
|
<> rdf:type mf:Manifest ; |
||||||
|
rdfs:label "Oxigraph LATERAL feature SPARQL tests" ; |
||||||
|
mf:entries |
||||||
|
( |
||||||
|
:subselect |
||||||
|
:subselect_inside_optional |
||||||
|
:subselect_outside_optional |
||||||
|
:subselect_aggregate |
||||||
|
:optional |
||||||
|
:graph |
||||||
|
:filter |
||||||
|
:join |
||||||
|
) . |
||||||
|
|
||||||
|
:subselect rdf:type mf:QueryEvaluationTest ; |
||||||
|
mf:name "Basic subselect LATERAL test" ; |
||||||
|
mf:action |
||||||
|
[ qt:query <subselect.rq> ; |
||||||
|
qt:data <basic_input.ttl> ] ; |
||||||
|
mf:result <subselect.srx> . |
||||||
|
|
||||||
|
:subselect_inside_optional rdf:type mf:QueryEvaluationTest ; |
||||||
|
mf:name "Basic subselect LATERAL test inside OPTIONAL" ; |
||||||
|
mf:action |
||||||
|
[ qt:query <subselect_inside_optional.rq> ; |
||||||
|
qt:data <basic_input.ttl> ] ; |
||||||
|
mf:result <subselect_inside_optional.srx> . |
||||||
|
|
||||||
|
:subselect_outside_optional rdf:type mf:QueryEvaluationTest ; |
||||||
|
mf:name "Basic subselect test inside LATERAL OPTIONAL" ; |
||||||
|
mf:action |
||||||
|
[ qt:query <subselect_outside_optional.rq> ; |
||||||
|
qt:data <basic_input.ttl> ] ; |
||||||
|
mf:result <subselect_outside_optional.srx> . |
||||||
|
|
||||||
|
:subselect_aggregate rdf:type mf:QueryEvaluationTest ; |
||||||
|
mf:name "LATERAL test with explicit aggregate" ; |
||||||
|
mf:action |
||||||
|
[ qt:query <subselect_aggregate.rq> ; |
||||||
|
qt:data <basic_input.ttl> ] ; |
||||||
|
mf:result <subselect_aggregate.srx> . |
||||||
|
|
||||||
|
:optional rdf:type mf:QueryEvaluationTest ; |
||||||
|
mf:name "LATERAL OPTIONAL test" ; |
||||||
|
mf:action [ qt:query <optional.rq> ] ; |
||||||
|
mf:result <simple.srx> . |
||||||
|
|
||||||
|
:graph rdf:type mf:QueryEvaluationTest ; |
||||||
|
mf:name "LATERAL GRAPH test" ; |
||||||
|
mf:action [ qt:query <graph.rq> ] ; |
||||||
|
mf:result <simple.srx> . |
||||||
|
|
||||||
|
:filter rdf:type mf:QueryEvaluationTest ; |
||||||
|
mf:name "LATERAL FILTER test" ; |
||||||
|
mf:action [ qt:query <filter.rq> ] ; |
||||||
|
mf:result <simple.srx> . |
||||||
|
|
||||||
|
:join rdf:type mf:QueryEvaluationTest ; |
||||||
|
mf:name "join in LATERAL test" ; |
||||||
|
mf:action [ qt:query <join.rq> ] ; |
||||||
|
mf:result <simple.srx> . |
@ -0,0 +1,6 @@ |
|||||||
|
PREFIX ex: <http://example.org/> |
||||||
|
|
||||||
|
SELECT ?s ?o WHERE { |
||||||
|
VALUES ?s { ex:S } |
||||||
|
LATERAL { OPTIONAL { FILTER(BOUND(?s)) . VALUES ?o { ex:O } } } |
||||||
|
} |
@ -0,0 +1,17 @@ |
|||||||
|
<?xml version="1.0"?> |
||||||
|
<sparql xmlns="http://www.w3.org/2005/sparql-results#"> |
||||||
|
<head> |
||||||
|
<variable name="s"/> |
||||||
|
<variable name="o"/> |
||||||
|
</head> |
||||||
|
<results> |
||||||
|
<result> |
||||||
|
<binding name="s"> |
||||||
|
<uri>http://example.org/S</uri> |
||||||
|
</binding> |
||||||
|
<binding name="o"> |
||||||
|
<uri>http://example.org/O</uri> |
||||||
|
</binding> |
||||||
|
</result> |
||||||
|
</results> |
||||||
|
</sparql> |
@ -0,0 +1,6 @@ |
|||||||
|
PREFIX ex: <http://example.org/> |
||||||
|
|
||||||
|
SELECT ?s ?o WHERE { |
||||||
|
?s a ex:T. |
||||||
|
LATERAL {SELECT ?s ?o WHERE { ?s ex:p ?o } ORDER BY ?o LIMIT 2} |
||||||
|
} |
@ -0,0 +1,41 @@ |
|||||||
|
<?xml version="1.0"?> |
||||||
|
<sparql xmlns="http://www.w3.org/2005/sparql-results#"> |
||||||
|
<head> |
||||||
|
<variable name="s"/> |
||||||
|
<variable name="o"/> |
||||||
|
</head> |
||||||
|
<results> |
||||||
|
<result> |
||||||
|
<binding name="s"> |
||||||
|
<uri>http://example.org/s1</uri> |
||||||
|
</binding> |
||||||
|
<binding name="o"> |
||||||
|
<literal datatype="http://www.w3.org/2001/XMLSchema#integer">11</literal> |
||||||
|
</binding> |
||||||
|
</result> |
||||||
|
<result> |
||||||
|
<binding name="s"> |
||||||
|
<uri>http://example.org/s1</uri> |
||||||
|
</binding> |
||||||
|
<binding name="o"> |
||||||
|
<literal datatype="http://www.w3.org/2001/XMLSchema#integer">12</literal> |
||||||
|
</binding> |
||||||
|
</result> |
||||||
|
<result> |
||||||
|
<binding name="s"> |
||||||
|
<uri>http://example.org/s2</uri> |
||||||
|
</binding> |
||||||
|
<binding name="o"> |
||||||
|
<literal datatype="http://www.w3.org/2001/XMLSchema#integer">21</literal> |
||||||
|
</binding> |
||||||
|
</result> |
||||||
|
<result> |
||||||
|
<binding name="s"> |
||||||
|
<uri>http://example.org/s2</uri> |
||||||
|
</binding> |
||||||
|
<binding name="o"> |
||||||
|
<literal datatype="http://www.w3.org/2001/XMLSchema#integer">22</literal> |
||||||
|
</binding> |
||||||
|
</result> |
||||||
|
</results> |
||||||
|
</sparql> |
@ -0,0 +1,6 @@ |
|||||||
|
PREFIX ex: <http://example.org/> |
||||||
|
|
||||||
|
SELECT ?s ?c WHERE { |
||||||
|
?s a ex:T. |
||||||
|
LATERAL {SELECT ?s (MAX(?o) AS ?c) WHERE { ?s ex:p ?o } GROUP BY ?s} |
||||||
|
} |
@ -0,0 +1,25 @@ |
|||||||
|
<?xml version="1.0"?> |
||||||
|
<sparql xmlns="http://www.w3.org/2005/sparql-results#"> |
||||||
|
<head> |
||||||
|
<variable name="s"/> |
||||||
|
<variable name="c"/> |
||||||
|
</head> |
||||||
|
<results> |
||||||
|
<result> |
||||||
|
<binding name="s"> |
||||||
|
<uri>http://example.org/s1</uri> |
||||||
|
</binding> |
||||||
|
<binding name="c"> |
||||||
|
<literal datatype="http://www.w3.org/2001/XMLSchema#integer">13</literal> |
||||||
|
</binding> |
||||||
|
</result> |
||||||
|
<result> |
||||||
|
<binding name="s"> |
||||||
|
<uri>http://example.org/s2</uri> |
||||||
|
</binding> |
||||||
|
<binding name="c"> |
||||||
|
<literal datatype="http://www.w3.org/2001/XMLSchema#integer">23</literal> |
||||||
|
</binding> |
||||||
|
</result> |
||||||
|
</results> |
||||||
|
</sparql> |
@ -0,0 +1,6 @@ |
|||||||
|
PREFIX ex: <http://example.org/> |
||||||
|
|
||||||
|
SELECT ?s ?o WHERE { |
||||||
|
?s a ex:T. |
||||||
|
OPTIONAL { LATERAL {SELECT ?s ?o WHERE { ?s ex:p ?o } ORDER BY ?o LIMIT 2} } |
||||||
|
} |
@ -0,0 +1,35 @@ |
|||||||
|
<?xml version="1.0"?> |
||||||
|
<sparql xmlns="http://www.w3.org/2005/sparql-results#"> |
||||||
|
<head> |
||||||
|
<variable name="s"/> |
||||||
|
<variable name="o"/> |
||||||
|
</head> |
||||||
|
<results> |
||||||
|
<result> |
||||||
|
<binding name="s"> |
||||||
|
<uri>http://example.org/s1</uri> |
||||||
|
</binding> |
||||||
|
<binding name="o"> |
||||||
|
<literal datatype="http://www.w3.org/2001/XMLSchema#integer">11</literal> |
||||||
|
</binding> |
||||||
|
</result> |
||||||
|
<result> |
||||||
|
<binding name="s"> |
||||||
|
<uri>http://example.org/s1</uri> |
||||||
|
</binding> |
||||||
|
<binding name="o"> |
||||||
|
<literal datatype="http://www.w3.org/2001/XMLSchema#integer">12</literal> |
||||||
|
</binding> |
||||||
|
</result> |
||||||
|
<result> |
||||||
|
<binding name="s"> |
||||||
|
<uri>http://example.org/s2</uri> |
||||||
|
</binding> |
||||||
|
</result> |
||||||
|
<result> |
||||||
|
<binding name="s"> |
||||||
|
<uri>http://example.org/s3</uri> |
||||||
|
</binding> |
||||||
|
</result> |
||||||
|
</results> |
||||||
|
</sparql> |
@ -0,0 +1,6 @@ |
|||||||
|
PREFIX ex: <http://example.org/> |
||||||
|
|
||||||
|
SELECT ?s ?o WHERE { |
||||||
|
?s a ex:T. |
||||||
|
LATERAL { OPTIONAL {SELECT ?s ?o WHERE { ?s ex:p ?o } ORDER BY ?o LIMIT 2} } |
||||||
|
} |
@ -0,0 +1,46 @@ |
|||||||
|
<?xml version="1.0"?> |
||||||
|
<sparql xmlns="http://www.w3.org/2005/sparql-results#"> |
||||||
|
<head> |
||||||
|
<variable name="s"/> |
||||||
|
<variable name="o"/> |
||||||
|
</head> |
||||||
|
<results> |
||||||
|
<result> |
||||||
|
<binding name="s"> |
||||||
|
<uri>http://example.org/s1</uri> |
||||||
|
</binding> |
||||||
|
<binding name="o"> |
||||||
|
<literal datatype="http://www.w3.org/2001/XMLSchema#integer">11</literal> |
||||||
|
</binding> |
||||||
|
</result> |
||||||
|
<result> |
||||||
|
<binding name="s"> |
||||||
|
<uri>http://example.org/s1</uri> |
||||||
|
</binding> |
||||||
|
<binding name="o"> |
||||||
|
<literal datatype="http://www.w3.org/2001/XMLSchema#integer">12</literal> |
||||||
|
</binding> |
||||||
|
</result> |
||||||
|
<result> |
||||||
|
<binding name="s"> |
||||||
|
<uri>http://example.org/s2</uri> |
||||||
|
</binding> |
||||||
|
<binding name="o"> |
||||||
|
<literal datatype="http://www.w3.org/2001/XMLSchema#integer">21</literal> |
||||||
|
</binding> |
||||||
|
</result> |
||||||
|
<result> |
||||||
|
<binding name="s"> |
||||||
|
<uri>http://example.org/s2</uri> |
||||||
|
</binding> |
||||||
|
<binding name="o"> |
||||||
|
<literal datatype="http://www.w3.org/2001/XMLSchema#integer">22</literal> |
||||||
|
</binding> |
||||||
|
</result> |
||||||
|
<result> |
||||||
|
<binding name="s"> |
||||||
|
<uri>http://example.org/s3</uri> |
||||||
|
</binding> |
||||||
|
</result> |
||||||
|
</results> |
||||||
|
</sparql> |
Loading…
Reference in new issue