Skip to content

Commit

Permalink
Merge pull request #717 from RDFLib/issue714
Browse files Browse the repository at this point in the history
Issue714
  • Loading branch information
gromgull committed Feb 16, 2017
2 parents aa8bc5e + 376213f commit 74357f4
Show file tree
Hide file tree
Showing 12 changed files with 253 additions and 2 deletions.
4 changes: 2 additions & 2 deletions rdflib/plugins/sparql/parser.py
Expand Up @@ -58,7 +58,7 @@ def expandTriples(terms):
elif t == ';':
if i+1 == len(terms) or terms[i+1] == ";" or terms[i+1] == ".":
continue # this semicolon is spurious
res.append(res[-3])
res.append(res[0])
elif isinstance(t, list):
# BlankNodePropertyList
# is this bnode the object of previous triples?
Expand Down Expand Up @@ -498,7 +498,7 @@ def _hexExpand(match):

# [83] PropertyListPathNotEmpty ::= ( VerbPath | VerbSimple ) ObjectListPath ( ';' ( ( VerbPath | VerbSimple ) ObjectList )? )*
PropertyListPathNotEmpty = (VerbPath | VerbSimple) + ObjectListPath + ZeroOrMore(
';' + Optional((VerbPath | VerbSimple) + ObjectList))
';' + Optional((VerbPath | VerbSimple) + ObjectListPath))

# [82] PropertyListPath ::= Optional(PropertyListPathNotEmpty)
PropertyListPath = Optional(PropertyListPathNotEmpty)
Expand Down
11 changes: 11 additions & 0 deletions test/DAWG/rdflib/bnode-ppath-mix-a.rq
@@ -0,0 +1,11 @@
prefix ex: <http://www.example.org/schema#>
prefix in: <http://www.example.org/instance#>
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>

ask {
?property
a rdf:Property;
rdfs:range/rdfs:subClassOf/rdfs:subClassOf ?classC;
rdfs:domain/rdfs:subClassOf/rdfs:subClassOf ?classF
}
11 changes: 11 additions & 0 deletions test/DAWG/rdflib/bnode-ppath-mix-b.rq
@@ -0,0 +1,11 @@
prefix ex: <http://www.example.org/schema#>
prefix in: <http://www.example.org/instance#>
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>

ask {
?property
rdfs:range/rdfs:subClassOf/rdfs:subClassOf ?classC;
a rdf:Property;
rdfs:domain/rdfs:subClassOf/rdfs:subClassOf ?classF
}
14 changes: 14 additions & 0 deletions test/DAWG/rdflib/bnode-ppath-mix-c.rq
@@ -0,0 +1,14 @@
prefix ex: <http://www.example.org/schema#>
prefix in: <http://www.example.org/instance#>
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>

ask {
?property
rdfs:range
[ rdfs:subClassOf
[ rdfs:subClassOf ?classC ]
];
a rdf:Property ;
rdfs:domain/rdfs:subClassOf/rdfs:subClassOf ?classF .
}
13 changes: 13 additions & 0 deletions test/DAWG/rdflib/bnode-ppath-mix-d.rq
@@ -0,0 +1,13 @@
prefix ex: <http://www.example.org/schema#>
prefix in: <http://www.example.org/instance#>
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>

ask {
?property
rdfs:range/rdfs:subClassOf [
rdfs:subClassOf ?classC
];
a rdf:Property;
rdfs:domain/rdfs:subClassOf/rdfs:subClassOf ?classF
}
13 changes: 13 additions & 0 deletions test/DAWG/rdflib/bnode-ppath-mix-e.rq
@@ -0,0 +1,13 @@
prefix ex: <http://www.example.org/schema#>
prefix in: <http://www.example.org/instance#>
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>

