Skip to content

Commit 9424c02

Browse files
Merge pull request #39 from casework/add_prefix_customization
Add and confirm prefix customization; start doctests
2 parents 4ad2ddb + d578183 commit 9424c02

File tree

7 files changed

+183
-108
lines changed

7 files changed

+183
-108
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ jobs:
2424

2525
- name: Install Dependencies
2626
run: |
27-
pip -q install poetry pre-commit
27+
pip -q install poetry pre-commit rdflib
2828
poetry install
2929
3030
- name: Pre-commit Checks
3131
run: pre-commit run --all-files
3232

3333
- name: Unit Tests
34-
run: poetry run pytest
34+
run: poetry run pytest --doctest-modules
3535

3636
- name: Run Example
3737
run: poetry run python example.py > case.jsonld
@@ -44,6 +44,11 @@ jobs:
4444
case-version: "case-1.3.0"
4545
extension-filter: "jsonld"
4646

47+
- name: Convert example
48+
run: |
49+
rdfpipe --output-format turtle case.jsonld > case.ttl
50+
test 0 -eq $(grep 'file:' case.ttl | wc -l) || (echo "ERROR:ci.yml:Some graph IRIs do not supply a resolving prefix. Look for the string 'file:///' in the file case.ttl (created by running 'make check') to see these instances." >&2 ; exit 1)
51+
4752
# Always build the package as a sanity check to ensure no issues with the build system
4853
# exist as part of the CI process
4954
- name: Build Package

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ __pycache__/
1919
# Build Artifacts
2020
build/
2121
dist/
22+
case.ttl

Makefile

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,26 @@ case.jsonld: \
8181
_$@
8282
mv _$@ $@
8383

84+
case.ttl: \
85+
case.jsonld
86+
source venv/bin/activate \
87+
&& rdfpipe \
88+
--output-format turtle \
89+
$< \
90+
> _$@
91+
source venv/bin/activate \
92+
&& case_validate \
93+
_$@
94+
@# In instances where graph nodes omit use of a prefix, a 'default' prefix-base is used that incorporates the local directory as a file URL. This is likely to be an undesired behavior, so for the generated example JSON-LD in the top source directory, check that "file:///" doesn't start any of the graph individuals' IRIs.
95+
test \
96+
0 \
97+
-eq \
98+
$$(grep 'file:' _$@ | wc -l) \
99+
|| ( echo "ERROR:Makefile:Some graph IRIs do not supply a resolving prefix. Look for the string 'file:///' in the file _$@ to see these instances." >&2 ; exit 1)
100+
mv _$@ $@
101+
84102
check: \
85-
all
103+
all \
104+
case.ttl
86105
source venv/bin/activate \
87-
&& poetry run pytest
106+
&& poetry run pytest --doctest-modules

0 commit comments

Comments
 (0)