From b404312686874e539b617d1f27ccbaa5a82936af Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 21 Oct 2021 15:38:10 -0400 Subject: Replace serdi with more fine-grained tools Especially with the new functionality, the complexity of the command-line interface alone was really becoming unmanageable. The serdi implementation also had the highest cyclomatic complexity of the entire codebase by a huge margin. So, take a page from the Unix philosophy and split serdi into several more finely-honed tools that can be freely composed. Though there is still unfortunately quite a bit of option overlap between them due to the common details of reading RDF, I think the resulting tools are a lot easier to understand, both from a user and a developer perspective. --- test/filter/input.ttl | 9 +++++++++ test/filter/manifest.ttl | 48 +++++++++++++++++++++++++++++++++++++++++++++++ test/filter/meson.build | 15 +++++++++++++++ test/filter/o1.pattern.nt | 1 + test/filter/o1.result.nt | 2 ++ test/filter/p1.pattern.nt | 1 + test/filter/p1.result.nt | 2 ++ test/filter/s1.pattern.nt | 1 + test/filter/s1.result.nt | 2 ++ 9 files changed, 81 insertions(+) create mode 100644 test/filter/input.ttl create mode 100644 test/filter/manifest.ttl create mode 100644 test/filter/meson.build create mode 100644 test/filter/o1.pattern.nt create mode 100644 test/filter/o1.result.nt create mode 100644 test/filter/p1.pattern.nt create mode 100644 test/filter/p1.result.nt create mode 100644 test/filter/s1.pattern.nt create mode 100644 test/filter/s1.result.nt (limited to 'test/filter') diff --git a/test/filter/input.ttl b/test/filter/input.ttl new file mode 100644 index 00000000..59aa67f7 --- /dev/null +++ b/test/filter/input.ttl @@ -0,0 +1,9 @@ +@prefix eg: . + +eg:s1 + eg:p1 eg:o1 ; + eg:p2 eg:o2 . + +eg:s2 + eg:p1 eg:o1 ; + eg:p2 eg:o2 . diff --git a/test/filter/manifest.ttl b/test/filter/manifest.ttl new file mode 100644 index 00000000..59ce3f55 --- /dev/null +++ b/test/filter/manifest.ttl @@ -0,0 +1,48 @@ +@prefix checks: . +@prefix mf: . +@prefix rdf: . +@prefix rdfs: . +@prefix rdft: . +@prefix serd: . + +rdft:Test + rdfs:subClassOf mf:ManifestEntry . + +serd:patternFile + a rdf:Property ; + rdfs:label "pattern file" . + +serd:TestFilterPositive + a rdfs:Class ; + rdfs:label "Positive Filtering" ; + rdfs:subClassOf rdft:Test . + +<> + a mf:Manifest ; + rdfs:comment "Serd filter test cases" ; + mf:entries ( + <#s1> + <#p1> + <#o1> + ) . + +<#s1> + a serd:TestFilterPositive ; + serd:patternFile ; + mf:name "s1" ; + mf:action ; + mf:result . + +<#p1> + a serd:TestFilterPositive ; + serd:patternFile ; + mf:name "p1" ; + mf:action ; + mf:result . + +<#o1> + a serd:TestFilterPositive ; + serd:patternFile ; + mf:name "o1" ; + mf:action ; + mf:result . diff --git a/test/filter/meson.build b/test/filter/meson.build new file mode 100644 index 00000000..fd2b1bca --- /dev/null +++ b/test/filter/meson.build @@ -0,0 +1,15 @@ +base_uri = 'http://drobilla.net/sw/serd/test/filter/' + +test('filter', + run_filter_suite, + args: common_script_options + [ + '--pipe', + serd_pipe, + '--filter', + serd_filter, + files('manifest.ttl'), + base_uri + ], + env: test_env, + suite: ['suite', 'extra'], + timeout: 240) diff --git a/test/filter/o1.pattern.nt b/test/filter/o1.pattern.nt new file mode 100644 index 00000000..41932fd7 --- /dev/null +++ b/test/filter/o1.pattern.nt @@ -0,0 +1 @@ +?s ?p . diff --git a/test/filter/o1.result.nt b/test/filter/o1.result.nt new file mode 100644 index 00000000..e7b1e759 --- /dev/null +++ b/test/filter/o1.result.nt @@ -0,0 +1,2 @@ + . + . diff --git a/test/filter/p1.pattern.nt b/test/filter/p1.pattern.nt new file mode 100644 index 00000000..fca20e94 --- /dev/null +++ b/test/filter/p1.pattern.nt @@ -0,0 +1 @@ +?s ?o . diff --git a/test/filter/p1.result.nt b/test/filter/p1.result.nt new file mode 100644 index 00000000..e7b1e759 --- /dev/null +++ b/test/filter/p1.result.nt @@ -0,0 +1,2 @@ + . + . diff --git a/test/filter/s1.pattern.nt b/test/filter/s1.pattern.nt new file mode 100644 index 00000000..f5b87db1 --- /dev/null +++ b/test/filter/s1.pattern.nt @@ -0,0 +1 @@ + ?p ?o . diff --git a/test/filter/s1.result.nt b/test/filter/s1.result.nt new file mode 100644 index 00000000..023faf42 --- /dev/null +++ b/test/filter/s1.result.nt @@ -0,0 +1,2 @@ + . + . -- cgit v1.2.1