aboutsummaryrefslogtreecommitdiffstats
path: root/test/extra
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2023-04-03 09:00:18 -0400
committerDavid Robillard <d@drobilla.net>2023-04-05 09:45:15 -0400
commit1c082131014e579b587f8bb8b89f3c999e22f4ed (patch)
treed81dd0fd13e90a5ac88e939e04ab18363bf84116 /test/extra
parentb135f1d556f3f03c0369efd710b06c5ded728ef9 (diff)
downloadserd-1c082131014e579b587f8bb8b89f3c999e22f4ed.tar.gz
serd-1c082131014e579b587f8bb8b89f3c999e22f4ed.tar.bz2
serd-1c082131014e579b587f8bb8b89f3c999e22f4ed.zip
Add a simple abbreviation test suite
Diffstat (limited to 'test/extra')
-rw-r--r--test/extra/abbreviate/README.md6
-rw-r--r--test/extra/abbreviate/collapse-graphs.nq6
-rw-r--r--test/extra/abbreviate/collapse-graphs.trig18
-rw-r--r--test/extra/abbreviate/collapse-predicates.nt6
-rw-r--r--test/extra/abbreviate/collapse-predicates.ttl7
-rw-r--r--test/extra/abbreviate/collapse-subjects.nt6
-rw-r--r--test/extra/abbreviate/collapse-subjects.ttl11
-rw-r--r--test/extra/abbreviate/manifest.ttl31
8 files changed, 91 insertions, 0 deletions
diff --git a/test/extra/abbreviate/README.md b/test/extra/abbreviate/README.md
new file mode 100644
index 00000000..ac887dc1
--- /dev/null
+++ b/test/extra/abbreviate/README.md
@@ -0,0 +1,6 @@
+Abbreviate Test Suite
+=====================
+
+This suite tests abbreviating "flat" NTriples/NQuads input by eliding subjects
+or predicates in Turtle/Trig. Pretty-printing is more limited here since there
+is no context information to determine if blank nodes are anonymous.
diff --git a/test/extra/abbreviate/collapse-graphs.nq b/test/extra/abbreviate/collapse-graphs.nq
new file mode 100644
index 00000000..40ccc7f9
--- /dev/null
+++ b/test/extra/abbreviate/collapse-graphs.nq
@@ -0,0 +1,6 @@
+<http://example.org/s1> <http://example.org/p1> <http://example.org/o1> <http://example.org/g1> .
+<http://example.org/s1> <http://example.org/p2> <http://example.org/o2> <http://example.org/g1> .
+<http://example.org/s1> <http://example.org/p3> <http://example.org/o3> <http://example.org/g1> .
+<http://example.org/s2> <http://example.org/p4> <http://example.org/o4> <http://example.org/g2> .
+<http://example.org/s3> <http://example.org/p5> <http://example.org/o5> <http://example.org/g3> .
+<http://example.org/s3> <http://example.org/p6> <http://example.org/o6> <http://example.org/g3> .
diff --git a/test/extra/abbreviate/collapse-graphs.trig b/test/extra/abbreviate/collapse-graphs.trig
new file mode 100644
index 00000000..5bdf55ce
--- /dev/null
+++ b/test/extra/abbreviate/collapse-graphs.trig
@@ -0,0 +1,18 @@
+
+<http://example.org/g1> {
+ <http://example.org/s1>
+ <http://example.org/p1> <http://example.org/o1> ;
+ <http://example.org/p2> <http://example.org/o2> ;
+ <http://example.org/p3> <http://example.org/o3> .
+}
+
+<http://example.org/g2> {
+ <http://example.org/s2>
+ <http://example.org/p4> <http://example.org/o4> .
+}
+
+<http://example.org/g3> {
+ <http://example.org/s3>
+ <http://example.org/p5> <http://example.org/o5> ;
+ <http://example.org/p6> <http://example.org/o6> .
+}
diff --git a/test/extra/abbreviate/collapse-predicates.nt b/test/extra/abbreviate/collapse-predicates.nt
new file mode 100644
index 00000000..b1128902
--- /dev/null
+++ b/test/extra/abbreviate/collapse-predicates.nt
@@ -0,0 +1,6 @@
+<http://example.org/s> <http://example.org/p1> <http://example.org/o1> .
+<http://example.org/s> <http://example.org/p1> <http://example.org/o2> .
+<http://example.org/s> <http://example.org/p1> <http://example.org/o3> .
+<http://example.org/s> <http://example.org/p2> <http://example.org/o4> .
+<http://example.org/s> <http://example.org/p3> <http://example.org/o5> .
+<http://example.org/s> <http://example.org/p3> <http://example.org/o6> .
diff --git a/test/extra/abbreviate/collapse-predicates.ttl b/test/extra/abbreviate/collapse-predicates.ttl
new file mode 100644
index 00000000..a0bbd881
--- /dev/null
+++ b/test/extra/abbreviate/collapse-predicates.ttl
@@ -0,0 +1,7 @@
+<http://example.org/s>
+ <http://example.org/p1> <http://example.org/o1> ,
+ <http://example.org/o2> ,
+ <http://example.org/o3> ;
+ <http://example.org/p2> <http://example.org/o4> ;
+ <http://example.org/p3> <http://example.org/o5> ,
+ <http://example.org/o6> .
diff --git a/test/extra/abbreviate/collapse-subjects.nt b/test/extra/abbreviate/collapse-subjects.nt
new file mode 100644
index 00000000..fa5fd630
--- /dev/null
+++ b/test/extra/abbreviate/collapse-subjects.nt
@@ -0,0 +1,6 @@
+<http://example.org/s1> <http://example.org/p1> <http://example.org/o1> .
+<http://example.org/s1> <http://example.org/p2> <http://example.org/o2> .
+<http://example.org/s1> <http://example.org/p3> <http://example.org/o3> .
+<http://example.org/s2> <http://example.org/p4> <http://example.org/o4> .
+<http://example.org/s3> <http://example.org/p5> <http://example.org/o5> .
+<http://example.org/s3> <http://example.org/p6> <http://example.org/o6> .
diff --git a/test/extra/abbreviate/collapse-subjects.ttl b/test/extra/abbreviate/collapse-subjects.ttl
new file mode 100644
index 00000000..b1c86f59
--- /dev/null
+++ b/test/extra/abbreviate/collapse-subjects.ttl
@@ -0,0 +1,11 @@
+<http://example.org/s1>
+ <http://example.org/p1> <http://example.org/o1> ;
+ <http://example.org/p2> <http://example.org/o2> ;
+ <http://example.org/p3> <http://example.org/o3> .
+
+<http://example.org/s2>
+ <http://example.org/p4> <http://example.org/o4> .
+
+<http://example.org/s3>
+ <http://example.org/p5> <http://example.org/o5> ;
+ <http://example.org/p6> <http://example.org/o6> .
diff --git a/test/extra/abbreviate/manifest.ttl b/test/extra/abbreviate/manifest.ttl
new file mode 100644
index 00000000..ddcfdf03
--- /dev/null
+++ b/test/extra/abbreviate/manifest.ttl
@@ -0,0 +1,31 @@
+@prefix mf: <http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#> .
+@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+@prefix rdft: <http://www.w3.org/ns/rdftest#> .
+@prefix serd: <http://drobilla.net/ns/serd#> .
+
+<>
+ a mf:Manifest ;
+ rdfs:comment "Serd abbreviation test cases" ;
+ mf:entries (
+ <#collapse-graphs>
+ <#collapse-predicates>
+ <#collapse-subjects>
+ ) .
+
+<#collapse-graphs>
+ a rdft:TestTurtleEval ;
+ mf:action <collapse-graphs.nq> ;
+ mf:name "collapse-graphs" ;
+ mf:result <collapse-graphs.trig> .
+
+<#collapse-predicates>
+ a rdft:TestTurtleEval ;
+ mf:action <collapse-predicates.nt> ;
+ mf:name "collapse-predicates" ;
+ mf:result <collapse-predicates.ttl> .
+
+<#collapse-subjects>
+ a rdft:TestTurtleEval ;
+ mf:action <collapse-subjects.nt> ;
+ mf:name "collapse-subjects" ;
+ mf:result <collapse-subjects.ttl> .