From 9b1139fe7045a0630e87501235af21803860b80c Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 1 Dec 2023 21:59:18 -0500 Subject: [WIP] Add support for reading and writing variables [WIP] Command line option, move later? 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. --- test/extra/bad/bad-var.ttl | 2 + test/extra/bad/manifest.ttl | 6 ++ test/extra/pattern/bad-pattern-graph.nq | 1 + test/extra/pattern/bad-pattern-object.nq | 1 + test/extra/pattern/bad-pattern-object.nt | 1 + test/extra/pattern/bad-pattern-object.ttl | 2 + test/extra/pattern/bad-pattern-predicate.nq | 1 + test/extra/pattern/bad-pattern-predicate.nt | 1 + test/extra/pattern/bad-pattern-predicate.ttl | 2 + test/extra/pattern/bad-pattern-subject.nq | 1 + test/extra/pattern/bad-pattern-subject.nt | 1 + test/extra/pattern/bad-pattern-subject.ttl | 2 + test/extra/pattern/manifest.ttl | 88 ++++++++++++++++++++++++++++ test/extra/pattern/test-graph-pattern.nq | 1 + test/extra/pattern/test-pattern.nt | 6 ++ test/extra/pattern/test-pattern.ttl | 10 ++++ 16 files changed, 126 insertions(+) create mode 100644 test/extra/bad/bad-var.ttl create mode 100644 test/extra/pattern/bad-pattern-graph.nq create mode 100644 test/extra/pattern/bad-pattern-object.nq create mode 100644 test/extra/pattern/bad-pattern-object.nt create mode 100644 test/extra/pattern/bad-pattern-object.ttl create mode 100644 test/extra/pattern/bad-pattern-predicate.nq create mode 100644 test/extra/pattern/bad-pattern-predicate.nt create mode 100644 test/extra/pattern/bad-pattern-predicate.ttl create mode 100644 test/extra/pattern/bad-pattern-subject.nq create mode 100644 test/extra/pattern/bad-pattern-subject.nt create mode 100644 test/extra/pattern/bad-pattern-subject.ttl create mode 100644 test/extra/pattern/manifest.ttl create mode 100644 test/extra/pattern/test-graph-pattern.nq create mode 100644 test/extra/pattern/test-pattern.nt create mode 100644 test/extra/pattern/test-pattern.ttl (limited to 'test/extra') diff --git a/test/extra/bad/bad-var.ttl b/test/extra/bad/bad-var.ttl new file mode 100644 index 00000000..29b5b008 --- /dev/null +++ b/test/extra/bad/bad-var.ttl @@ -0,0 +1,2 @@ +?s + . diff --git a/test/extra/bad/manifest.ttl b/test/extra/bad/manifest.ttl index 7ab5a427..cd4aee24 100644 --- a/test/extra/bad/manifest.ttl +++ b/test/extra/bad/manifest.ttl @@ -87,6 +87,7 @@ <#bad-uri-scheme> <#bad-uri-scheme-start> <#bad-uri-truncated> + <#bad-var> <#bad-verb> ) . @@ -490,6 +491,11 @@ mf:action ; mf:name "bad-uri-truncated" . +<#bad-var> + a rdft:TestTurtleNegativeSyntax ; + mf:action ; + mf:name "bad-var" . + <#bad-verb> a rdft:TestTurtleNegativeSyntax ; mf:action ; diff --git a/test/extra/pattern/bad-pattern-graph.nq b/test/extra/pattern/bad-pattern-graph.nq new file mode 100644 index 00000000..9c77ac9a --- /dev/null +++ b/test/extra/pattern/bad-pattern-graph.nq @@ -0,0 +1 @@ + ?gµ . diff --git a/test/extra/pattern/bad-pattern-object.nq b/test/extra/pattern/bad-pattern-object.nq new file mode 100644 index 00000000..7f22b520 --- /dev/null +++ b/test/extra/pattern/bad-pattern-object.nq @@ -0,0 +1 @@ + ?oµ . diff --git a/test/extra/pattern/bad-pattern-object.nt b/test/extra/pattern/bad-pattern-object.nt new file mode 100644 index 00000000..aef057e4 --- /dev/null +++ b/test/extra/pattern/bad-pattern-object.nt @@ -0,0 +1 @@ + ?oµ . diff --git a/test/extra/pattern/bad-pattern-object.ttl b/test/extra/pattern/bad-pattern-object.ttl new file mode 100644 index 00000000..cc2eee77 --- /dev/null +++ b/test/extra/pattern/bad-pattern-object.ttl @@ -0,0 +1,2 @@ + + ?oµ . diff --git a/test/extra/pattern/bad-pattern-predicate.nq b/test/extra/pattern/bad-pattern-predicate.nq new file mode 100644 index 00000000..cfe466c9 --- /dev/null +++ b/test/extra/pattern/bad-pattern-predicate.nq @@ -0,0 +1 @@ + ?pµ . diff --git a/test/extra/pattern/bad-pattern-predicate.nt b/test/extra/pattern/bad-pattern-predicate.nt new file mode 100644 index 00000000..a7e0c994 --- /dev/null +++ b/test/extra/pattern/bad-pattern-predicate.nt @@ -0,0 +1 @@ + ?pµ . diff --git a/test/extra/pattern/bad-pattern-predicate.ttl b/test/extra/pattern/bad-pattern-predicate.ttl new file mode 100644 index 00000000..cc2bd6b1 --- /dev/null +++ b/test/extra/pattern/bad-pattern-predicate.ttl @@ -0,0 +1,2 @@ + + ?pµ . diff --git a/test/extra/pattern/bad-pattern-subject.nq b/test/extra/pattern/bad-pattern-subject.nq new file mode 100644 index 00000000..341c437f --- /dev/null +++ b/test/extra/pattern/bad-pattern-subject.nq @@ -0,0 +1 @@ +?sµ . diff --git a/test/extra/pattern/bad-pattern-subject.nt b/test/extra/pattern/bad-pattern-subject.nt new file mode 100644 index 00000000..5bbb29ff --- /dev/null +++ b/test/extra/pattern/bad-pattern-subject.nt @@ -0,0 +1 @@ +?sµ . diff --git a/test/extra/pattern/bad-pattern-subject.ttl b/test/extra/pattern/bad-pattern-subject.ttl new file mode 100644 index 00000000..5f3dbfdd --- /dev/null +++ b/test/extra/pattern/bad-pattern-subject.ttl @@ -0,0 +1,2 @@ +?sµ + . diff --git a/test/extra/pattern/manifest.ttl b/test/extra/pattern/manifest.ttl new file mode 100644 index 00000000..e5690218 --- /dev/null +++ b/test/extra/pattern/manifest.ttl @@ -0,0 +1,88 @@ +@prefix mf: . +@prefix rdfs: . +@prefix rdft: . + +<> + a mf:Manifest ; + rdfs:comment "Serd pattern syntax test suite" ; + 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> + a rdft:TestNQuadsNegativeSyntax ; + mf:action ; + mf:name "bad-pattern-graph-nq" . + +<#bad-pattern-object-nq> + a rdft:TestNQuadsNegativeSyntax ; + mf:action ; + mf:name "bad-pattern-object-nq" . + +<#bad-pattern-object-nt> + a rdft:TestNTriplesNegativeSyntax ; + mf:action ; + mf:name "bad-pattern-object-nt" . + +<#bad-pattern-object-ttl> + a rdft:TestTurtleNegativeSyntax ; + mf:action ; + mf:name "bad-pattern-object-ttl" . + +<#bad-pattern-predicate-nq> + a rdft:TestNQuadsNegativeSyntax ; + mf:action ; + mf:name "bad-pattern-predicate-nq" . + +<#bad-pattern-predicate-nt> + a rdft:TestNTriplesNegativeSyntax ; + mf:action ; + mf:name "bad-pattern-predicate-nt" . + +<#bad-pattern-predicate-ttl> + a rdft:TestTurtleNegativeSyntax ; + mf:action ; + mf:name "bad-pattern-predicate-ttl" . + +<#bad-pattern-subject-nq> + a rdft:TestNQuadsNegativeSyntax ; + mf:action ; + mf:name "bad-pattern-subject-nq" . + +<#bad-pattern-subject-nt> + a rdft:TestNTriplesNegativeSyntax ; + mf:action ; + mf:name "bad-pattern-subject-nt" . + +<#bad-pattern-subject-ttl> + a rdft:TestTurtleNegativeSyntax ; + mf:action ; + mf:name "bad-pattern-subject-ttl" . + +<#test-graph-pattern> + a rdft:TestNQuadsPositiveSyntax ; + mf:action ; + mf:name "test-graph-pattern" . + +<#test-pattern-nt> + a rdft:TestNTriplesPositiveSyntax ; + mf:action ; + mf:name "test-pattern-nt" . + +<#test-pattern-ttl> + a rdft:TestTurtleEval ; + mf:action ; + mf:name "test-pattern" ; + mf:result . diff --git a/test/extra/pattern/test-graph-pattern.nq b/test/extra/pattern/test-graph-pattern.nq new file mode 100644 index 00000000..453e9516 --- /dev/null +++ b/test/extra/pattern/test-graph-pattern.nq @@ -0,0 +1 @@ + ?g . diff --git a/test/extra/pattern/test-pattern.nt b/test/extra/pattern/test-pattern.nt new file mode 100644 index 00000000..ddfe6d3c --- /dev/null +++ b/test/extra/pattern/test-pattern.nt @@ -0,0 +1,6 @@ +?s . + ?p . + ?o . + _:b1 . +_:b1 ?2p . +_:b1 ?_o . diff --git a/test/extra/pattern/test-pattern.ttl b/test/extra/pattern/test-pattern.ttl new file mode 100644 index 00000000..3742e5ed --- /dev/null +++ b/test/extra/pattern/test-pattern.ttl @@ -0,0 +1,10 @@ +?s + . + + + ?p ; + ?o ; + [ + ?2p ; + ?_o + ] . -- cgit v1.2.1