Auditable RDF graph contracts and atomic update validation in pure MoonBit
Dependencies
node scripts/moon.mjs update
npm ci --ignore-scripts
npm run build
node cli.mjs validate examples/people-shapes.ttl examples/people-data.ttl# 只检查规则是否属于支持范围
node cli.mjs audit examples/people-shapes.ttl
# 删除共享公司名称:拒绝更新,退出码 1
node cli.mjs update examples/people-shapes.ttl examples/people-data.ttl examples/empty.ttl examples/remove-shared-name.ttl
# 删除旧名称并加入新名称:原子提交,退出码 0
node cli.mjs update examples/people-shapes.ttl examples/people-data.ttl examples/add-shared-name.ttl examples/remove-shared-name.ttl
# 使用未经修改的官方规则
node cli.mjs validate fixtures/dcat-ap-3.0.0.ttl examples/dcat-data.ttl
# 标准 RDF 报告,N-Triples 输出
node cli.mjs validate examples/people-shapes.ttl examples/people-data.ttl --rdflet shapes = @turtle.parse(shapes_text, scope="shapes-") |> Result::unwrap
let data = @turtle.parse(data_text, scope="data-") |> Result::unwrap
let plan = @moonshacl.compile(shapes) |> Result::unwrap
let report = plan.validate(data)
let session = @moonshacl.Session::new(plan, data)
let preview = session.preview(additions, removals)
let update = session.apply(additions, removals)node scripts/moon.mjs run src/demo --target js
node scripts/moon.mjs run src/demo --target wasm-gc
node scripts/moon.mjs run src/demo --target nativenpm testpub(all) struct Report {
conforms : Bool
results : Array[ValidationResult]
checked : Int
reused : Int
}Install
Download zipAuditable RDF graph contracts and atomic update validation in pure MoonBit
Dependencies