aboutsummaryrefslogtreecommitdiffstats
path: root/test/pattern
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2019-12-18 19:09:49 -0500
committerDavid Robillard <d@drobilla.net>2022-01-13 23:05:26 -0500
commit5d43cb36087292a397992aa1b59326fc355d5247 (patch)
treef313f87fea160cd52af3bba8c3de77c25b0519bf /test/pattern
parent55e28966226268a57edb07419ac419ef53ac437d (diff)
downloadserd-5d43cb36087292a397992aa1b59326fc355d5247.tar.gz
serd-5d43cb36087292a397992aa1b59326fc355d5247.tar.bz2
serd-5d43cb36087292a397992aa1b59326fc355d5247.zip
Add support for parsing variables
This adds a reader flag and serdi option for extending a syntax with support for SPARQL-like variables, for storing things like patterns or simple queries.
Diffstat (limited to 'test/pattern')
-rw-r--r--test/pattern/bad-pattern-graph.nq1
-rw-r--r--test/pattern/bad-pattern-object.nq1
-rw-r--r--test/pattern/bad-pattern-object.nt1
-rw-r--r--test/pattern/bad-pattern-object.ttl2
-rw-r--r--test/pattern/bad-pattern-predicate.nq1
-rw-r--r--test/pattern/bad-pattern-predicate.nt1
-rw-r--r--test/pattern/bad-pattern-predicate.ttl2
-rw-r--r--test/pattern/bad-pattern-subject.nq1
-rw-r--r--test/pattern/bad-pattern-subject.nt1
-rw-r--r--test/pattern/bad-pattern-subject.ttl2
-rw-r--r--test/pattern/manifest.ttl89
-rw-r--r--test/pattern/test-graph-pattern.nq1
-rw-r--r--test/pattern/test-pattern.nt6
-rw-r--r--test/pattern/test-pattern.ttl10
14 files changed, 119 insertions, 0 deletions
diff --git a/test/pattern/bad-pattern-graph.nq b/test/pattern/bad-pattern-graph.nq
new file mode 100644
index 00000000..9c77ac9a
--- /dev/null
+++ b/test/pattern/bad-pattern-graph.nq
@@ -0,0 +1 @@
+<http://example.org/s> <http://example.org/p> <http://example.org/o> ?gµ .
diff --git a/test/pattern/bad-pattern-object.nq b/test/pattern/bad-pattern-object.nq
new file mode 100644
index 00000000..7f22b520
--- /dev/null
+++ b/test/pattern/bad-pattern-object.nq
@@ -0,0 +1 @@
+<http://example.org/s> <http://example.org/p> ?oµ <http://example.org/g> .
diff --git a/test/pattern/bad-pattern-object.nt b/test/pattern/bad-pattern-object.nt
new file mode 100644
index 00000000..aef057e4
--- /dev/null
+++ b/test/pattern/bad-pattern-object.nt
@@ -0,0 +1 @@
+<http://example.org/s> <http://example.org/p> ?oµ .
diff --git a/test/pattern/bad-pattern-object.ttl b/test/pattern/bad-pattern-object.ttl
new file mode 100644
index 00000000..cc2eee77
--- /dev/null
+++ b/test/pattern/bad-pattern-object.ttl
@@ -0,0 +1,2 @@
+<http://example.org/s>
+ <http://example.org/o> ?oµ .
diff --git a/test/pattern/bad-pattern-predicate.nq b/test/pattern/bad-pattern-predicate.nq
new file mode 100644
index 00000000..cfe466c9
--- /dev/null
+++ b/test/pattern/bad-pattern-predicate.nq
@@ -0,0 +1 @@
+<http://example.org/s> ?pµ <http://example.org/o> <http://example.org/g> .
diff --git a/test/pattern/bad-pattern-predicate.nt b/test/pattern/bad-pattern-predicate.nt
new file mode 100644
index 00000000..a7e0c994
--- /dev/null
+++ b/test/pattern/bad-pattern-predicate.nt
@@ -0,0 +1 @@
+<http://example.org/s> ?pµ <http://example.org/o> .
diff --git a/test/pattern/bad-pattern-predicate.ttl b/test/pattern/bad-pattern-predicate.ttl
new file mode 100644
index 00000000..cc2bd6b1
--- /dev/null
+++ b/test/pattern/bad-pattern-predicate.ttl
@@ -0,0 +1,2 @@
+<http://example.org/s>
+ ?pµ <http://example.org/o> .
diff --git a/test/pattern/bad-pattern-subject.nq b/test/pattern/bad-pattern-subject.nq
new file mode 100644
index 00000000..341c437f
--- /dev/null
+++ b/test/pattern/bad-pattern-subject.nq
@@ -0,0 +1 @@
+?sµ <http://example.org/p> <http://example.org/o> <http://example.org/g> .
diff --git a/test/pattern/bad-pattern-subject.nt b/test/pattern/bad-pattern-subject.nt
new file mode 100644
index 00000000..5bbb29ff
--- /dev/null
+++ b/test/pattern/bad-pattern-subject.nt
@@ -0,0 +1 @@
+?sµ <http://example.org/p> <http://example.org/o> .
diff --git a/test/pattern/bad-pattern-subject.ttl b/test/pattern/bad-pattern-subject.ttl
new file mode 100644
index 00000000..5f3dbfdd
--- /dev/null
+++ b/test/pattern/bad-pattern-subject.ttl
@@ -0,0 +1,2 @@
+?sµ
+ <http://example.org/p> <http://example.org/o> .
diff --git a/test/pattern/manifest.ttl b/test/pattern/manifest.ttl
new file mode 100644
index 00000000..a7f238bc
--- /dev/null
+++ b/test/pattern/manifest.ttl
@@ -0,0 +1,89 @@
+@prefix mf: <http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#> .
+@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+@prefix rdft: <http://www.w3.org/ns/rdftest#> .
+
+<>
+ rdf:type mf:Manifest ;
+ rdfs:comment "Serd pattern syntax test cases" ;
+ mf:entries (
+ <#bad-pattern-graph-nq>
+ <#bad-pattern-object-nq>
+ <#bad-pattern-object-nt>
+ <#bad-pattern-object-ttl>
+ <#bad-pattern-predicate-nq>
+ <#bad-pattern-predicate-nt>
+ <#bad-pattern-predicate-ttl>
+ <#bad-pattern-subject-nq>
+ <#bad-pattern-subject-nt>
+ <#bad-pattern-subject-ttl>
+ <#test-graph-pattern>
+ <#test-pattern-nt>
+ <#test-pattern-ttl>
+ ) .
+
+<#bad-pattern-graph-nq>
+ rdf:type rdft:TestNQuadsNegativeSyntax ;
+ mf:name "bad-pattern-graph-nq" ;
+ mf:action <bad-pattern-graph.nq> .
+
+<#bad-pattern-object-nq>
+ rdf:type rdft:TestNQuadsNegativeSyntax ;
+ mf:name "bad-pattern-object-nq" ;
+ mf:action <bad-pattern-object.nq> .
+
+<#bad-pattern-object-nt>
+ rdf:type rdft:TestNTriplesNegativeSyntax ;
+ mf:name "bad-pattern-object-nt" ;
+ mf:action <bad-pattern-object.nt> .
+
+<#bad-pattern-object-ttl>
+ rdf:type rdft:TestTurtleNegativeSyntax ;
+ mf:name "bad-pattern-object-ttl" ;
+ mf:action <bad-pattern-object.ttl> .
+
+<#bad-pattern-predicate-nq>
+ rdf:type rdft:TestNQuadsNegativeSyntax ;
+ mf:name "bad-pattern-predicate-nq" ;
+ mf:action <bad-pattern-predicate.nq> .
+
+<#bad-pattern-predicate-nt>
+ rdf:type rdft:TestNTriplesNegativeSyntax ;
+ mf:name "bad-pattern-predicate-nt" ;
+ mf:action <bad-pattern-predicate.nt> .
+
+<#bad-pattern-predicate-ttl>
+ rdf:type rdft:TestTurtleNegativeSyntax ;
+ mf:name "bad-pattern-predicate-ttl" ;
+ mf:action <bad-pattern-predicate.ttl> .
+
+<#bad-pattern-subject-nq>
+ rdf:type rdft:TestNQuadsNegativeSyntax ;
+ mf:name "bad-pattern-subject-nq" ;
+ mf:action <bad-pattern-subject.nq> .
+
+<#bad-pattern-subject-nt>
+ rdf:type rdft:TestNTriplesNegativeSyntax ;
+ mf:name "bad-pattern-subject-nt" ;
+ mf:action <bad-pattern-subject.nt> .
+
+<#bad-pattern-subject-ttl>
+ rdf:type rdft:TestTurtleNegativeSyntax ;
+ mf:name "bad-pattern-subject-ttl" ;
+ mf:action <bad-pattern-subject.ttl> .
+
+<#test-graph-pattern>
+ rdf:type rdft:TestNQuadsPositiveSyntax ;
+ mf:name "test-graph-pattern" ;
+ mf:action <test-graph-pattern.nq> .
+
+<#test-pattern-nt>
+ rdf:type rdft:TestNTriplesPositiveSyntax ;
+ mf:name "test-pattern-nt" ;
+ mf:action <test-pattern.nt> .
+
+<#test-pattern-ttl>
+ rdf:type rdft:TestTurtleEval ;
+ mf:name "test-pattern" ;
+ mf:action <test-pattern.ttl> ;
+ mf:result <test-pattern.nt> .
diff --git a/test/pattern/test-graph-pattern.nq b/test/pattern/test-graph-pattern.nq
new file mode 100644
index 00000000..453e9516
--- /dev/null
+++ b/test/pattern/test-graph-pattern.nq
@@ -0,0 +1 @@
+<http://a.example/s> <http://a.example/p> <http://a.example/o> ?g .
diff --git a/test/pattern/test-pattern.nt b/test/pattern/test-pattern.nt
new file mode 100644
index 00000000..ddfe6d3c
--- /dev/null
+++ b/test/pattern/test-pattern.nt
@@ -0,0 +1,6 @@
+?s <http://example.org/p1> <http://example.org/o1> .
+<http://example.org/s> ?p <http://example.org/o1> .
+<http://example.org/s> <http://example.org/p1> ?o .
+<http://example.org/s> <http://example.org/p2> _:b1 .
+_:b1 ?2p <http://example.org/o2> .
+_:b1 <http://example.org/p3> ?_o .
diff --git a/test/pattern/test-pattern.ttl b/test/pattern/test-pattern.ttl
new file mode 100644
index 00000000..3742e5ed
--- /dev/null
+++ b/test/pattern/test-pattern.ttl
@@ -0,0 +1,10 @@
+?s
+ <http://example.org/p1> <http://example.org/o1> .
+
+<http://example.org/s>
+ ?p <http://example.org/o1> ;
+ <http://example.org/p1> ?o ;
+ <http://example.org/p2> [
+ ?2p <http://example.org/o2> ;
+ <http://example.org/p3> ?_o
+ ] .