diff options
author | Gunnar Aastrand Grimnes <gromgull@users.noreply.github.com> | 2017-02-16 09:26:47 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-16 09:26:47 +0100 |
commit | 74357f4b91fc36504a09e3a37bc6d277dd70f966 (patch) | |
tree | fa0cd7e4af50c3e48ecef53640a30f5096bdb1c5 | |
parent | aa8bc5e703c36e0edd740e0f4357134f2ef3b69e (diff) | |
parent | 376213ffcdd6b65acd104ddaa34b272ae8656823 (diff) | |
download | rdflib-74357f4b91fc36504a09e3a37bc6d277dd70f966.tar.gz |
Merge pull request #717 from RDFLib/issue714
Issue714
-rw-r--r-- | rdflib/plugins/sparql/parser.py | 4 | ||||
-rw-r--r-- | test/DAWG/rdflib/bnode-ppath-mix-a.rq | 11 | ||||
-rw-r--r-- | test/DAWG/rdflib/bnode-ppath-mix-b.rq | 11 | ||||
-rw-r--r-- | test/DAWG/rdflib/bnode-ppath-mix-c.rq | 14 | ||||
-rw-r--r-- | test/DAWG/rdflib/bnode-ppath-mix-d.rq | 13 | ||||
-rw-r--r-- | test/DAWG/rdflib/bnode-ppath-mix-e.rq | 13 | ||||
-rw-r--r-- | test/DAWG/rdflib/bnode-ppath-mix-f.rq | 15 | ||||
-rw-r--r-- | test/DAWG/rdflib/bnode-ppath-mix-g.rq | 15 | ||||
-rw-r--r-- | test/DAWG/rdflib/bnode-ppath-mix-h.rq | 15 | ||||
-rw-r--r-- | test/DAWG/rdflib/bnode-ppath-mix.srx | 5 | ||||
-rw-r--r-- | test/DAWG/rdflib/bnode-ppath-mix.ttl | 22 | ||||
-rw-r--r-- | test/DAWG/rdflib/manifest.ttl | 117 |
12 files changed, 253 insertions, 2 deletions
diff --git a/rdflib/plugins/sparql/parser.py b/rdflib/plugins/sparql/parser.py index 6c56b72d..eda40bf2 100644 --- a/rdflib/plugins/sparql/parser.py +++ b/rdflib/plugins/sparql/parser.py @@ -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? @@ -498,7 +498,7 @@ ObjectList = Object + ZeroOrMore(',' + Object) # [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) diff --git a/test/DAWG/rdflib/bnode-ppath-mix-a.rq b/test/DAWG/rdflib/bnode-ppath-mix-a.rq new file mode 100644 index 00000000..217836ee --- /dev/null +++ b/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 +} diff --git a/test/DAWG/rdflib/bnode-ppath-mix-b.rq b/test/DAWG/rdflib/bnode-ppath-mix-b.rq new file mode 100644 index 00000000..d09d8553 --- /dev/null +++ b/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 +} diff --git a/test/DAWG/rdflib/bnode-ppath-mix-c.rq b/test/DAWG/rdflib/bnode-ppath-mix-c.rq new file mode 100644 index 00000000..9d812be5 --- /dev/null +++ b/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 . +} diff --git a/test/DAWG/rdflib/bnode-ppath-mix-d.rq b/test/DAWG/rdflib/bnode-ppath-mix-d.rq new file mode 100644 index 00000000..c6da64c4 --- /dev/null +++ b/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 +} diff --git a/test/DAWG/rdflib/bnode-ppath-mix-e.rq b/test/DAWG/rdflib/bnode-ppath-mix-e.rq new file mode 100644 index 00000000..bd3dd673 --- /dev/null +++ b/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 +} diff --git a/test/DAWG/rdflib/bnode-ppath-mix-f.rq b/test/DAWG/rdflib/bnode-ppath-mix-f.rq new file mode 100644 index 00000000..362d3675 --- /dev/null +++ b/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 + ] +} diff --git a/test/DAWG/rdflib/bnode-ppath-mix-g.rq b/test/DAWG/rdflib/bnode-ppath-mix-g.rq new file mode 100644 index 00000000..a42148e7 --- /dev/null +++ b/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 + ] . +} diff --git a/test/DAWG/rdflib/bnode-ppath-mix-h.rq b/test/DAWG/rdflib/bnode-ppath-mix-h.rq new file mode 100644 index 00000000..dd79d32b --- /dev/null +++ b/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 ] + ] +} diff --git a/test/DAWG/rdflib/bnode-ppath-mix.srx b/test/DAWG/rdflib/bnode-ppath-mix.srx new file mode 100644 index 00000000..174f2b76 --- /dev/null +++ b/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> diff --git a/test/DAWG/rdflib/bnode-ppath-mix.ttl b/test/DAWG/rdflib/bnode-ppath-mix.ttl new file mode 100644 index 00000000..b1a3c124 --- /dev/null +++ b/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. diff --git a/test/DAWG/rdflib/manifest.ttl b/test/DAWG/rdflib/manifest.ttl index 85ba2db5..bf3a4d1e 100644 --- a/test/DAWG/rdflib/manifest.ttl +++ b/test/DAWG/rdflib/manifest.ttl @@ -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 + ) . @@ -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> + . |