From 7f508b89230b339684a4013dbbad741d9e16e40a Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 18 Dec 2019 19:09:49 -0500 Subject: 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. --- tests/pattern/bad-pattern.nq | 1 + tests/pattern/bad-pattern.ttl | 2 ++ tests/pattern/manifest.ttl | 35 +++++++++++++++++++++++++++++++++++ tests/pattern/test-pattern.nt | 6 ++++++ tests/pattern/test-pattern.ttl | 10 ++++++++++ 5 files changed, 54 insertions(+) create mode 100644 tests/pattern/bad-pattern.nq create mode 100644 tests/pattern/bad-pattern.ttl create mode 100644 tests/pattern/manifest.ttl create mode 100644 tests/pattern/test-pattern.nt create mode 100644 tests/pattern/test-pattern.ttl (limited to 'tests/pattern') diff --git a/tests/pattern/bad-pattern.nq b/tests/pattern/bad-pattern.nq new file mode 100644 index 00000000..a7e0c994 --- /dev/null +++ b/tests/pattern/bad-pattern.nq @@ -0,0 +1 @@ + ?pµ . diff --git a/tests/pattern/bad-pattern.ttl b/tests/pattern/bad-pattern.ttl new file mode 100644 index 00000000..5f3dbfdd --- /dev/null +++ b/tests/pattern/bad-pattern.ttl @@ -0,0 +1,2 @@ +?sµ + . diff --git a/tests/pattern/manifest.ttl b/tests/pattern/manifest.ttl new file mode 100644 index 00000000..a179a64d --- /dev/null +++ b/tests/pattern/manifest.ttl @@ -0,0 +1,35 @@ +@prefix mf: . +@prefix rdf: . +@prefix rdfs: . +@prefix rdft: . + +<> + rdf:type mf:Manifest ; + rdfs:comment "Serd pattern syntax test cases" ; + mf:entries ( + <#bad-pattern-nq> + <#bad-pattern-ttl> + <#test-pattern-nt> + <#test-pattern-ttl> + ) . + +<#bad-pattern-nq> + rdf:type rdft:TestNQuadsNegativeSyntax ; + mf:name "bad-pattern-nq" ; + mf:action . + +<#bad-pattern-ttl> + rdf:type rdft:TestTurtleNegativeSyntax ; + mf:name "bad-pattern" ; + mf:action . + +<#test-pattern-nt> + rdf:type rdft:TestNTriplesPositiveSyntax ; + mf:name "test-pattern-nt" ; + mf:action . + +<#test-pattern-ttl> + rdf:type rdft:TestTurtleEval ; + mf:name "test-pattern" ; + mf:action ; + mf:result . diff --git a/tests/pattern/test-pattern.nt b/tests/pattern/test-pattern.nt new file mode 100644 index 00000000..ddfe6d3c --- /dev/null +++ b/tests/pattern/test-pattern.nt @@ -0,0 +1,6 @@ +?s . + ?p . + ?o . + _:b1 . +_:b1 ?2p . +_:b1 ?_o . diff --git a/tests/pattern/test-pattern.ttl b/tests/pattern/test-pattern.ttl new file mode 100644 index 00000000..3742e5ed --- /dev/null +++ b/tests/pattern/test-pattern.ttl @@ -0,0 +1,10 @@ +?s + . + + + ?p ; + ?o ; + [ + ?2p ; + ?_o + ] . -- cgit v1.2.1