ask {
?property
rdfs:range [
rdfs:subClassOf/rdfs:subClassOf ?classC
];
a rdf:Property;
rdfs:domain/rdfs:subClassOf/rdfs:subClassOf ?classF
}
15 changes: 15 additions & 0 deletions test/DAWG/rdflib/bnode-ppath-mix-f.rq
@@ -0,0 +1,15 @@
prefix ex: <http://www.example.org/schema#>
prefix in: <http://www.example.org/instance#>
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>

ask {
?property
a rdf:Property ;
rdfs:range [
rdfs:subClassOf/rdfs:subClassOf ?classC
];
rdfs:domain [
rdfs:subClassOf/rdfs:subClassOf ?classF
]
}
15 changes: 15 additions & 0 deletions test/DAWG/rdflib/bnode-ppath-mix-g.rq
@@ -0,0 +1,15 @@
prefix ex: <http://www.example.org/schema#>
prefix in: <http://www.example.org/instance#>
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>

ask {
?property
rdfs:range [
rdfs:subClassOf/rdfs:subClassOf ?classC
] ;
a rdf:Property ;
rdfs:domain [
rdfs:subClassOf/rdfs:subClassOf ?classF
] .
}
15 changes: 15 additions & 0 deletions test/DAWG/rdflib/bnode-ppath-mix-h.rq
@@ -0,0 +1,15 @@
prefix ex: <http://www.example.org/schema#>
prefix in: <http://www.example.org/instance#>
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>

ask {
?property
a rdf:Property;
rdfs:range [
rdfs:subClassOf [ rdfs:subClassOf ?classC ]
] ;
rdfs:domain [
rdfs:subClassOf [ rdfs:subClassOf ?classF ]
]
}
5 changes: 5 additions & 0 deletions test/DAWG/rdflib/bnode-ppath-mix.srx
@@ -0,0 +1,5 @@
<sparql xmlns='http://www.w3.org/2005/sparql-results#'>
<head>
</head>
<boolean>true</boolean>
</sparql>
22 changes: 22 additions & 0 deletions test/DAWG/rdflib/bnode-ppath-mix.ttl
@@ -0,0 +1,22 @@
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix ex: <http://www.example.org/schema#>.
@prefix in: <http://www.example.org/instance#>.


in:a rdf:type rdfs:Class;
rdfs:subClassOf in:b.

in:b rdf:type rdfs:Class;
rdfs:subClassOf in:c.

in:d rdf:type rdfs:Class;
rdfs:subClassOf in:e.


in:e rdf:type rdfs:Class;
rdfs:subClassOf in:f.

ex:a rdf:type rdf:Property;
rdfs:range in:a;
rdfs:domain in:d.
117 changes: 117 additions & 0 deletions test/DAWG/rdflib/manifest.ttl
Expand Up @@ -32,6 +32,15 @@
:subqueryagg1
:subqueryagg2

:bnode-ppath-mix-a
:bnode-ppath-mix-b
:bnode-ppath-mix-c
:bnode-ppath-mix-d
:bnode-ppath-mix-e
:bnode-ppath-mix-f
:bnode-ppath-mix-g
:bnode-ppath-mix-h

) .


Expand Down Expand Up @@ -246,3 +255,111 @@ From https://github.com/RDFLib/rdflib/issues/615, contributed by https://github.
qt:data <subqueryagg.ttl> ] ;
mf:result <subqueryagg.tsv>
.

:bnode-ppath-mix-a rdf:type mf:QueryEvaluationTest ;
mf:name "bnode-ppath-mix-a";
rdfs:comment """
From https://github.com/RDFLib/rdflib/issues/714, contributed by https://github.com/tiko-tiko
""";
dawgt:approval dawgt:Approved ;
dawgt:approvedBy <http://gromgull.net/me> ;
mf:action
[ qt:query <bnode-ppath-mix-a.rq> ;
qt:data <bnode-ppath-mix.ttl> ] ;
mf:result <bnode-ppath-mix.srx>
.

