Skip to content

Commit 015846a

Browse files
Eric Prud'hommeauxclaude
andcommitted
~ README: example invocations for every ShEx validation mode
Concrete, verified bin/sparql commands and real captured output for each mode: a single manifest entry (--shex-run), a ShExMap materialization, and --shex-endpoint's three shapes (fixed, negated "@!", and the {FOCUS ...} query pattern) against a live SPARQL server. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent d2c14e9 commit 015846a

1 file changed

Lines changed: 41 additions & 10 deletions

File tree

‎README‎

Lines changed: 41 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,25 @@ negativeSyntax, negativeStructure and validation manifests);
5252
tests/fetch-test-suites.sh clones the test data.
5353

5454
bin/sparql runs shex-webapp-style validation manifests (JSON or YAML;
55-
see lib/ShExManifest.hpp and tests/ShExManifest/):
55+
see lib/ShExManifest.hpp and tests/ShExManifest/) — a manifest entry
56+
names a schema and data (inline or by URL, relative to the manifest),
57+
a shape map, and the expected overall status:
5658

5759
bin/sparql --shex-manifest tests/ShExManifest/manifest.yaml
58-
bin/sparql --shex-manifest m.json --shex-run '2-5,0'
60+
bin/sparql --shex-manifest tests/ShExManifest/manifest.json --shex-run '2-5,0'
5961

6062
--shex-run selects 0-based entries: ranges like "1", "2-5", "5-2"
61-
(descending) or "*" (everything), comma-separated.
63+
(descending) or "*" (everything), comma-separated; omitted, it runs
64+
every entry. Each entry prints PASS/FAIL against its expected status,
65+
then one line per shape-map association:
66+
67+
$ bin/sparql --shex-manifest tests/ShExManifest/manifest.yaml --shex-run 0
68+
[0] clinical observation / with birthdate: conformant, expected conformant -- PASS
69+
<.../Obs1>@START: conformant
70+
<.../Patient2>@!<.../ObservationShape>: nonconformant
71+
72+
The exit code is the number of entries whose actual status didn't match
73+
`expected` (capped at 125); 0 means every entry passed.
6274

6375
lib/ShExMap.{hpp,cpp} implements the http://shex.io/extensions/Map/#
6476
semantic-action language for mapping between two schemas: validating
@@ -70,33 +82,52 @@ outputShape, createRoot, staticVars and optional expectedBindingsURL /
7082
outputDataURL comparisons (see tests/ShExMap/, ported from shex.js's
7183
packages/extension-map examples):
7284

73-
bin/sparql --shex-manifest tests/ShExMap/manifest.yaml
85+
$ bin/sparql --shex-manifest tests/ShExMap/manifest.yaml --shex-run 0
86+
[0] BP / simple: conformant, expected conformant -- PASS
87+
<tag:BPfhir123>@START: conformant
88+
<tag:b0> <http://dam.example/med#name> "Walker, Alice" .
89+
<tag:b0> <http://dam.example/med#systolic> _:b0xb58c24d20 .
90+
_:b0xb58c24d20 <http://dam.example/med#value> 110 .
91+
_:b0xb58c24d20 <http://dam.example/med#units> "mmHg" .
92+
...
93+
94+
(the materialized graph prints only when the entry's bindings and
95+
output matched their expectations, i.e. the map ran clean).
7496

7597
--shex-endpoint validates a shape map against a *live* SPARQL protocol
7698
endpoint instead of an in-memory graph: node neighborhoods are fetched
7799
and cached as validation visits them (lib/BNodeResolver.hpp's
78100
RemoteGraphProvider wired in as Validator::NeighborhoodSource), so
79101
response blank nodes crossing the round trips this needs are told-bnode-
80102
safe (see the algae3 repo's doc/told-bnodes.md). Fixed associations and
81-
ONE query pattern are both supported — the pattern's FOCUS candidates
103+
ONE query pattern are both supported - the pattern's FOCUS candidates
82104
are fetched with a single additional round trip
83105
(lib/ShExShapeMap.hpp's PatternMatcher abstracts this from the existing
84106
local-graph matching, now LocalPatternMatcher). Demo (from tests/, with
85-
bin/sparql itself serving the evidence data):
107+
bin/sparql itself serving the evidence data over the SPARQL protocol):
86108

87109
../bin/sparql --serve http://127.0.0.1:8099/sparql \
88-
-d Algae3/data/evidence.ttl -d Algae3/data/evidence-groups.ttl
110+
-d Algae3/data/evidence.ttl -d Algae3/data/evidence-groups.ttl &
111+
112+
# a fixed association:
89113
../bin/sparql --shex-endpoint http://127.0.0.1:8099/sparql \
90114
--shex-schema schema.shex \
91115
--shex-map 'evgrp:PeerReviewedCohorts@<GroupShape>'
92-
# or validate every node matching a pattern in one go:
116+
# -> <http://a.example/evgrp/PeerReviewedCohorts>@<.../GroupShape>: conformant
117+
118+
# "@!shape" asserts the node should NOT conform (a nonzero exit code
119+
# counts mismatches, matching --shex-manifest's PASS/FAIL convention):
120+
../bin/sparql --shex-endpoint http://127.0.0.1:8099/sparql \
121+
--shex-schema schema.shex \
122+
--shex-map 'evgrp:PeerReviewedCohorts@!<GroupShape>' # exit 1: it DOES conform
123+
124+
# or validate every node matching a pattern in one round trip - here,
125+
# every group with an ex:member arc, bnode memberships included:
93126
../bin/sparql --shex-endpoint http://127.0.0.1:8099/sparql \
94127
--shex-schema schema.shex --shex-map '{FOCUS ex:member _}@<GroupShape>'
95128

96129
Node-side prefixes in --shex-map borrow the schema's own PREFIX
97130
declarations (there's no separate "data document" to carry its own).
98-
"@!shape" asserts the node should NOT conform (exit code counts
99-
mismatches, matching --shex-manifest's PASS/FAIL convention).
100131

101132
# Algae 3
102133

0 commit comments

Comments
 (0)