Skip to content

Commit 502679a

Browse files
committed
chore: add scripts to sync shaclc
1 parent 382bb16 commit 502679a

File tree

4 files changed

+259
-9
lines changed

4 files changed

+259
-9
lines changed

scripts/lib/utils.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import rdf from 'rdf-ext'
2+
import { parse } from 'shaclc-parse'
23

34
async function parseJsonld (jsonld, context = {}) {
45
try {
@@ -23,7 +24,16 @@ async function parseTurtle (turtle, prefixes = '') {
2324
}
2425
}
2526

27+
async function parseShaclc (shaclc, prefixes = '') {
28+
try {
29+
return rdf.dataset(parse(`${prefixes}\n${shaclc}`))
30+
} catch (err) {
31+
return null
32+
}
33+
}
34+
2635
export {
2736
parseJsonld,
28-
parseTurtle
37+
parseTurtle,
38+
parseShaclc
2939
}

scripts/package-lock.json

Lines changed: 129 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
"commander": "^13.1.0",
1515
"jsdom": "^26.1.0",
1616
"mkdirp": "^3.0.1",
17-
"rdf-ext": "^2.5.2"
17+
"rdf-ext": "^2.5.2",
18+
"shaclc-parse": "^1.4.3",
19+
"shaclc-write": "^1.5.0"
1820
},
1921
"devDependencies": {
2022
"stricter-standard": "^0.3.1"

0 commit comments

Comments
 (0)