:bnode-ppath-mix-b rdf:type mf:QueryEvaluationTest ;
mf:name "bnode-ppath-mix-b";
rdfs:comment """
From https://github.com/RDFLib/rdflib/issues/714, contributed by https://github.com/tiko-tiko
""";
dawgt:approval dawgt:Approved ;
dawgt:approvedBy <http://gromgull.net/me> ;
mf:action
[ qt:query <bnode-ppath-mix-b.rq> ;
qt:data <bnode-ppath-mix.ttl> ] ;
mf:result <bnode-ppath-mix.srx>
.

:bnode-ppath-mix-c rdf:type mf:QueryEvaluationTest ;
mf:name "bnode-ppath-mix-c";
rdfs:comment """
From https://github.com/RDFLib/rdflib/issues/714, contributed by https://github.com/tiko-tiko
""";
dawgt:approval dawgt:Approved ;
dawgt:approvedBy <http://gromgull.net/me> ;
mf:action
[ qt:query <bnode-ppath-mix-c.rq> ;
qt:data <bnode-ppath-mix.ttl> ] ;
mf:result <bnode-ppath-mix.srx>
.


:bnode-ppath-mix-d rdf:type mf:QueryEvaluationTest ;
mf:name "bnode-ppath-mix-d";
rdfs:comment """
From https://github.com/RDFLib/rdflib/issues/714, contributed by https://github.com/tiko-tiko
""";
dawgt:approval dawgt:Approved ;
dawgt:approvedBy <http://gromgull.net/me> ;
mf:action
[ qt:query <bnode-ppath-mix-d.rq> ;
qt:data <bnode-ppath-mix.ttl> ] ;
mf:result <bnode-ppath-mix.srx>
.



:bnode-ppath-mix-e rdf:type mf:QueryEvaluationTest ;
mf:name "bnode-ppath-mix-e";
rdfs:comment """
From https://github.com/RDFLib/rdflib/issues/714, contributed by https://github.com/tiko-tiko
""";
dawgt:approval dawgt:Approved ;
dawgt:approvedBy <http://gromgull.net/me> ;
mf:action
[ qt:query <bnode-ppath-mix-e.rq> ;
qt:data <bnode-ppath-mix.ttl> ] ;
mf:result <bnode-ppath-mix.srx>
.


:bnode-ppath-mix-f rdf:type mf:QueryEvaluationTest ;
mf:name "bnode-ppath-mix-f";
rdfs:comment """
From https://github.com/RDFLib/rdflib/issues/714, contributed by https://github.com/tiko-tiko
""";
dawgt:approval dawgt:Approved ;
dawgt:approvedBy <http://gromgull.net/me> ;
mf:action
[ qt:query <bnode-ppath-mix-f.rq> ;
qt:data <bnode-ppath-mix.ttl> ] ;
mf:result <bnode-ppath-mix.srx>
.

:bnode-ppath-mix-g rdf:type mf:QueryEvaluationTest ;
mf:name "bnode-ppath-mix-g";
rdfs:comment """
From https://github.com/RDFLib/rdflib/issues/714, contributed by https://github.com/tiko-tiko
""";
dawgt:approval dawgt:Approved ;
dawgt:approvedBy <http://gromgull.net/me> ;
mf:action
[ qt:query <bnode-ppath-mix-g.rq> ;
qt:data <bnode-ppath-mix.ttl> ] ;
mf:result <bnode-ppath-mix.srx>
.

:bnode-ppath-mix-h rdf:type mf:QueryEvaluationTest ;
mf:name "bnode-ppath-mix-h";
rdfs:comment """
From https://github.com/RDFLib/rdflib/issues/714, contributed by https://github.com/tiko-tiko
""";
dawgt:approval dawgt:Approved ;
dawgt:approvedBy <http://gromgull.net/me> ;
mf:action
[ qt:query <bnode-ppath-mix-h.rq> ;
qt:data <bnode-ppath-mix.ttl> ] ;
mf:result <bnode-ppath-mix.srx>
.

0 comments on commit 74357f4

Please sign in to comment.