@faubulous/mentor-rdf 0.2.54 → 0.2.56

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/{out → dist}/index.js +7 -7
  2. package/{out → dist}/rdf/index.d.ts +1 -0
  3. package/{out → dist}/rdf/reasoners/owl-reasoner.d.ts +2 -1
  4. package/{out → dist}/rdf/reasoners/rdfs-reasoner.d.ts +3 -1
  5. package/{out → dist}/rdf/reasoners/reasoner.d.ts +30 -18
  6. package/{out → dist}/rdf/reasoners/shacl-reasoner.d.ts +2 -0
  7. package/{out → dist}/rdf/reasoners/skos-reasoner.d.ts +2 -1
  8. package/package.json +5 -5
  9. /package/{out → dist}/index.d.ts +0 -0
  10. /package/{out → dist}/ontologies/dcat.d.ts +0 -0
  11. /package/{out → dist}/ontologies/index.d.ts +0 -0
  12. /package/{out → dist}/ontologies/owl.d.ts +0 -0
  13. /package/{out → dist}/ontologies/rdf.d.ts +0 -0
  14. /package/{out → dist}/ontologies/rdfa.d.ts +0 -0
  15. /package/{out → dist}/ontologies/rdfs.d.ts +0 -0
  16. /package/{out → dist}/ontologies/sh.d.ts +0 -0
  17. /package/{out → dist}/ontologies/skos-xl.d.ts +0 -0
  18. /package/{out → dist}/ontologies/skos.d.ts +0 -0
  19. /package/{out → dist}/ontologies/src.d.ts +0 -0
  20. /package/{out → dist}/ontologies/xsd.d.ts +0 -0
  21. /package/{out → dist}/rdf/class-repository.d.ts +0 -0
  22. /package/{out → dist}/rdf/concept-repository.d.ts +0 -0
  23. /package/{out → dist}/rdf/individual-repository.d.ts +0 -0
  24. /package/{out → dist}/rdf/parsers/rdf-syntax.d.ts +0 -0
  25. /package/{out → dist}/rdf/parsers/sparql-syntax-parser.d.ts +0 -0
  26. /package/{out → dist}/rdf/parsers/syntax-parser.d.ts +0 -0
  27. /package/{out → dist}/rdf/parsers/trig-syntax-parser.d.ts +0 -0
  28. /package/{out → dist}/rdf/parsers/turtle-syntax-parser.d.ts +0 -0
  29. /package/{out → dist}/rdf/property-repository.d.ts +0 -0
  30. /package/{out → dist}/rdf/resource-repository.d.ts +0 -0
  31. /package/{out → dist}/rdf/shape-repository.d.ts +0 -0
  32. /package/{out → dist}/rdf/store.d.ts +0 -0
  33. /package/{out → dist}/rdf/uri.d.ts +0 -0
  34. /package/{out → dist}/rdf/vocabulary-repository.d.ts +0 -0
@@ -1231,7 +1231,7 @@ eval("{\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexp
1231
1231
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1232
1232
 
1233
1233
  "use strict";
1234
- eval("{\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nconst tslib_1 = __webpack_require__(/*! tslib */ \"./node_modules/tslib/tslib.es6.mjs\");\ntslib_1.__exportStar(__webpack_require__(/*! ./class-repository */ \"./src/rdf/class-repository.ts\"), exports);\ntslib_1.__exportStar(__webpack_require__(/*! ./individual-repository */ \"./src/rdf/individual-repository.ts\"), exports);\ntslib_1.__exportStar(__webpack_require__(/*! ./parsers/rdf-syntax */ \"./src/rdf/parsers/rdf-syntax.ts\"), exports);\ntslib_1.__exportStar(__webpack_require__(/*! ./parsers/turtle-syntax-parser */ \"./src/rdf/parsers/turtle-syntax-parser.ts\"), exports);\ntslib_1.__exportStar(__webpack_require__(/*! ./parsers/trig-syntax-parser */ \"./src/rdf/parsers/trig-syntax-parser.ts\"), exports);\ntslib_1.__exportStar(__webpack_require__(/*! ./parsers/sparql-syntax-parser */ \"./src/rdf/parsers/sparql-syntax-parser.ts\"), exports);\ntslib_1.__exportStar(__webpack_require__(/*! ./parsers/syntax-parser */ \"./src/rdf/parsers/syntax-parser.ts\"), exports);\ntslib_1.__exportStar(__webpack_require__(/*! ./property-repository */ \"./src/rdf/property-repository.ts\"), exports);\ntslib_1.__exportStar(__webpack_require__(/*! ./reasoners/owl-reasoner */ \"./src/rdf/reasoners/owl-reasoner.ts\"), exports);\ntslib_1.__exportStar(__webpack_require__(/*! ./reasoners/rdfs-reasoner */ \"./src/rdf/reasoners/rdfs-reasoner.ts\"), exports);\ntslib_1.__exportStar(__webpack_require__(/*! ./resource-repository */ \"./src/rdf/resource-repository.ts\"), exports);\ntslib_1.__exportStar(__webpack_require__(/*! ./store */ \"./src/rdf/store.ts\"), exports);\ntslib_1.__exportStar(__webpack_require__(/*! ./uri */ \"./src/rdf/uri.ts\"), exports);\ntslib_1.__exportStar(__webpack_require__(/*! ./vocabulary-repository */ \"./src/rdf/vocabulary-repository.ts\"), exports);\n\n\n//# sourceURL=webpack://@faubulous/mentor-rdf/./src/rdf/index.ts?\n}");
1234
+ eval("{\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.DefaultInferenceGraphHandler = void 0;\nconst tslib_1 = __webpack_require__(/*! tslib */ \"./node_modules/tslib/tslib.es6.mjs\");\ntslib_1.__exportStar(__webpack_require__(/*! ./class-repository */ \"./src/rdf/class-repository.ts\"), exports);\ntslib_1.__exportStar(__webpack_require__(/*! ./individual-repository */ \"./src/rdf/individual-repository.ts\"), exports);\ntslib_1.__exportStar(__webpack_require__(/*! ./parsers/rdf-syntax */ \"./src/rdf/parsers/rdf-syntax.ts\"), exports);\ntslib_1.__exportStar(__webpack_require__(/*! ./parsers/turtle-syntax-parser */ \"./src/rdf/parsers/turtle-syntax-parser.ts\"), exports);\ntslib_1.__exportStar(__webpack_require__(/*! ./parsers/trig-syntax-parser */ \"./src/rdf/parsers/trig-syntax-parser.ts\"), exports);\ntslib_1.__exportStar(__webpack_require__(/*! ./parsers/sparql-syntax-parser */ \"./src/rdf/parsers/sparql-syntax-parser.ts\"), exports);\ntslib_1.__exportStar(__webpack_require__(/*! ./parsers/syntax-parser */ \"./src/rdf/parsers/syntax-parser.ts\"), exports);\ntslib_1.__exportStar(__webpack_require__(/*! ./property-repository */ \"./src/rdf/property-repository.ts\"), exports);\ntslib_1.__exportStar(__webpack_require__(/*! ./reasoners/owl-reasoner */ \"./src/rdf/reasoners/owl-reasoner.ts\"), exports);\ntslib_1.__exportStar(__webpack_require__(/*! ./reasoners/rdfs-reasoner */ \"./src/rdf/reasoners/rdfs-reasoner.ts\"), exports);\nvar reasoner_1 = __webpack_require__(/*! ./reasoners/reasoner */ \"./src/rdf/reasoners/reasoner.ts\");\nObject.defineProperty(exports, \"DefaultInferenceGraphHandler\", ({ enumerable: true, get: function () { return reasoner_1.DefaultInferenceGraphHandler; } }));\ntslib_1.__exportStar(__webpack_require__(/*! ./resource-repository */ \"./src/rdf/resource-repository.ts\"), exports);\ntslib_1.__exportStar(__webpack_require__(/*! ./store */ \"./src/rdf/store.ts\"), exports);\ntslib_1.__exportStar(__webpack_require__(/*! ./uri */ \"./src/rdf/uri.ts\"), exports);\ntslib_1.__exportStar(__webpack_require__(/*! ./vocabulary-repository */ \"./src/rdf/vocabulary-repository.ts\"), exports);\n\n\n//# sourceURL=webpack://@faubulous/mentor-rdf/./src/rdf/index.ts?\n}");
1235
1235
 
1236
1236
  /***/ }),
1237
1237
 
@@ -1319,7 +1319,7 @@ eval("{\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexp
1319
1319
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1320
1320
 
1321
1321
  "use strict";
1322
- eval("{\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.OwlReasoner = void 0;\nconst tslib_1 = __webpack_require__(/*! tslib */ \"./node_modules/tslib/tslib.es6.mjs\");\nconst n3 = tslib_1.__importStar(__webpack_require__(/*! n3 */ \"./node_modules/n3/src/index.js\"));\nconst ontologies_1 = __webpack_require__(/*! ../../ontologies */ \"./src/ontologies/index.ts\");\nconst shacl_reasoner_1 = __webpack_require__(/*! ./shacl-reasoner */ \"./src/rdf/reasoners/shacl-reasoner.ts\");\nconst { quad } = n3.DataFactory;\n/**\n * A simple OWL reasoner that expands the graph with inferred triples.\n */\nclass OwlReasoner extends shacl_reasoner_1.ShaclReasoner {\n constructor() {\n super();\n this.restrictions = {};\n }\n afterInference() {\n super.afterInference();\n for (let r of Object.values(this.restrictions)) {\n const p = r.onProperty;\n if (!p)\n continue;\n if (r.onDataRange) {\n this.store.add(quad(p, ontologies_1.rdf.type, ontologies_1.owl.DatatypeProperty, this.targetGraph));\n this.store.add(quad(p, ontologies_1.rdfs.range, r.onDataRange, this.targetGraph));\n }\n else if (r.onClass) {\n this.store.add(quad(p, ontologies_1.rdf.type, ontologies_1.owl.ObjectProperty, this.targetGraph));\n this.store.add(quad(p, ontologies_1.rdfs.range, r.onClass, this.targetGraph));\n }\n else if (r.allValuesFrom) {\n this.store.add(quad(p, ontologies_1.rdf.type, ontologies_1.owl.ObjectProperty, this.targetGraph));\n }\n else if (r.someValuesFrom) {\n this.store.add(quad(p, ontologies_1.rdf.type, ontologies_1.owl.ObjectProperty, this.targetGraph));\n }\n }\n this.restrictions = {};\n }\n resetState() {\n super.resetState();\n this.restrictions = {};\n }\n inferClassAxioms(q) {\n super.inferClassAxioms(q);\n let s = q.subject;\n let p = q.predicate;\n let o = q.object.termType != \"Literal\" ? q.object : undefined;\n if (!o) {\n return;\n }\n // See: https://www.w3.org/TR/owl2-profiles/#Reasoning_in_OWL_2_RL_and_RDF_Graphs_using_Rules\n switch (p.value) {\n case ontologies_1.rdf.type.id: {\n if (o.value == ontologies_1.owl.Restriction.id) {\n this.restrictions[s.value] = {};\n }\n return;\n }\n case ontologies_1.owl.equivalentClass.id: {\n this.assertClass(s);\n if (o && !this.isW3CNode(o)) {\n this.assertClass(o);\n }\n // The opposite is also true.\n if (o.termType == \"NamedNode\") {\n this.store.add(quad(o, ontologies_1.owl.equivalentClass, s, this.targetGraph));\n }\n return;\n }\n case ontologies_1.owl.complementOf.id:\n case ontologies_1.owl.disjointWith.id: {\n this.assertClass(s);\n if (o && !this.isW3CNode(o)) {\n this.assertClass(o);\n }\n return;\n }\n case ontologies_1.owl.intersectionOf.id: {\n let equivalentSubjects = [...this.store.match(null, ontologies_1.owl.equivalentClass, s)]\n .map(q => q.subject)\n .filter(q => q.termType == \"NamedNode\");\n // Rule #scm-int\n let classes = this.getListItems(o.value);\n if (!Array.isArray(classes)) {\n this.errors.push({ quad: q, message: `Expected an array of classes for ${o.value}` });\n return;\n }\n for (let c of classes) {\n if (c.termType != \"NamedNode\") {\n continue;\n }\n this.store.add(quad(s, ontologies_1.rdfs.subClassOf, c, this.targetGraph));\n for (let es of equivalentSubjects) {\n this.store.add(quad(es, ontologies_1.rdfs.subClassOf, c, this.targetGraph));\n }\n }\n return;\n }\n case ontologies_1.owl.unionOf.id: {\n let equivalentSubjects = [...this.store.match(null, ontologies_1.owl.equivalentClass, s)]\n .map(q => q.subject)\n .filter(q => q.termType == \"NamedNode\");\n // Rule #scm-uni\n let classes = this.getListItems(o.value);\n if (!Array.isArray(classes)) {\n this.errors.push({ quad: q, message: `Expected an array of classes for ${o.value}` });\n return;\n }\n for (let c of classes) {\n if (c.termType != \"NamedNode\") {\n continue;\n }\n this.store.add(quad(c, ontologies_1.rdfs.subClassOf, s, this.targetGraph));\n for (let es of equivalentSubjects) {\n this.store.add(quad(c, ontologies_1.rdfs.subClassOf, es, this.targetGraph));\n }\n }\n return;\n }\n case ontologies_1.owl.onClass.id: {\n if (o.termType == \"NamedNode\") {\n this.assertClass(o);\n }\n return;\n }\n case ontologies_1.owl.onDataRange.id: {\n if (o.termType == \"NamedNode\") {\n this.store.add(quad(o, ontologies_1.rdf.type, ontologies_1.rdfs.Datatype, this.targetGraph));\n }\n return;\n }\n // Note:\n // e.g. Gist also uses these on xsd:string, so inferring that this is a \n // class is technically true, however, it would lead to undesirable results.\n //\n // case owl.allValuesFrom.id: {\n // if (o.termType == \"NamedNode\") {\n // this.store.add(quad(o, rdf.type, rdfs.Class, this.targetGraph));\n // }\n //\n // return;\n // }\n // case owl.someValuesFrom.id: {\n // if (o.termType == \"NamedNode\") {\n // this.store.add(quad(o, rdf.type, rdfs.Class, this.targetGraph));\n // }\n //\n // break;\n // }\n }\n }\n inferPropertyAxioms(q) {\n super.inferPropertyAxioms(q);\n let s = q.subject;\n let p = q.predicate;\n let o = q.object.termType != \"Literal\" ? q.object : undefined;\n if (!o) {\n return;\n }\n switch (p.value) {\n case ontologies_1.owl.onProperty.id: {\n this.assertProperty(o);\n if (this.restrictions[s.value] && o.termType == \"NamedNode\") {\n this.restrictions[s.value].onProperty = o;\n }\n return;\n }\n case ontologies_1.owl.onClass.id: {\n if (this.restrictions[s.value] && o.termType == \"NamedNode\") {\n this.restrictions[s.value].onClass = o;\n }\n return;\n }\n case ontologies_1.owl.onDataRange.id: {\n if (this.restrictions[s.value] && o.termType == \"NamedNode\") {\n this.restrictions[s.value].onDataRange = o;\n }\n return;\n }\n case ontologies_1.owl.allValuesFrom.id: {\n if (this.restrictions[s.value]) {\n this.restrictions[s.value].allValuesFrom = o;\n }\n return;\n }\n case ontologies_1.owl.someValuesFrom.id: {\n if (this.restrictions[s.value]) {\n this.restrictions[s.value].someValuesFrom = o;\n }\n return;\n }\n case ontologies_1.owl.equivalentProperty.id: {\n this.assertProperty(s);\n this.assertProperty(o);\n // The opposite is also true.\n if (o.termType == \"NamedNode\") {\n this.store.add(quad(o, ontologies_1.owl.equivalentProperty, s, this.targetGraph));\n }\n return;\n }\n case ontologies_1.rdf.type.id: {\n switch (o.value) {\n case ontologies_1.owl.AnnotationProperty.id:\n case ontologies_1.owl.AsymmetricProperty.id:\n case ontologies_1.owl.DatatypeProperty.id:\n case ontologies_1.owl.DeprecatedProperty.id:\n case ontologies_1.owl.FunctionalProperty.id:\n case ontologies_1.owl.InverseFunctionalProperty.id:\n case ontologies_1.owl.IrreflexiveProperty.id:\n case ontologies_1.owl.ObjectProperty.id:\n case ontologies_1.owl.OntologyProperty.id:\n case ontologies_1.owl.ReflexiveProperty.id:\n case ontologies_1.owl.SymmetricProperty.id:\n case ontologies_1.owl.TransitiveProperty.id: {\n this.assertProperty(s);\n }\n }\n return;\n }\n }\n }\n}\nexports.OwlReasoner = OwlReasoner;\n\n\n//# sourceURL=webpack://@faubulous/mentor-rdf/./src/rdf/reasoners/owl-reasoner.ts?\n}");
1322
+ eval("{\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.OwlReasoner = void 0;\nconst tslib_1 = __webpack_require__(/*! tslib */ \"./node_modules/tslib/tslib.es6.mjs\");\nconst n3 = tslib_1.__importStar(__webpack_require__(/*! n3 */ \"./node_modules/n3/src/index.js\"));\nconst ontologies_1 = __webpack_require__(/*! ../../ontologies */ \"./src/ontologies/index.ts\");\nconst shacl_reasoner_1 = __webpack_require__(/*! ./shacl-reasoner */ \"./src/rdf/reasoners/shacl-reasoner.ts\");\nconst reasoner_1 = __webpack_require__(/*! ./reasoner */ \"./src/rdf/reasoners/reasoner.ts\");\nconst { quad } = n3.DataFactory;\n/**\n * A simple OWL reasoner that expands the graph with inferred triples.\n */\nclass OwlReasoner extends shacl_reasoner_1.ShaclReasoner {\n constructor(targetUriGenerator = new reasoner_1.DefaultInferenceGraphHandler()) {\n super(targetUriGenerator);\n this.restrictions = {};\n }\n afterInference() {\n super.afterInference();\n for (let r of Object.values(this.restrictions)) {\n const p = r.onProperty;\n if (!p)\n continue;\n if (r.onDataRange) {\n this.store.add(quad(p, ontologies_1.rdf.type, ontologies_1.owl.DatatypeProperty, this.targetGraph));\n this.store.add(quad(p, ontologies_1.rdfs.range, r.onDataRange, this.targetGraph));\n }\n else if (r.onClass) {\n this.store.add(quad(p, ontologies_1.rdf.type, ontologies_1.owl.ObjectProperty, this.targetGraph));\n this.store.add(quad(p, ontologies_1.rdfs.range, r.onClass, this.targetGraph));\n }\n else if (r.allValuesFrom) {\n this.store.add(quad(p, ontologies_1.rdf.type, ontologies_1.owl.ObjectProperty, this.targetGraph));\n }\n else if (r.someValuesFrom) {\n this.store.add(quad(p, ontologies_1.rdf.type, ontologies_1.owl.ObjectProperty, this.targetGraph));\n }\n }\n this.restrictions = {};\n }\n resetState() {\n super.resetState();\n this.restrictions = {};\n }\n inferClassAxioms(q) {\n super.inferClassAxioms(q);\n let s = q.subject;\n let p = q.predicate;\n let o = q.object.termType != \"Literal\" ? q.object : undefined;\n if (!o) {\n return;\n }\n // See: https://www.w3.org/TR/owl2-profiles/#Reasoning_in_OWL_2_RL_and_RDF_Graphs_using_Rules\n switch (p.value) {\n case ontologies_1.rdf.type.id: {\n if (o.value == ontologies_1.owl.Restriction.id) {\n this.restrictions[s.value] = {};\n }\n return;\n }\n case ontologies_1.owl.equivalentClass.id: {\n this.assertClass(s);\n if (o && !this.isW3CNode(o)) {\n this.assertClass(o);\n }\n // The opposite is also true.\n if (o.termType == \"NamedNode\") {\n this.store.add(quad(o, ontologies_1.owl.equivalentClass, s, this.targetGraph));\n }\n return;\n }\n case ontologies_1.owl.complementOf.id:\n case ontologies_1.owl.disjointWith.id: {\n this.assertClass(s);\n if (o && !this.isW3CNode(o)) {\n this.assertClass(o);\n }\n return;\n }\n case ontologies_1.owl.intersectionOf.id: {\n let equivalentSubjects = [...this.store.match(null, ontologies_1.owl.equivalentClass, s)]\n .map(q => q.subject)\n .filter(q => q.termType == \"NamedNode\");\n // Rule #scm-int\n let classes = this.getListItems(o.value);\n if (!Array.isArray(classes)) {\n this.errors.push({ quad: q, message: `Expected an array of classes for ${o.value}` });\n return;\n }\n for (let c of classes) {\n if (c.termType != \"NamedNode\") {\n continue;\n }\n this.store.add(quad(s, ontologies_1.rdfs.subClassOf, c, this.targetGraph));\n for (let es of equivalentSubjects) {\n this.store.add(quad(es, ontologies_1.rdfs.subClassOf, c, this.targetGraph));\n }\n }\n return;\n }\n case ontologies_1.owl.unionOf.id: {\n let equivalentSubjects = [...this.store.match(null, ontologies_1.owl.equivalentClass, s)]\n .map(q => q.subject)\n .filter(q => q.termType == \"NamedNode\");\n // Rule #scm-uni\n let classes = this.getListItems(o.value);\n if (!Array.isArray(classes)) {\n this.errors.push({ quad: q, message: `Expected an array of classes for ${o.value}` });\n return;\n }\n for (let c of classes) {\n if (c.termType != \"NamedNode\") {\n continue;\n }\n this.store.add(quad(c, ontologies_1.rdfs.subClassOf, s, this.targetGraph));\n for (let es of equivalentSubjects) {\n this.store.add(quad(c, ontologies_1.rdfs.subClassOf, es, this.targetGraph));\n }\n }\n return;\n }\n case ontologies_1.owl.onClass.id: {\n if (o.termType == \"NamedNode\") {\n this.assertClass(o);\n }\n return;\n }\n case ontologies_1.owl.onDataRange.id: {\n if (o.termType == \"NamedNode\") {\n this.store.add(quad(o, ontologies_1.rdf.type, ontologies_1.rdfs.Datatype, this.targetGraph));\n }\n return;\n }\n // Note:\n // e.g. Gist also uses these on xsd:string, so inferring that this is a \n // class is technically true, however, it would lead to undesirable results.\n //\n // case owl.allValuesFrom.id: {\n // if (o.termType == \"NamedNode\") {\n // this.store.add(quad(o, rdf.type, rdfs.Class, this.targetGraph));\n // }\n //\n // return;\n // }\n // case owl.someValuesFrom.id: {\n // if (o.termType == \"NamedNode\") {\n // this.store.add(quad(o, rdf.type, rdfs.Class, this.targetGraph));\n // }\n //\n // break;\n // }\n }\n }\n inferPropertyAxioms(q) {\n super.inferPropertyAxioms(q);\n let s = q.subject;\n let p = q.predicate;\n let o = q.object.termType != \"Literal\" ? q.object : undefined;\n if (!o) {\n return;\n }\n switch (p.value) {\n case ontologies_1.owl.onProperty.id: {\n this.assertProperty(o);\n if (this.restrictions[s.value] && o.termType == \"NamedNode\") {\n this.restrictions[s.value].onProperty = o;\n }\n return;\n }\n case ontologies_1.owl.onClass.id: {\n if (this.restrictions[s.value] && o.termType == \"NamedNode\") {\n this.restrictions[s.value].onClass = o;\n }\n return;\n }\n case ontologies_1.owl.onDataRange.id: {\n if (this.restrictions[s.value] && o.termType == \"NamedNode\") {\n this.restrictions[s.value].onDataRange = o;\n }\n return;\n }\n case ontologies_1.owl.allValuesFrom.id: {\n if (this.restrictions[s.value]) {\n this.restrictions[s.value].allValuesFrom = o;\n }\n return;\n }\n case ontologies_1.owl.someValuesFrom.id: {\n if (this.restrictions[s.value]) {\n this.restrictions[s.value].someValuesFrom = o;\n }\n return;\n }\n case ontologies_1.owl.equivalentProperty.id: {\n this.assertProperty(s);\n this.assertProperty(o);\n // The opposite is also true.\n if (o.termType == \"NamedNode\") {\n this.store.add(quad(o, ontologies_1.owl.equivalentProperty, s, this.targetGraph));\n }\n return;\n }\n case ontologies_1.rdf.type.id: {\n switch (o.value) {\n case ontologies_1.owl.AnnotationProperty.id:\n case ontologies_1.owl.AsymmetricProperty.id:\n case ontologies_1.owl.DatatypeProperty.id:\n case ontologies_1.owl.DeprecatedProperty.id:\n case ontologies_1.owl.FunctionalProperty.id:\n case ontologies_1.owl.InverseFunctionalProperty.id:\n case ontologies_1.owl.IrreflexiveProperty.id:\n case ontologies_1.owl.ObjectProperty.id:\n case ontologies_1.owl.OntologyProperty.id:\n case ontologies_1.owl.ReflexiveProperty.id:\n case ontologies_1.owl.SymmetricProperty.id:\n case ontologies_1.owl.TransitiveProperty.id: {\n this.assertProperty(s);\n }\n }\n return;\n }\n }\n }\n}\nexports.OwlReasoner = OwlReasoner;\n\n\n//# sourceURL=webpack://@faubulous/mentor-rdf/./src/rdf/reasoners/owl-reasoner.ts?\n}");
1323
1323
 
1324
1324
  /***/ }),
1325
1325
 
@@ -1330,7 +1330,7 @@ eval("{\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexp
1330
1330
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1331
1331
 
1332
1332
  "use strict";
1333
- eval("{\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.RdfsReasoner = void 0;\nconst tslib_1 = __webpack_require__(/*! tslib */ \"./node_modules/tslib/tslib.es6.mjs\");\nconst n3 = tslib_1.__importStar(__webpack_require__(/*! n3 */ \"./node_modules/n3/src/index.js\"));\nconst ontologies_1 = __webpack_require__(/*! ../../ontologies */ \"./src/ontologies/index.ts\");\nconst skos_reasoner_1 = __webpack_require__(/*! ./skos-reasoner */ \"./src/rdf/reasoners/skos-reasoner.ts\");\nconst { quad } = n3.DataFactory;\n/**\n * A simple RDFS reasoner that expands the graph with inferred triples.\n */\nclass RdfsReasoner extends skos_reasoner_1.SkosReasoner {\n constructor() {\n super(...arguments);\n this.ontologies = new Set();\n this.classes = new Set();\n this.properties = new Set();\n this.invididuals = new Set();\n }\n isIgnoredNode(term) {\n switch (term.value) {\n case ontologies_1.skos.Concept.id:\n case ontologies_1.skos.ConceptScheme.id:\n case ontologies_1.skos.Collection.id:\n case ontologies_1.skos.OrderedCollection.id:\n case ontologies_1.sh.Shape.id:\n case ontologies_1.sh.NodeShape.id:\n case ontologies_1.sh.PropertyShape.id:\n return true;\n default:\n return false;\n }\n }\n isClass(id) {\n return super.isClass(id) ||\n this.classes.has(id) ||\n this.properties.has(id) ||\n this.ontologies.has(id);\n }\n afterInference() {\n super.afterInference();\n // After all axioms have been inferred, add the inferred individuals to the graph.\n const individuals = [...this.invididuals].filter(x => !this.isClass(x.value));\n for (let individual of individuals) {\n this.store.add(quad(individual, ontologies_1.rdf.type, ontologies_1.owl.NamedIndividual, this.targetGraph));\n }\n }\n resetState() {\n this.ontologies.clear();\n this.classes.clear();\n this.properties.clear();\n this.invididuals.clear();\n }\n applyInference(quad) {\n super.applyInference(quad);\n // Treat all named nodes with rdf:type definitions as potential individuals.\n if (quad.subject.termType == \"NamedNode\" && quad.predicate.equals(ontologies_1.rdf.type)) {\n // Only consider individuals that are not of a type that is ignored such as skos:Concept.\n if (!this.isIgnoredNode(quad.object)) {\n this.invididuals.add(quad.subject);\n }\n if (quad.object.value == ontologies_1.owl.Ontology.id) {\n this.ontologies.add(quad.subject.value);\n }\n }\n this.inferClassAxioms(quad);\n this.inferPropertyAxioms(quad);\n }\n assertClass(subject) {\n this.store.add(quad(subject, ontologies_1.rdf.type, ontologies_1.rdfs.Class, this.targetGraph));\n this.classes.add(subject.value);\n }\n inferClassAxioms(q) {\n let s = q.subject;\n let p = q.predicate;\n let o = q.object.termType != \"Literal\" ? q.object : undefined;\n if (!o) {\n return;\n }\n switch (p.value) {\n case ontologies_1.rdf.type.id: {\n if (o.equals(ontologies_1.rdfs.Class)) {\n // No need to infer the class type, as it is already asserted.\n this.classes.add(s.value);\n }\n else if (o.equals(ontologies_1.owl.Class)) {\n this.assertClass(s);\n }\n else if (!this.isW3CNode(o)) {\n this.assertClass(o);\n }\n return;\n }\n case ontologies_1.rdfs.subClassOf.id: {\n this.assertClass(s);\n if (!this.isW3CNode(o)) {\n this.assertClass(o);\n }\n else if (o.equals(ontologies_1.rdfs.Resource)) {\n this.store.add(quad(ontologies_1.rdfs.Resource, ontologies_1.rdf.type, ontologies_1.rdfs.Class, this.targetGraph));\n }\n else if (o.equals(ontologies_1.rdfs.Class)) {\n this.store.add(quad(ontologies_1.rdfs.Class, ontologies_1.rdf.type, ontologies_1.rdfs.Class, this.targetGraph));\n this.store.add(quad(ontologies_1.rdfs.Class, ontologies_1.rdfs.subClassOf, ontologies_1.rdfs.Resource, this.targetGraph));\n }\n else if (o.equals(ontologies_1.rdfs.Datatype)) {\n this.store.add(quad(ontologies_1.rdfs.Datatype, ontologies_1.rdf.type, ontologies_1.rdfs.Class, this.targetGraph));\n this.store.add(quad(ontologies_1.rdfs.Datatype, ontologies_1.rdfs.subClassOf, ontologies_1.rdfs.Class, this.targetGraph));\n }\n else if (o.equals(ontologies_1.owl.Class)) {\n this.store.add(quad(ontologies_1.owl.Class, ontologies_1.rdf.type, ontologies_1.rdfs.Class, this.targetGraph));\n this.store.add(quad(ontologies_1.owl.Class, ontologies_1.rdfs.subClassOf, ontologies_1.rdfs.Class, this.targetGraph));\n }\n return;\n }\n case ontologies_1.rdfs.range.id:\n case ontologies_1.rdfs.domain.id: {\n if (!this.isW3CNode(o)) {\n this.assertClass(o);\n }\n return;\n }\n }\n }\n assertProperty(subject) {\n this.store.add(quad(subject, ontologies_1.rdf.type, ontologies_1.rdf.Property, this.targetGraph));\n this.properties.add(subject.value);\n }\n inferPropertyAxioms(quad) {\n let s = quad.subject;\n let p = quad.predicate;\n let o = quad.object.termType != \"Literal\" ? quad.object : undefined;\n if (!o) {\n return;\n }\n switch (p.value) {\n case ontologies_1.rdf.type.id: {\n if (o.equals(ontologies_1.rdf.Property)) {\n // No need to infer the property type, as it is already asserted.\n this.properties.add(s.value);\n }\n return;\n }\n case ontologies_1.rdfs.range.id:\n case ontologies_1.rdfs.domain.id: {\n this.assertProperty(s);\n return;\n }\n }\n }\n}\nexports.RdfsReasoner = RdfsReasoner;\n\n\n//# sourceURL=webpack://@faubulous/mentor-rdf/./src/rdf/reasoners/rdfs-reasoner.ts?\n}");
1333
+ eval("{\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.RdfsReasoner = void 0;\nconst tslib_1 = __webpack_require__(/*! tslib */ \"./node_modules/tslib/tslib.es6.mjs\");\nconst n3 = tslib_1.__importStar(__webpack_require__(/*! n3 */ \"./node_modules/n3/src/index.js\"));\nconst ontologies_1 = __webpack_require__(/*! ../../ontologies */ \"./src/ontologies/index.ts\");\nconst skos_reasoner_1 = __webpack_require__(/*! ./skos-reasoner */ \"./src/rdf/reasoners/skos-reasoner.ts\");\nconst reasoner_1 = __webpack_require__(/*! ./reasoner */ \"./src/rdf/reasoners/reasoner.ts\");\nconst { quad } = n3.DataFactory;\n/**\n * A simple RDFS reasoner that expands the graph with inferred triples.\n */\nclass RdfsReasoner extends skos_reasoner_1.SkosReasoner {\n constructor(targetUriGenerator = new reasoner_1.DefaultInferenceGraphHandler()) {\n super(targetUriGenerator);\n this.ontologies = new Set();\n this.classes = new Set();\n this.properties = new Set();\n this.individuals = new Set();\n }\n isIgnoredNode(term) {\n switch (term.value) {\n case ontologies_1.skos.Concept.id:\n case ontologies_1.skos.ConceptScheme.id:\n case ontologies_1.skos.Collection.id:\n case ontologies_1.skos.OrderedCollection.id:\n case ontologies_1.sh.Shape.id:\n case ontologies_1.sh.NodeShape.id:\n case ontologies_1.sh.PropertyShape.id:\n return true;\n default:\n return false;\n }\n }\n isClass(id) {\n return super.isClass(id) ||\n this.classes.has(id) ||\n this.properties.has(id) ||\n this.ontologies.has(id);\n }\n afterInference() {\n super.afterInference();\n // After all axioms have been inferred, add the inferred individuals to the graph.\n const individuals = [...this.individuals].filter(x => !this.isClass(x.value));\n for (let individual of individuals) {\n this.store.add(quad(individual, ontologies_1.rdf.type, ontologies_1.owl.NamedIndividual, this.targetGraph));\n }\n }\n resetState() {\n this.ontologies.clear();\n this.classes.clear();\n this.properties.clear();\n this.individuals.clear();\n }\n applyInference(quad) {\n super.applyInference(quad);\n // Treat all named nodes with rdf:type definitions as potential individuals.\n if (quad.subject.termType == \"NamedNode\" && quad.predicate.equals(ontologies_1.rdf.type)) {\n // Only consider individuals that are not of a type that is ignored such as skos:Concept.\n if (!this.isIgnoredNode(quad.object)) {\n this.individuals.add(quad.subject);\n }\n if (quad.object.value == ontologies_1.owl.Ontology.id) {\n this.ontologies.add(quad.subject.value);\n }\n }\n this.inferClassAxioms(quad);\n this.inferPropertyAxioms(quad);\n }\n assertClass(subject) {\n this.store.add(quad(subject, ontologies_1.rdf.type, ontologies_1.rdfs.Class, this.targetGraph));\n this.classes.add(subject.value);\n }\n inferClassAxioms(q) {\n let s = q.subject;\n let p = q.predicate;\n let o = q.object.termType != \"Literal\" ? q.object : undefined;\n if (!o) {\n return;\n }\n switch (p.value) {\n case ontologies_1.rdf.type.id: {\n if (o.equals(ontologies_1.rdfs.Class)) {\n // No need to infer the class type, as it is already asserted.\n this.classes.add(s.value);\n }\n else if (o.equals(ontologies_1.owl.Class)) {\n this.assertClass(s);\n }\n else if (!this.isW3CNode(o)) {\n this.assertClass(o);\n }\n return;\n }\n case ontologies_1.rdfs.subClassOf.id: {\n this.assertClass(s);\n if (!this.isW3CNode(o)) {\n this.assertClass(o);\n }\n else if (o.equals(ontologies_1.rdfs.Resource)) {\n this.store.add(quad(ontologies_1.rdfs.Resource, ontologies_1.rdf.type, ontologies_1.rdfs.Class, this.targetGraph));\n }\n else if (o.equals(ontologies_1.rdfs.Class)) {\n this.store.add(quad(ontologies_1.rdfs.Class, ontologies_1.rdf.type, ontologies_1.rdfs.Class, this.targetGraph));\n this.store.add(quad(ontologies_1.rdfs.Class, ontologies_1.rdfs.subClassOf, ontologies_1.rdfs.Resource, this.targetGraph));\n }\n else if (o.equals(ontologies_1.rdfs.Datatype)) {\n this.store.add(quad(ontologies_1.rdfs.Datatype, ontologies_1.rdf.type, ontologies_1.rdfs.Class, this.targetGraph));\n this.store.add(quad(ontologies_1.rdfs.Datatype, ontologies_1.rdfs.subClassOf, ontologies_1.rdfs.Class, this.targetGraph));\n }\n else if (o.equals(ontologies_1.owl.Class)) {\n this.store.add(quad(ontologies_1.owl.Class, ontologies_1.rdf.type, ontologies_1.rdfs.Class, this.targetGraph));\n this.store.add(quad(ontologies_1.owl.Class, ontologies_1.rdfs.subClassOf, ontologies_1.rdfs.Class, this.targetGraph));\n }\n return;\n }\n case ontologies_1.rdfs.range.id:\n case ontologies_1.rdfs.domain.id: {\n if (!this.isW3CNode(o)) {\n this.assertClass(o);\n }\n return;\n }\n }\n }\n assertProperty(subject) {\n this.store.add(quad(subject, ontologies_1.rdf.type, ontologies_1.rdf.Property, this.targetGraph));\n this.properties.add(subject.value);\n }\n inferPropertyAxioms(quad) {\n let s = quad.subject;\n let p = quad.predicate;\n let o = quad.object.termType != \"Literal\" ? quad.object : undefined;\n if (!o) {\n return;\n }\n switch (p.value) {\n case ontologies_1.rdf.type.id: {\n if (o.equals(ontologies_1.rdf.Property)) {\n // No need to infer the property type, as it is already asserted.\n this.properties.add(s.value);\n }\n return;\n }\n case ontologies_1.rdfs.range.id:\n case ontologies_1.rdfs.domain.id: {\n this.assertProperty(s);\n return;\n }\n }\n }\n}\nexports.RdfsReasoner = RdfsReasoner;\n\n\n//# sourceURL=webpack://@faubulous/mentor-rdf/./src/rdf/reasoners/rdfs-reasoner.ts?\n}");
1334
1334
 
1335
1335
  /***/ }),
1336
1336
 
@@ -1341,7 +1341,7 @@ eval("{\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexp
1341
1341
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1342
1342
 
1343
1343
  "use strict";
1344
- eval("{\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.ReasonerBase = void 0;\nconst tslib_1 = __webpack_require__(/*! tslib */ \"./node_modules/tslib/tslib.es6.mjs\");\nconst n3 = tslib_1.__importStar(__webpack_require__(/*! n3 */ \"./node_modules/n3/src/index.js\"));\nconst rdf_stores_1 = __webpack_require__(/*! rdf-stores */ \"./node_modules/rdf-stores/index.js\");\nconst ontologies_1 = __webpack_require__(/*! ../../ontologies */ \"./src/ontologies/index.ts\");\nconst { namedNode, blankNode } = n3.DataFactory;\n/**\n * A base class for reasoners that expand graphs with inferred triples.\n */\nclass ReasonerBase {\n constructor() {\n /**\n * IRI scheme to be prepended to inference graph URIs.\n */\n this.inferenceScheme = \"inference:\";\n this.store = rdf_stores_1.RdfStore.createDefault().asDataset();\n this.errors = [];\n }\n /**\n * Get the IRI of the graph containing the inferenced triples.\n * @param uri IRI of the graph to be reasoned upon.\n * @returns The IRI of the graph containing the inferenced triples.\n */\n getInferenceGraphUri(uri) {\n const u = typeof uri === \"string\" ? uri : uri.value;\n return this.inferenceScheme + u;\n }\n isInferenceGraphUri(uri) {\n const u = typeof uri === \"string\" ? uri : uri.value;\n return u.startsWith(this.inferenceScheme);\n }\n getGraphNode(graph) {\n if (typeof graph === \"string\") {\n return namedNode(graph);\n }\n else {\n return graph;\n }\n }\n isW3CNode(term) {\n return term.value.startsWith(\"http://www.w3.org\");\n }\n /**\n * Get the URIs of ordered list members in the store.\n * @param graphUris Optional graph URI or array of graph URIs to query.\n * @param listUri URI of the list to get the items from.\n * @returns An array of URIs of the items in the list.\n */\n getListItems(listUri) {\n // To do: Fix #10\n const list = listUri.includes(':') ? namedNode(listUri) : blankNode(listUri);\n return this._getListItems(list);\n }\n _getListItems(subject) {\n if (!this.sourceGraph) {\n return [];\n }\n let first = Array.from(this.match(this.sourceGraph, subject, ontologies_1.rdf.first, null));\n if (!first.length) {\n return [];\n }\n const rest = Array.from(this.match(this.sourceGraph, subject, ontologies_1.rdf.rest, null));\n const firstItem = first[0].object;\n const restList = rest[0]?.object;\n if (restList.value === ontologies_1.RDF.nil) {\n return [firstItem];\n }\n else {\n const restItems = this._getListItems(restList);\n return [firstItem, ...restItems];\n }\n }\n /**\n * Query the store for triples matching the given pattern supporting multiple graphs.\n * @param graphUris Optional graph URI or array of graph URIs to query.\n * @param subject A subject URI or null to match any subject.\n * @param predicate A predicate URI or null to match any predicate.\n * @param object An object URI or null to match any object.\n * @todo Refactor and merge with the same method in the Mentor RDF Store class.\n */\n *match(graph, subject, predicate, object) {\n if (graph !== undefined) {\n yield* this.store.match(subject, predicate, object, graph);\n }\n else {\n yield* this.store.match(subject, predicate, object);\n }\n }\n expand(store, sourceGraph, targetGraph) {\n if (!targetGraph) {\n targetGraph = this.getInferenceGraphUri(sourceGraph);\n }\n this.store = store;\n this.sourceGraph = this.getGraphNode(sourceGraph);\n this.targetGraph = this.getGraphNode(targetGraph);\n // Ensure the target graph is empty so this function is idempotent and consistent.\n for (let quad of store.match(null, null, null, this.targetGraph)) {\n store.delete(quad);\n }\n this.beforeInference();\n for (let quad of store.match(null, null, null, this.sourceGraph)) {\n this.applyInference(quad);\n }\n this.afterInference();\n this.resetState();\n return store;\n }\n beforeInference() { }\n afterInference() { }\n resetState() { }\n}\nexports.ReasonerBase = ReasonerBase;\n\n\n//# sourceURL=webpack://@faubulous/mentor-rdf/./src/rdf/reasoners/reasoner.ts?\n}");
1344
+ eval("{\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.ReasonerBase = exports.DefaultInferenceGraphHandler = void 0;\nconst tslib_1 = __webpack_require__(/*! tslib */ \"./node_modules/tslib/tslib.es6.mjs\");\nconst n3 = tslib_1.__importStar(__webpack_require__(/*! n3 */ \"./node_modules/n3/src/index.js\"));\nconst rdf_stores_1 = __webpack_require__(/*! rdf-stores */ \"./node_modules/rdf-stores/index.js\");\nconst ontologies_1 = __webpack_require__(/*! ../../ontologies */ \"./src/ontologies/index.ts\");\nconst { namedNode, blankNode } = n3.DataFactory;\n/**\n * Default implementation of the InferenceGraphHandler interface. It generates URIs\n * for inference graphs using a Mentor specific URN scheme.\n */\nclass DefaultInferenceGraphHandler {\n getGraphUri(uri) {\n const u = typeof uri === \"string\" ? uri : uri.value;\n return `urn:mentor:inference:${u}`;\n }\n /**\n * Check if a given URI is an inference graph URI.\n * @param uri A URI.\n * @returns `true` if the URI is an inference graph URI, `false` otherwise.\n */\n isInferenceGraphUri(uri) {\n const u = typeof uri === \"string\" ? uri : uri.value;\n return u.startsWith(\"urn:mentor:inference:\");\n }\n}\nexports.DefaultInferenceGraphHandler = DefaultInferenceGraphHandler;\n/**\n * A base class for reasoners that expand graphs with inferred triples.\n */\nclass ReasonerBase {\n constructor(targetUriGenerator) {\n this.store = rdf_stores_1.RdfStore.createDefault().asDataset();\n this.errors = [];\n if (targetUriGenerator) {\n this.targetUriGenerator = targetUriGenerator;\n }\n else {\n throw new Error(`Invalid value for targetUriGenerator: ${targetUriGenerator}`);\n }\n }\n getGraphNode(graph) {\n if (typeof graph === \"string\") {\n return namedNode(graph);\n }\n else {\n return graph;\n }\n }\n isW3CNode(term) {\n return term.value.startsWith(\"http://www.w3.org\");\n }\n /**\n * Get the URIs of ordered list members in the store.\n * @param graphUris Optional graph URI or array of graph URIs to query.\n * @param listUri URI of the list to get the items from.\n * @returns An array of URIs of the items in the list.\n */\n getListItems(listUri) {\n // To do: Fix #10\n const list = listUri.includes(':') ? namedNode(listUri) : blankNode(listUri);\n return this._getListItems(list);\n }\n _getListItems(subject) {\n if (!this.sourceGraph) {\n return [];\n }\n let first = Array.from(this.match(this.sourceGraph, subject, ontologies_1.rdf.first, null));\n if (!first.length) {\n return [];\n }\n const rest = Array.from(this.match(this.sourceGraph, subject, ontologies_1.rdf.rest, null));\n const firstItem = first[0].object;\n const restList = rest[0]?.object;\n if (restList.value === ontologies_1.RDF.nil) {\n return [firstItem];\n }\n else {\n const restItems = this._getListItems(restList);\n return [firstItem, ...restItems];\n }\n }\n /**\n * Query the store for triples matching the given pattern supporting multiple graphs.\n * @param graphUris Optional graph URI or array of graph URIs to query.\n * @param subject A subject URI or null to match any subject.\n * @param predicate A predicate URI or null to match any predicate.\n * @param object An object URI or null to match any object.\n * @todo Refactor and merge with the same method in the Mentor RDF Store class.\n */\n *match(graph, subject, predicate, object) {\n if (graph !== undefined) {\n yield* this.store.match(subject, predicate, object, graph);\n }\n else {\n yield* this.store.match(subject, predicate, object);\n }\n }\n expand(store, sourceGraph, targetGraph) {\n if (!targetGraph) {\n targetGraph = this.targetUriGenerator.getGraphUri(sourceGraph);\n }\n this.store = store;\n this.sourceGraph = this.getGraphNode(sourceGraph);\n this.targetGraph = this.getGraphNode(targetGraph);\n // Ensure the target graph is empty so this function is idempotent and consistent.\n for (let quad of store.match(null, null, null, this.targetGraph)) {\n store.delete(quad);\n }\n this.beforeInference();\n for (let quad of store.match(null, null, null, this.sourceGraph)) {\n this.applyInference(quad);\n }\n this.afterInference();\n this.resetState();\n return store;\n }\n beforeInference() { }\n afterInference() { }\n resetState() { }\n}\nexports.ReasonerBase = ReasonerBase;\n\n\n//# sourceURL=webpack://@faubulous/mentor-rdf/./src/rdf/reasoners/reasoner.ts?\n}");
1345
1345
 
1346
1346
  /***/ }),
1347
1347
 
@@ -1352,7 +1352,7 @@ eval("{\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexp
1352
1352
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1353
1353
 
1354
1354
  "use strict";
1355
- eval("{\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.ShaclReasoner = void 0;\nconst tslib_1 = __webpack_require__(/*! tslib */ \"./node_modules/tslib/tslib.es6.mjs\");\nconst n3 = tslib_1.__importStar(__webpack_require__(/*! n3 */ \"./node_modules/n3/src/index.js\"));\nconst ontologies_1 = __webpack_require__(/*! ../../ontologies */ \"./src/ontologies/index.ts\");\nconst rdfs_reasoner_1 = __webpack_require__(/*! ./rdfs-reasoner */ \"./src/rdf/reasoners/rdfs-reasoner.ts\");\nconst { quad } = n3.DataFactory;\n/**\n * A simple SKOS reasoner that expands the graph with inferred triples.\n */\nclass ShaclReasoner extends rdfs_reasoner_1.RdfsReasoner {\n constructor() {\n super(...arguments);\n this.classes = new Set();\n }\n isClass(id) {\n return this.classes.has(id) || super.isClass(id);\n }\n applyInference(quad) {\n super.applyInference(quad);\n this.inferShapeAxioms(quad);\n }\n resetState() {\n super.resetState();\n this.classes.clear();\n }\n assertShape(subject, type) {\n this.store.add(quad(subject, ontologies_1.rdf.type, ontologies_1.sh.Shape, this.targetGraph));\n if (type) {\n this.store.add(quad(subject, ontologies_1.rdf.type, type, this.targetGraph));\n }\n this.classes.add(subject.value);\n }\n assertValidator(subject) {\n this.store.add(quad(subject, ontologies_1.rdf.type, ontologies_1.sh.Validator, this.targetGraph));\n this.classes.add(subject.value);\n }\n assertParameterizable(subject) {\n this.store.add(quad(subject, ontologies_1.rdf.type, ontologies_1.sh.Parameterizable, this.targetGraph));\n this.classes.add(subject.value);\n }\n assertRule(subject) {\n this.store.add(quad(subject, ontologies_1.rdf.type, ontologies_1.sh.Rule, this.targetGraph));\n this.classes.add(subject.value);\n }\n isShapeType(subject) {\n switch (subject.value) {\n case ontologies_1.sh.Shape.id:\n case ontologies_1.sh.NodeShape.id:\n case ontologies_1.sh.PropertyShape.id:\n case ontologies_1.sh.Parameter.id: {\n return true;\n }\n default: {\n return false;\n }\n }\n }\n isRuleType(subject) {\n switch (subject.value) {\n case ontologies_1.sh.Rule.id:\n case ontologies_1.sh.JSRule.id:\n case ontologies_1.sh.SPARQLRule.id:\n case ontologies_1.sh.TripleRule.id: {\n return true;\n }\n default: {\n return false;\n }\n }\n }\n isValidatorType(subject) {\n switch (subject.value) {\n case ontologies_1.sh.Validator.id:\n case ontologies_1.sh.JSValidator.id:\n case ontologies_1.sh.SPARQLAskValidator.id:\n case ontologies_1.sh.SPARQLSelectValidator.id: {\n return true;\n }\n default: {\n return false;\n }\n }\n }\n isParameterizableType(subject) {\n switch (subject.value) {\n case ontologies_1.sh.Parameter.id:\n case ontologies_1.sh.ConstraintComponent.id:\n case ontologies_1.sh.Function.id:\n case ontologies_1.sh.JSFunction.id:\n case ontologies_1.sh.SPARQLFunction.id:\n case ontologies_1.sh.TargetType.id:\n case ontologies_1.sh.JSTargetType.id:\n case ontologies_1.sh.SPARQLTargetType.id: {\n return true;\n }\n default: {\n return false;\n }\n }\n }\n inferShapeAxioms(quad) {\n let s = quad.subject;\n let p = quad.predicate;\n let o = quad.object.termType != \"Literal\" ? quad.object : undefined;\n if (!o) {\n return;\n }\n switch (p.value) {\n case ontologies_1.rdf.type.id: {\n if (o.equals(ontologies_1.sh.Shape) || o.equals(ontologies_1.sh.Parameterizable)) {\n // No need to infer the type, as it is already asserted.\n this.classes.add(s.value);\n }\n else if (this.isShapeType(o)) {\n this.assertShape(s, o);\n }\n else if (this.isParameterizableType(o)) {\n this.assertParameterizable(s);\n }\n else if (this.isValidatorType(o)) {\n this.assertValidator(s);\n }\n else if (this.isRuleType(o)) {\n this.assertRule(s);\n }\n return;\n }\n case ontologies_1.sh.targetClass.value: {\n this.assertShape(s, ontologies_1.sh.NodeShape);\n this.assertClass(o);\n return;\n }\n case ontologies_1.sh.class.value: {\n this.assertShape(s, ontologies_1.sh.PropertyShape);\n this.assertClass(o);\n return;\n }\n case ontologies_1.sh.path.id: {\n this.assertShape(s, ontologies_1.sh.PropertyShape);\n this.assertProperty(o);\n return;\n }\n case ontologies_1.sh.property.id: {\n this.assertShape(s, ontologies_1.sh.NodeShape);\n this.assertShape(o, ontologies_1.sh.PropertyShape);\n return;\n }\n case ontologies_1.sh.parameter.id: {\n this.assertShape(o, ontologies_1.sh.Parameter);\n this.assertParameterizable(s);\n return;\n }\n case ontologies_1.sh.labelTemplate.id: {\n this.assertParameterizable(s);\n return;\n }\n case ontologies_1.sh.validator.id: {\n this.assertValidator(o);\n return;\n }\n case ontologies_1.sh.rule.id: {\n this.assertRule(o);\n return;\n }\n case ontologies_1.sh.subject.value:\n case ontologies_1.sh.predicate.id:\n case ontologies_1.sh.object.id: {\n this.assertRule(s);\n return;\n }\n }\n }\n}\nexports.ShaclReasoner = ShaclReasoner;\n\n\n//# sourceURL=webpack://@faubulous/mentor-rdf/./src/rdf/reasoners/shacl-reasoner.ts?\n}");
1355
+ eval("{\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.ShaclReasoner = void 0;\nconst tslib_1 = __webpack_require__(/*! tslib */ \"./node_modules/tslib/tslib.es6.mjs\");\nconst n3 = tslib_1.__importStar(__webpack_require__(/*! n3 */ \"./node_modules/n3/src/index.js\"));\nconst ontologies_1 = __webpack_require__(/*! ../../ontologies */ \"./src/ontologies/index.ts\");\nconst rdfs_reasoner_1 = __webpack_require__(/*! ./rdfs-reasoner */ \"./src/rdf/reasoners/rdfs-reasoner.ts\");\nconst reasoner_1 = __webpack_require__(/*! ./reasoner */ \"./src/rdf/reasoners/reasoner.ts\");\nconst { quad } = n3.DataFactory;\n/**\n * A simple SKOS reasoner that expands the graph with inferred triples.\n */\nclass ShaclReasoner extends rdfs_reasoner_1.RdfsReasoner {\n constructor(targetUriGenerator = new reasoner_1.DefaultInferenceGraphHandler()) {\n super(targetUriGenerator);\n this.classes = new Set();\n }\n isClass(id) {\n return this.classes.has(id) || super.isClass(id);\n }\n applyInference(quad) {\n super.applyInference(quad);\n this.inferShapeAxioms(quad);\n }\n resetState() {\n super.resetState();\n this.classes.clear();\n }\n assertShape(subject, type) {\n this.store.add(quad(subject, ontologies_1.rdf.type, ontologies_1.sh.Shape, this.targetGraph));\n if (type) {\n this.store.add(quad(subject, ontologies_1.rdf.type, type, this.targetGraph));\n }\n this.classes.add(subject.value);\n }\n assertValidator(subject) {\n this.store.add(quad(subject, ontologies_1.rdf.type, ontologies_1.sh.Validator, this.targetGraph));\n this.classes.add(subject.value);\n }\n assertParameterizable(subject) {\n this.store.add(quad(subject, ontologies_1.rdf.type, ontologies_1.sh.Parameterizable, this.targetGraph));\n this.classes.add(subject.value);\n }\n assertRule(subject) {\n this.store.add(quad(subject, ontologies_1.rdf.type, ontologies_1.sh.Rule, this.targetGraph));\n this.classes.add(subject.value);\n }\n isShapeType(subject) {\n switch (subject.value) {\n case ontologies_1.sh.Shape.id:\n case ontologies_1.sh.NodeShape.id:\n case ontologies_1.sh.PropertyShape.id:\n case ontologies_1.sh.Parameter.id: {\n return true;\n }\n default: {\n return false;\n }\n }\n }\n isRuleType(subject) {\n switch (subject.value) {\n case ontologies_1.sh.Rule.id:\n case ontologies_1.sh.JSRule.id:\n case ontologies_1.sh.SPARQLRule.id:\n case ontologies_1.sh.TripleRule.id: {\n return true;\n }\n default: {\n return false;\n }\n }\n }\n isValidatorType(subject) {\n switch (subject.value) {\n case ontologies_1.sh.Validator.id:\n case ontologies_1.sh.JSValidator.id:\n case ontologies_1.sh.SPARQLAskValidator.id:\n case ontologies_1.sh.SPARQLSelectValidator.id: {\n return true;\n }\n default: {\n return false;\n }\n }\n }\n isParameterizableType(subject) {\n switch (subject.value) {\n case ontologies_1.sh.Parameter.id:\n case ontologies_1.sh.ConstraintComponent.id:\n case ontologies_1.sh.Function.id:\n case ontologies_1.sh.JSFunction.id:\n case ontologies_1.sh.SPARQLFunction.id:\n case ontologies_1.sh.TargetType.id:\n case ontologies_1.sh.JSTargetType.id:\n case ontologies_1.sh.SPARQLTargetType.id: {\n return true;\n }\n default: {\n return false;\n }\n }\n }\n inferShapeAxioms(quad) {\n let s = quad.subject;\n let p = quad.predicate;\n let o = quad.object.termType != \"Literal\" ? quad.object : undefined;\n if (!o) {\n return;\n }\n switch (p.value) {\n case ontologies_1.rdf.type.id: {\n if (o.equals(ontologies_1.sh.Shape) || o.equals(ontologies_1.sh.Parameterizable)) {\n // No need to infer the type, as it is already asserted.\n this.classes.add(s.value);\n }\n else if (this.isShapeType(o)) {\n this.assertShape(s, o);\n }\n else if (this.isParameterizableType(o)) {\n this.assertParameterizable(s);\n }\n else if (this.isValidatorType(o)) {\n this.assertValidator(s);\n }\n else if (this.isRuleType(o)) {\n this.assertRule(s);\n }\n return;\n }\n case ontologies_1.sh.targetClass.value: {\n this.assertShape(s, ontologies_1.sh.NodeShape);\n this.assertClass(o);\n return;\n }\n case ontologies_1.sh.class.value: {\n this.assertShape(s, ontologies_1.sh.PropertyShape);\n this.assertClass(o);\n return;\n }\n case ontologies_1.sh.path.id: {\n this.assertShape(s, ontologies_1.sh.PropertyShape);\n this.assertProperty(o);\n return;\n }\n case ontologies_1.sh.property.id: {\n this.assertShape(s, ontologies_1.sh.NodeShape);\n this.assertShape(o, ontologies_1.sh.PropertyShape);\n return;\n }\n case ontologies_1.sh.parameter.id: {\n this.assertShape(o, ontologies_1.sh.Parameter);\n this.assertParameterizable(s);\n return;\n }\n case ontologies_1.sh.labelTemplate.id: {\n this.assertParameterizable(s);\n return;\n }\n case ontologies_1.sh.validator.id: {\n this.assertValidator(o);\n return;\n }\n case ontologies_1.sh.rule.id: {\n this.assertRule(o);\n return;\n }\n case ontologies_1.sh.subject.value:\n case ontologies_1.sh.predicate.id:\n case ontologies_1.sh.object.id: {\n this.assertRule(s);\n return;\n }\n }\n }\n}\nexports.ShaclReasoner = ShaclReasoner;\n\n\n//# sourceURL=webpack://@faubulous/mentor-rdf/./src/rdf/reasoners/shacl-reasoner.ts?\n}");
1356
1356
 
1357
1357
  /***/ }),
1358
1358
 
@@ -1363,7 +1363,7 @@ eval("{\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexp
1363
1363
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1364
1364
 
1365
1365
  "use strict";
1366
- eval("{\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.SkosReasoner = void 0;\nconst tslib_1 = __webpack_require__(/*! tslib */ \"./node_modules/tslib/tslib.es6.mjs\");\nconst n3 = tslib_1.__importStar(__webpack_require__(/*! n3 */ \"./node_modules/n3/src/index.js\"));\nconst ontologies_1 = __webpack_require__(/*! ../../ontologies */ \"./src/ontologies/index.ts\");\nconst reasoner_1 = __webpack_require__(/*! ./reasoner */ \"./src/rdf/reasoners/reasoner.ts\");\nconst { quad } = n3.DataFactory;\n/**\n * A simple SKOS reasoner that expands the graph with inferred triples.\n */\nclass SkosReasoner extends reasoner_1.ReasonerBase {\n constructor() {\n super(...arguments);\n this.concepts = new Set();\n this.conceptSchemes = new Set();\n this.collections = new Set();\n }\n applyInference(quad) {\n this.inferConceptAxioms(quad);\n this.inferCollectionAxioms(quad);\n }\n assertConcept(subject) {\n this.store.add(quad(subject, ontologies_1.rdf.type, ontologies_1.skos.Concept, this.targetGraph));\n this.concepts.add(subject.value);\n }\n assertConceptScheme(subject) {\n this.store.add(quad(subject, ontologies_1.rdf.type, ontologies_1.skos.ConceptScheme, this.targetGraph));\n this.conceptSchemes.add(subject.value);\n }\n isClass(id) {\n return this.concepts.has(id) ||\n this.conceptSchemes.has(id) ||\n this.collections.has(id);\n }\n inferConceptAxioms(quad) {\n let s = quad.subject;\n let p = quad.predicate;\n let o = quad.object.termType != \"Literal\" ? quad.object : undefined;\n if (!o) {\n return;\n }\n switch (p.value) {\n case ontologies_1.rdf.type.id: {\n if (o.equals(ontologies_1.skos.Concept)) {\n // No need to infer the type, as it is already asserted.\n this.concepts.add(s.value);\n }\n else if (o.equals(ontologies_1.skos.ConceptScheme)) {\n // No need to infer the type, as it is already asserted.\n this.conceptSchemes.add(s.value);\n }\n return;\n }\n case ontologies_1.skos.inScheme.id: {\n this.assertConcept(s);\n this.assertConceptScheme(o);\n return;\n }\n case ontologies_1.skos.topConceptOf.id: {\n this.assertConcept(s);\n this.assertConceptScheme(o);\n return;\n }\n case ontologies_1.skos.hasTopConcept.id: {\n this.assertConcept(o);\n this.assertConceptScheme(s);\n return;\n }\n }\n }\n assertCollection(subject) {\n this.store.add(quad(subject, ontologies_1.rdf.type, ontologies_1.skos.Collection, this.targetGraph));\n this.collections.add(subject.value);\n }\n assertOrderedCollection(subject) {\n this.store.add(quad(subject, ontologies_1.rdf.type, ontologies_1.skos.OrderedCollection, this.targetGraph));\n // We do not make a distinction between collections and ordered collections here.\n this.collections.add(subject.value);\n }\n inferCollectionAxioms(quad) {\n let s = quad.subject;\n let p = quad.predicate;\n let o = quad.object.termType != \"Literal\" ? quad.object : undefined;\n if (!o) {\n return;\n }\n switch (p.value) {\n case ontologies_1.rdf.type.id: {\n if (o.equals(ontologies_1.skos.Collection)) {\n // No need to infer the type, as it is already asserted.\n this.collections.add(s.value);\n }\n else if (o.equals(ontologies_1.skos.OrderedCollection)) {\n // No need to infer the type, as it is already asserted.\n this.collections.add(s.value);\n }\n return;\n }\n case ontologies_1.skos.member.id: {\n this.assertCollection(s);\n return;\n }\n case ontologies_1.skos.memberList.id: {\n this.assertOrderedCollection(s);\n return;\n }\n }\n }\n}\nexports.SkosReasoner = SkosReasoner;\n\n\n//# sourceURL=webpack://@faubulous/mentor-rdf/./src/rdf/reasoners/skos-reasoner.ts?\n}");
1366
+ eval("{\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.SkosReasoner = void 0;\nconst tslib_1 = __webpack_require__(/*! tslib */ \"./node_modules/tslib/tslib.es6.mjs\");\nconst n3 = tslib_1.__importStar(__webpack_require__(/*! n3 */ \"./node_modules/n3/src/index.js\"));\nconst ontologies_1 = __webpack_require__(/*! ../../ontologies */ \"./src/ontologies/index.ts\");\nconst reasoner_1 = __webpack_require__(/*! ./reasoner */ \"./src/rdf/reasoners/reasoner.ts\");\nconst { quad } = n3.DataFactory;\n/**\n * A simple SKOS reasoner that expands the graph with inferred triples.\n */\nclass SkosReasoner extends reasoner_1.ReasonerBase {\n constructor(targetUriGenerator = new reasoner_1.DefaultInferenceGraphHandler()) {\n super(targetUriGenerator);\n this.concepts = new Set();\n this.conceptSchemes = new Set();\n this.collections = new Set();\n }\n applyInference(quad) {\n this.inferConceptAxioms(quad);\n this.inferCollectionAxioms(quad);\n }\n assertConcept(subject) {\n this.store.add(quad(subject, ontologies_1.rdf.type, ontologies_1.skos.Concept, this.targetGraph));\n this.concepts.add(subject.value);\n }\n assertConceptScheme(subject) {\n this.store.add(quad(subject, ontologies_1.rdf.type, ontologies_1.skos.ConceptScheme, this.targetGraph));\n this.conceptSchemes.add(subject.value);\n }\n isClass(id) {\n return this.concepts.has(id) ||\n this.conceptSchemes.has(id) ||\n this.collections.has(id);\n }\n inferConceptAxioms(quad) {\n let s = quad.subject;\n let p = quad.predicate;\n let o = quad.object.termType != \"Literal\" ? quad.object : undefined;\n if (!o) {\n return;\n }\n switch (p.value) {\n case ontologies_1.rdf.type.id: {\n if (o.equals(ontologies_1.skos.Concept)) {\n // No need to infer the type, as it is already asserted.\n this.concepts.add(s.value);\n }\n else if (o.equals(ontologies_1.skos.ConceptScheme)) {\n // No need to infer the type, as it is already asserted.\n this.conceptSchemes.add(s.value);\n }\n return;\n }\n case ontologies_1.skos.inScheme.id: {\n this.assertConcept(s);\n this.assertConceptScheme(o);\n return;\n }\n case ontologies_1.skos.topConceptOf.id: {\n this.assertConcept(s);\n this.assertConceptScheme(o);\n return;\n }\n case ontologies_1.skos.hasTopConcept.id: {\n this.assertConcept(o);\n this.assertConceptScheme(s);\n return;\n }\n }\n }\n assertCollection(subject) {\n this.store.add(quad(subject, ontologies_1.rdf.type, ontologies_1.skos.Collection, this.targetGraph));\n this.collections.add(subject.value);\n }\n assertOrderedCollection(subject) {\n this.store.add(quad(subject, ontologies_1.rdf.type, ontologies_1.skos.OrderedCollection, this.targetGraph));\n // We do not make a distinction between collections and ordered collections here.\n this.collections.add(subject.value);\n }\n inferCollectionAxioms(quad) {\n let s = quad.subject;\n let p = quad.predicate;\n let o = quad.object.termType != \"Literal\" ? quad.object : undefined;\n if (!o) {\n return;\n }\n switch (p.value) {\n case ontologies_1.rdf.type.id: {\n if (o.equals(ontologies_1.skos.Collection)) {\n // No need to infer the type, as it is already asserted.\n this.collections.add(s.value);\n }\n else if (o.equals(ontologies_1.skos.OrderedCollection)) {\n // No need to infer the type, as it is already asserted.\n this.collections.add(s.value);\n }\n return;\n }\n case ontologies_1.skos.member.id: {\n this.assertCollection(s);\n return;\n }\n case ontologies_1.skos.memberList.id: {\n this.assertOrderedCollection(s);\n return;\n }\n }\n }\n}\nexports.SkosReasoner = SkosReasoner;\n\n\n//# sourceURL=webpack://@faubulous/mentor-rdf/./src/rdf/reasoners/skos-reasoner.ts?\n}");
1367
1367
 
1368
1368
  /***/ }),
1369
1369
 
@@ -1396,7 +1396,7 @@ eval("{\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexp
1396
1396
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1397
1397
 
1398
1398
  "use strict";
1399
- eval("{\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.Store = exports.TripleNotFoundError = void 0;\nconst tslib_1 = __webpack_require__(/*! tslib */ \"./node_modules/tslib/tslib.es6.mjs\");\nconst n3 = tslib_1.__importStar(__webpack_require__(/*! n3 */ \"./node_modules/n3/src/index.js\"));\nconst src = tslib_1.__importStar(__webpack_require__(/*! ../ontologies/src */ \"./src/ontologies/src.ts\"));\nconst rdf_stores_1 = __webpack_require__(/*! rdf-stores */ \"./node_modules/rdf-stores/index.js\");\nconst ontologies_1 = __webpack_require__(/*! ../ontologies */ \"./src/ontologies/index.ts\");\nconst ontologies_2 = __webpack_require__(/*! ../ontologies */ \"./src/ontologies/index.ts\");\nconst rdfxml_streaming_parser_1 = __webpack_require__(/*! rdfxml-streaming-parser */ \"./node_modules/rdfxml-streaming-parser/index.js\");\nconst { namedNode, blankNode, quad } = n3.DataFactory;\n/**\n * Indicates an error when a triple is not found in the store.\n */\nclass TripleNotFoundError extends Error {\n /**\n * Create a new instance of the error.\n * @param message The error message.\n */\n constructor(subject, predicate, object) {\n super(`No triple was found matching the pattern: ${subject} ${predicate} ${object}`);\n this.name = \"TripleNotFoundError\";\n }\n}\nexports.TripleNotFoundError = TripleNotFoundError;\n/*\n * A store for RDF triples with support for reasoning.\n */\nclass Store {\n /**\n * Get the number of triples in all graphs of the store.\n */\n get size() {\n return this._ds.size;\n }\n /**\n * Create a new RDF triple store.\n * @param reasoner The reasoner to be used for inference.\n */\n constructor(reasoner) {\n /**\n * The adapted RDF.js triple store implementation.\n *\n * Note: Please do not use this directly, but rather use the `_ds` property to access the dataset.\n */\n this._store = rdf_stores_1.RdfStore.createDefault();\n /**\n * The RDF dataset containing the triples in the store, which should primarily be used\n * for any operations so that the store can be swapped out with a different implementation.\n */\n this._ds = this._store.asDataset();\n this.reasoner = reasoner;\n }\n [Symbol.iterator]() {\n return this._ds[Symbol.iterator]();\n }\n /**\n * Loads a set of W3C Standard ontologies into the store (RDF, RDFA, RDFS, OWL, SKOS, SHACL, XSD).\n */\n async loadFrameworkOntologies() {\n await this.loadFromTurtleStream(src.rdf, ontologies_2._RDF);\n await this.loadFromTurtleStream(src.rdfa, ontologies_2._RDFA);\n await this.loadFromTurtleStream(src.rdfs, ontologies_2._RDFS);\n await this.loadFromTurtleStream(src.owl, ontologies_2._OWL);\n await this.loadFromTurtleStream(src.sh, ontologies_2._SH);\n await this.loadFromTurtleStream(src.skos, ontologies_2._SKOS);\n await this.loadFromTurtleStream(src.xsd, ontologies_2._XSD);\n }\n /**\n * Add a quad to the store. Existing quads with the same subject, predicate, object, and graph will be ignored.\n * @param quad The quad to be added.\n * @returns The store instance.\n */\n add(quad) {\n this._ds.add(quad);\n return this;\n }\n /**\n * Delete a quad from the store.\n * @param quad The quad to be deleted.\n * @returns The store instance.\n */\n delete(quad) {\n this._ds.delete(quad);\n return this;\n }\n /**\n * Indicates if the store contains a specific quad.\n * @param quad The quad to be checked.\n * @returns `true` if the quad is found in the store, `false` otherwise.\n */\n has(quad) {\n return this._ds.has(quad);\n }\n /**\n * Get the URIs of the graphs in the triple store.\n * @returns An array of graph URIs in no particular order.\n */\n getGraphs() {\n const result = new Set();\n for (const q of this._ds.match(null, null, null, null)) {\n result.add(q.graph.value);\n }\n return Array.from(result);\n }\n /**\n * Load a set of triples into the store.\n * @param quads An array of quads to be loaded into the store.\n * @param graphUri The target graph URI.\n * @param executeInference Indicates if inference should be executed after loading the triples.\n * @param clearGraph Indicates if the graph should be cleared before loading.\n * @param onQuad A callback function that will be called for each parsed triple.\n */\n _loadQuads(quads, graphUri, executeInference = true, clearGraph = true, onQuad) {\n const graph = namedNode(graphUri.replace('\\\\', '\\/'));\n // Only clear the graph once if there had been no errors.\n if (clearGraph) {\n // Note: Using the match method to clear the graph results in an error because the graph is being modified.\n this.deleteGraphs([graphUri]);\n if (this.reasoner) {\n const inferenceGraph = namedNode(this.reasoner.getInferenceGraphUri(graphUri));\n this.deleteGraphs([inferenceGraph.value]);\n }\n }\n for (let q of quads) {\n this._ds.add(quad(q.subject, q.predicate, q.object, graph));\n if (onQuad) {\n onQuad(q);\n }\n }\n if (this.reasoner && executeInference) {\n this.reasoner.expand(this._ds, graphUri);\n }\n }\n /**\n * Create an RDF store from N3, Turtle or N-Triples data.\n * @param input Input data or stream in to be parsed.\n * @param graphUri URI of the graph to in which the triples will be created.\n * @param executeInference Indicates if inference should be executed after loading the triples.\n * @param clearGraph Indicates if the graph should be cleared before loading.\n * @param onQuad Callback function that will be called for each parsed triple.\n * @returns A promise that resolves to an RDF store.\n */\n async loadFromTurtleStream(input, graphUri, executeInference = true, clearGraph = true, onQuad) {\n return new Promise((resolve, reject) => {\n let quads = [];\n new n3.Parser({}).parse(input, (error, quad, done) => {\n if (error) {\n reject(error);\n }\n else if (quad) {\n quads.push(quad);\n }\n else if (done) {\n this._loadQuads(quads, graphUri, executeInference, clearGraph, onQuad);\n resolve(this);\n }\n });\n });\n }\n /**\n * Create an RDF store from RDF/XML data.\n * @param input Input data or stream format to be parsed.\n * @param graphUri URI of the graph to in which the triples will be created.\n * @param executeInference Indicates if inference should be executed after loading the triples.\n * @param clearGraph Indicates if the graph should be cleared before loading.\n * @param onQuad Callback function that will be called for each parsed triple.\n * @returns A promise that resolves to an RDF store.\n */\n async loadFromXmlStream(input, graphUri, executeInference = true, clearGraph = true, onQuad) {\n return new Promise((resolve, reject) => {\n let quads = [];\n const parser = new rdfxml_streaming_parser_1.RdfXmlParser();\n if (typeof input === 'string') {\n parser.on('error', (error) => reject(error));\n parser.on('data', (quad) => quads.push(quad));\n parser.on('end', () => {\n this._loadQuads(quads, graphUri, executeInference, clearGraph, onQuad);\n resolve(this);\n });\n parser.write(input);\n parser.end();\n }\n else {\n parser.import(input)\n .on('error', (error) => reject(error))\n .on('data', (quad) => quads.push(quad))\n .on('end', () => {\n this._loadQuads(quads, graphUri, executeInference, clearGraph, onQuad);\n resolve(this);\n });\n }\n });\n }\n /**\n * Write the triples in the store into a string in Turtle format.\n * @param graphUri A graph URI.\n * @returns A string serialization of the triples in the graph in Turtle format.\n */\n async serializeGraph(graphUri, prefixes, format) {\n return new Promise((resolve, reject) => {\n const writer = new n3.Writer({\n format: format || 'Turtle',\n prefixes: prefixes\n });\n for (let q of this._ds.match(null, null, null, namedNode(graphUri))) {\n writer.addQuad(q.subject, q.predicate, q.object);\n }\n writer.end((error, result) => {\n if (error) {\n reject(error);\n }\n else {\n resolve(result);\n }\n });\n });\n }\n /**\n * Indicates if the store contains triples in a given graph.\n * @param graphUri A graph URI.\n * @returns `true` if the store contains triples in the graph URI, `false` otherwise.\n */\n hasGraph(graphUri) {\n const uri = typeof graphUri === 'string' ? namedNode(graphUri) : graphUri;\n for (const _ of this._ds.match(null, null, null, uri)) {\n return true;\n }\n return false;\n }\n /**\n * Apply inference to the given graph and store the triples in the associated inference graph.\n * @param graphUri A graph URI.\n */\n executeInference(graphUri) {\n if (this.reasoner) {\n this.reasoner.expand(this._ds, graphUri);\n }\n }\n /**\n * Delete named graphs from the store.\n * @param graphUris URIs of the graphs to be deleted.\n */\n deleteGraphs(graphUris) {\n for (let graphUri of graphUris) {\n const g = namedNode(graphUri);\n for (let q of this._ds.match(null, null, null, g)) {\n this._ds.delete(q);\n }\n }\n }\n /**\n * Get the URIs of ordered list members in the store.\n * @param graphUris Optional graph URI or array of graph URIs to query.\n * @param listUri URI of the list to get the items from.\n * @returns An array of URIs of the items in the list.\n */\n getListItems(graphUris, listUri) {\n // To do: Fix #10\n const list = listUri.includes(':') ? namedNode(listUri) : blankNode(listUri);\n return this._getListItems(graphUris, list).map(t => t.value);\n }\n _getListItems(graphUris, subject) {\n const first = Array.from(this.matchAll(graphUris, subject, ontologies_1.rdf.first, null));\n if (!first.length) {\n return [];\n }\n const rest = Array.from(this.matchAll(graphUris, subject, ontologies_1.rdf.rest, null));\n const firstItem = first[0].object;\n const restList = rest[0]?.object;\n if (restList.value === ontologies_1.RDF.nil) {\n return [firstItem];\n }\n else {\n const restItems = this._getListItems(graphUris, restList);\n return [firstItem, ...restItems];\n }\n }\n /**\n * Returns the exact cardinality of the quads matching the pattern.\n * @param subject The optional subject.\n * @param predicate The optional predicate.\n * @param object The optional object.\n * @param graph The optional graph.\n */\n countQuads(subject, predicate, object, graph) {\n return this._store.countQuads(subject, predicate, object, graph);\n }\n /**\n * Returns a stream of quads matching the given pattern.\n * @param subject The optional subject.\n * @param predicate The optional predicate.\n * @param object The optional object.\n * @param graph The optional graph.\n * @returns A stream of matching quads.\n */\n match(subject, predicate, object, graph) {\n return this._store.match(subject, predicate, object, graph);\n }\n /**\n * Query the store for triples matching the given pattern supporting multiple graphs.\n * @param graphUris Optional graph URI or array of graph URIs to query.\n * @param subject A subject URI or null to match any subject.\n * @param predicate A predicate URI or null to match any predicate.\n * @param object An object URI or null to match any object.\n */\n *matchAll(graphUris, subject, predicate, object, includeInferred) {\n if (includeInferred && !this.reasoner) {\n throw new Error('Reasoner is not available to include inferred triples.');\n }\n const s = subject;\n const p = predicate;\n const o = object;\n if (graphUris !== undefined) {\n const graphs = Array.isArray(graphUris) ? graphUris : [graphUris];\n for (let graph of graphs.map(g => namedNode(g))) {\n for (let q of this._ds.match(s, p, o, graph)) {\n yield q;\n }\n if (includeInferred !== false && this.reasoner) {\n let inferenceGraph = namedNode(this.reasoner.getInferenceGraphUri(graph.value));\n for (let q of this._ds.match(s, p, o, inferenceGraph)) {\n yield q;\n }\n }\n }\n }\n else {\n yield* this._ds.match(s, p, o);\n }\n }\n /**\n * Indicate if there are triples matching the given pattern in the store.\n * @param graphUris Optional graph URI or array of graph URIs to query.\n * @param subject A subject URI or null to match any subject.\n * @param predicate A predicate URI or null to match any predicate.\n * @param object An object URI or null to match any object.\n * @returns `true` if there are triples matching the pattern, `false` otherwise.\n */\n any(graphUris, subject, predicate, object, includeInferred) {\n return this.matchAll(graphUris, subject, predicate, object, includeInferred).next().done === false;\n }\n /**\n * Get the first triple matching the given pattern in the store.\n * @param graphUris Optional graph URI or array of graph URIs to query.\n * @param subject A subject URI or null to match any subject.\n * @param predicate A predicate URI or null to match any predicate.\n * @param object An object URI or null to match any object.\n * @returns The first triple that matches the pattern.\n * @throws {TripleNotFoundError} If no triple is found matching the pattern.\n */\n first(graphUris, subject, predicate, object, includeInferred) {\n const result = this.matchAll(graphUris, subject, predicate, object, includeInferred).next().value;\n if (!result) {\n throw new TripleNotFoundError(subject, predicate, object);\n }\n return result;\n }\n}\nexports.Store = Store;\n\n\n//# sourceURL=webpack://@faubulous/mentor-rdf/./src/rdf/store.ts?\n}");
1399
+ eval("{\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.Store = exports.TripleNotFoundError = void 0;\nconst tslib_1 = __webpack_require__(/*! tslib */ \"./node_modules/tslib/tslib.es6.mjs\");\nconst n3 = tslib_1.__importStar(__webpack_require__(/*! n3 */ \"./node_modules/n3/src/index.js\"));\nconst src = tslib_1.__importStar(__webpack_require__(/*! ../ontologies/src */ \"./src/ontologies/src.ts\"));\nconst rdf_stores_1 = __webpack_require__(/*! rdf-stores */ \"./node_modules/rdf-stores/index.js\");\nconst ontologies_1 = __webpack_require__(/*! ../ontologies */ \"./src/ontologies/index.ts\");\nconst ontologies_2 = __webpack_require__(/*! ../ontologies */ \"./src/ontologies/index.ts\");\nconst rdfxml_streaming_parser_1 = __webpack_require__(/*! rdfxml-streaming-parser */ \"./node_modules/rdfxml-streaming-parser/index.js\");\nconst { namedNode, blankNode, quad } = n3.DataFactory;\n/**\n * Indicates an error when a triple is not found in the store.\n */\nclass TripleNotFoundError extends Error {\n /**\n * Create a new instance of the error.\n * @param message The error message.\n */\n constructor(subject, predicate, object) {\n super(`No triple was found matching the pattern: ${subject} ${predicate} ${object}`);\n this.name = \"TripleNotFoundError\";\n }\n}\nexports.TripleNotFoundError = TripleNotFoundError;\n/*\n * A store for RDF triples with support for reasoning.\n */\nclass Store {\n /**\n * Get the number of triples in all graphs of the store.\n */\n get size() {\n return this._ds.size;\n }\n /**\n * Create a new RDF triple store.\n * @param reasoner The reasoner to be used for inference.\n */\n constructor(reasoner) {\n /**\n * The adapted RDF.js triple store implementation.\n *\n * Note: Please do not use this directly, but rather use the `_ds` property to access the dataset.\n */\n this._store = rdf_stores_1.RdfStore.createDefault();\n /**\n * The RDF dataset containing the triples in the store, which should primarily be used\n * for any operations so that the store can be swapped out with a different implementation.\n */\n this._ds = this._store.asDataset();\n this.reasoner = reasoner;\n }\n [Symbol.iterator]() {\n return this._ds[Symbol.iterator]();\n }\n /**\n * Loads a set of W3C Standard ontologies into the store (RDF, RDFA, RDFS, OWL, SKOS, SHACL, XSD).\n */\n async loadFrameworkOntologies() {\n await this.loadFromTurtleStream(src.rdf, ontologies_2._RDF);\n await this.loadFromTurtleStream(src.rdfa, ontologies_2._RDFA);\n await this.loadFromTurtleStream(src.rdfs, ontologies_2._RDFS);\n await this.loadFromTurtleStream(src.owl, ontologies_2._OWL);\n await this.loadFromTurtleStream(src.sh, ontologies_2._SH);\n await this.loadFromTurtleStream(src.skos, ontologies_2._SKOS);\n await this.loadFromTurtleStream(src.xsd, ontologies_2._XSD);\n }\n /**\n * Add a quad to the store. Existing quads with the same subject, predicate, object, and graph will be ignored.\n * @param quad The quad to be added.\n * @returns The store instance.\n */\n add(quad) {\n this._ds.add(quad);\n return this;\n }\n /**\n * Delete a quad from the store.\n * @param quad The quad to be deleted.\n * @returns The store instance.\n */\n delete(quad) {\n this._ds.delete(quad);\n return this;\n }\n /**\n * Indicates if the store contains a specific quad.\n * @param quad The quad to be checked.\n * @returns `true` if the quad is found in the store, `false` otherwise.\n */\n has(quad) {\n return this._ds.has(quad);\n }\n /**\n * Get the URIs of the graphs in the triple store.\n * @returns An array of graph URIs in no particular order.\n */\n getGraphs() {\n const result = new Set();\n for (const q of this._ds.match(null, null, null, null)) {\n result.add(q.graph.value);\n }\n return Array.from(result);\n }\n /**\n * Load a set of triples into the store.\n * @param quads An array of quads to be loaded into the store.\n * @param graphUri The target graph URI.\n * @param executeInference Indicates if inference should be executed after loading the triples.\n * @param clearGraph Indicates if the graph should be cleared before loading.\n * @param onQuad A callback function that will be called for each parsed triple.\n */\n _loadQuads(quads, graphUri, executeInference = true, clearGraph = true, onQuad) {\n const graph = namedNode(graphUri.replace('\\\\', '\\/'));\n // Only clear the graph once if there had been no errors.\n if (clearGraph) {\n // Note: Using the match method to clear the graph results in an error because the graph is being modified.\n this.deleteGraphs([graphUri]);\n if (this.reasoner) {\n const inferenceGraph = namedNode(this.reasoner.targetUriGenerator.getGraphUri(graphUri));\n this.deleteGraphs([inferenceGraph.value]);\n }\n }\n for (let q of quads) {\n this._ds.add(quad(q.subject, q.predicate, q.object, graph));\n if (onQuad) {\n onQuad(q);\n }\n }\n if (this.reasoner && executeInference) {\n this.reasoner.expand(this._ds, graphUri);\n }\n }\n /**\n * Create an RDF store from N3, Turtle or N-Triples data.\n * @param input Input data or stream in to be parsed.\n * @param graphUri URI of the graph to in which the triples will be created.\n * @param executeInference Indicates if inference should be executed after loading the triples.\n * @param clearGraph Indicates if the graph should be cleared before loading.\n * @param onQuad Callback function that will be called for each parsed triple.\n * @returns A promise that resolves to an RDF store.\n */\n async loadFromTurtleStream(input, graphUri, executeInference = true, clearGraph = true, onQuad) {\n return new Promise((resolve, reject) => {\n let quads = [];\n new n3.Parser({}).parse(input, (error, quad, done) => {\n if (error) {\n reject(error);\n }\n else if (quad) {\n quads.push(quad);\n }\n else if (done) {\n this._loadQuads(quads, graphUri, executeInference, clearGraph, onQuad);\n resolve(this);\n }\n });\n });\n }\n /**\n * Create an RDF store from RDF/XML data.\n * @param input Input data or stream format to be parsed.\n * @param graphUri URI of the graph to in which the triples will be created.\n * @param executeInference Indicates if inference should be executed after loading the triples.\n * @param clearGraph Indicates if the graph should be cleared before loading.\n * @param onQuad Callback function that will be called for each parsed triple.\n * @returns A promise that resolves to an RDF store.\n */\n async loadFromXmlStream(input, graphUri, executeInference = true, clearGraph = true, onQuad) {\n return new Promise((resolve, reject) => {\n let quads = [];\n const parser = new rdfxml_streaming_parser_1.RdfXmlParser();\n if (typeof input === 'string') {\n parser.on('error', (error) => reject(error));\n parser.on('data', (quad) => quads.push(quad));\n parser.on('end', () => {\n this._loadQuads(quads, graphUri, executeInference, clearGraph, onQuad);\n resolve(this);\n });\n parser.write(input);\n parser.end();\n }\n else {\n parser.import(input)\n .on('error', (error) => reject(error))\n .on('data', (quad) => quads.push(quad))\n .on('end', () => {\n this._loadQuads(quads, graphUri, executeInference, clearGraph, onQuad);\n resolve(this);\n });\n }\n });\n }\n /**\n * Write the triples in the store into a string in Turtle format.\n * @param graphUri A graph URI.\n * @returns A string serialization of the triples in the graph in Turtle format.\n */\n async serializeGraph(graphUri, prefixes, format) {\n return new Promise((resolve, reject) => {\n const writer = new n3.Writer({\n format: format || 'Turtle',\n prefixes: prefixes\n });\n for (let q of this._ds.match(null, null, null, namedNode(graphUri))) {\n writer.addQuad(q.subject, q.predicate, q.object);\n }\n writer.end((error, result) => {\n if (error) {\n reject(error);\n }\n else {\n resolve(result);\n }\n });\n });\n }\n /**\n * Indicates if the store contains triples in a given graph.\n * @param graphUri A graph URI.\n * @returns `true` if the store contains triples in the graph URI, `false` otherwise.\n */\n hasGraph(graphUri) {\n const uri = typeof graphUri === 'string' ? namedNode(graphUri) : graphUri;\n for (const _ of this._ds.match(null, null, null, uri)) {\n return true;\n }\n return false;\n }\n /**\n * Apply inference to the given graph and store the triples in the associated inference graph.\n * @param graphUri A graph URI.\n */\n executeInference(graphUri) {\n if (this.reasoner) {\n this.reasoner.expand(this._ds, graphUri);\n }\n }\n /**\n * Delete named graphs from the store.\n * @param graphUris URIs of the graphs to be deleted.\n */\n deleteGraphs(graphUris) {\n for (let graphUri of graphUris) {\n const g = namedNode(graphUri);\n for (let q of this._ds.match(null, null, null, g)) {\n this._ds.delete(q);\n }\n }\n }\n /**\n * Get the URIs of ordered list members in the store.\n * @param graphUris Optional graph URI or array of graph URIs to query.\n * @param listUri URI of the list to get the items from.\n * @returns An array of URIs of the items in the list.\n */\n getListItems(graphUris, listUri) {\n // To do: Fix #10\n const list = listUri.includes(':') ? namedNode(listUri) : blankNode(listUri);\n return this._getListItems(graphUris, list).map(t => t.value);\n }\n _getListItems(graphUris, subject) {\n const first = Array.from(this.matchAll(graphUris, subject, ontologies_1.rdf.first, null));\n if (!first.length) {\n return [];\n }\n const rest = Array.from(this.matchAll(graphUris, subject, ontologies_1.rdf.rest, null));\n const firstItem = first[0].object;\n const restList = rest[0]?.object;\n if (restList.value === ontologies_1.RDF.nil) {\n return [firstItem];\n }\n else {\n const restItems = this._getListItems(graphUris, restList);\n return [firstItem, ...restItems];\n }\n }\n /**\n * Returns the exact cardinality of the quads matching the pattern.\n * @param subject The optional subject.\n * @param predicate The optional predicate.\n * @param object The optional object.\n * @param graph The optional graph.\n */\n countQuads(subject, predicate, object, graph) {\n return this._store.countQuads(subject, predicate, object, graph);\n }\n /**\n * Returns a stream of quads matching the given pattern.\n * @param subject The optional subject.\n * @param predicate The optional predicate.\n * @param object The optional object.\n * @param graph The optional graph.\n * @returns A stream of matching quads.\n */\n match(subject, predicate, object, graph) {\n return this._store.match(subject, predicate, object, graph);\n }\n /**\n * Query the store for triples matching the given pattern supporting multiple graphs.\n * @param graphUris Optional graph URI or array of graph URIs to query.\n * @param subject A subject URI or null to match any subject.\n * @param predicate A predicate URI or null to match any predicate.\n * @param object An object URI or null to match any object.\n */\n *matchAll(graphUris, subject, predicate, object, includeInferred) {\n if (includeInferred && !this.reasoner) {\n throw new Error('Reasoner is not available to include inferred triples.');\n }\n const s = subject;\n const p = predicate;\n const o = object;\n if (graphUris !== undefined) {\n const graphs = Array.isArray(graphUris) ? graphUris : [graphUris];\n for (let graph of graphs.map(g => namedNode(g))) {\n for (let q of this._ds.match(s, p, o, graph)) {\n yield q;\n }\n if (includeInferred !== false && this.reasoner) {\n let inferenceGraph = namedNode(this.reasoner.targetUriGenerator.getGraphUri(graph.value));\n for (let q of this._ds.match(s, p, o, inferenceGraph)) {\n yield q;\n }\n }\n }\n }\n else {\n yield* this._ds.match(s, p, o);\n }\n }\n /**\n * Indicate if there are triples matching the given pattern in the store.\n * @param graphUris Optional graph URI or array of graph URIs to query.\n * @param subject A subject URI or null to match any subject.\n * @param predicate A predicate URI or null to match any predicate.\n * @param object An object URI or null to match any object.\n * @returns `true` if there are triples matching the pattern, `false` otherwise.\n */\n any(graphUris, subject, predicate, object, includeInferred) {\n return this.matchAll(graphUris, subject, predicate, object, includeInferred).next().done === false;\n }\n /**\n * Get the first triple matching the given pattern in the store.\n * @param graphUris Optional graph URI or array of graph URIs to query.\n * @param subject A subject URI or null to match any subject.\n * @param predicate A predicate URI or null to match any predicate.\n * @param object An object URI or null to match any object.\n * @returns The first triple that matches the pattern.\n * @throws {TripleNotFoundError} If no triple is found matching the pattern.\n */\n first(graphUris, subject, predicate, object, includeInferred) {\n const result = this.matchAll(graphUris, subject, predicate, object, includeInferred).next().value;\n if (!result) {\n throw new TripleNotFoundError(subject, predicate, object);\n }\n return result;\n }\n}\nexports.Store = Store;\n\n\n//# sourceURL=webpack://@faubulous/mentor-rdf/./src/rdf/store.ts?\n}");
1400
1400
 
1401
1401
  /***/ }),
1402
1402
 
@@ -8,6 +8,7 @@ export * from "./parsers/syntax-parser";
8
8
  export * from "./property-repository";
9
9
  export * from "./reasoners/owl-reasoner";
10
10
  export * from "./reasoners/rdfs-reasoner";
11
+ export { GraphUriGenerator, DefaultInferenceGraphHandler, Reasoner } from "./reasoners/reasoner";
11
12
  export * from "./resource-repository";
12
13
  export * from "./store";
13
14
  export * from "./uri";
@@ -1,5 +1,6 @@
1
1
  import * as rdfjs from "@rdfjs/types";
2
2
  import { ShaclReasoner } from "./shacl-reasoner";
3
+ import { GraphUriGenerator } from "./reasoner";
3
4
  /**
4
5
  * A restriction in OWL.
5
6
  */
@@ -21,7 +22,7 @@ export declare class OwlReasoner extends ShaclReasoner {
21
22
  protected restrictions: {
22
23
  [subject: string]: OwlRestriction;
23
24
  };
24
- constructor();
25
+ constructor(targetUriGenerator?: GraphUriGenerator);
25
26
  protected afterInference(): void;
26
27
  protected resetState(): void;
27
28
  protected inferClassAxioms(q: rdfjs.Quad): void;
@@ -1,5 +1,6 @@
1
1
  import * as rdfjs from "@rdfjs/types";
2
2
  import { SkosReasoner } from "./skos-reasoner";
3
+ import { GraphUriGenerator } from "./reasoner";
3
4
  /**
4
5
  * A simple RDFS reasoner that expands the graph with inferred triples.
5
6
  */
@@ -7,7 +8,8 @@ export declare class RdfsReasoner extends SkosReasoner {
7
8
  protected ontologies: Set<string>;
8
9
  protected classes: Set<string>;
9
10
  protected properties: Set<string>;
10
- protected invididuals: Set<rdfjs.Quad_Subject>;
11
+ protected individuals: Set<rdfjs.Quad_Subject>;
12
+ constructor(targetUriGenerator?: GraphUriGenerator);
11
13
  protected isIgnoredNode(term: rdfjs.Quad_Subject | rdfjs.Quad_Object): boolean;
12
14
  protected isClass(id: string): boolean;
13
15
  protected afterInference(): void;
@@ -1,15 +1,36 @@
1
1
  import * as rdfjs from "@rdfjs/types";
2
- export interface Reasoner {
2
+ /**
3
+ * A handler to generate graph URIs from any given URI.
4
+ */
5
+ export interface GraphUriGenerator {
3
6
  /**
4
- * Get the URI of the graph where the inferred triples are stored.
5
- * @param uri A graph URI.
7
+ * Generate a graph URI from a given URI.
8
+ * @param uri A URI.
6
9
  */
7
- getInferenceGraphUri(uri: string): string;
10
+ getGraphUri(uri: string | rdfjs.Quad_Graph): string;
11
+ }
12
+ /**
13
+ * Default implementation of the InferenceGraphHandler interface. It generates URIs
14
+ * for inference graphs using a Mentor specific URN scheme.
15
+ */
16
+ export declare class DefaultInferenceGraphHandler implements GraphUriGenerator {
17
+ getGraphUri(uri: string | rdfjs.Quad_Graph): string;
18
+ /**
19
+ * Check if a given URI is an inference graph URI.
20
+ * @param uri A URI.
21
+ * @returns `true` if the URI is an inference graph URI, `false` otherwise.
22
+ */
23
+ isInferenceGraphUri(uri: string | rdfjs.Quad_Graph): boolean;
24
+ }
25
+ /**
26
+ * An interface for reasoners that operate on existing graphs in the RDF store and
27
+ * materialise the inferred triples in an inference graph.
28
+ */
29
+ export interface Reasoner {
8
30
  /**
9
- * Indicate if a given URI is the URI of the graph where the inferred triples are stored.
10
- * @param uri A graph URI.
31
+ * A handler to generate inference graph URIs from any given graph URI if no explicit target graph is provided.
11
32
  */
12
- isInferenceGraphUri(uri: string): boolean;
33
+ targetUriGenerator: GraphUriGenerator;
13
34
  /**
14
35
  * Apply inference on the source graph and store the inferred triples in the target graph.
15
36
  * @param store The store to be inferenced.
@@ -22,10 +43,6 @@ export interface Reasoner {
22
43
  * A base class for reasoners that expand graphs with inferred triples.
23
44
  */
24
45
  export declare abstract class ReasonerBase implements Reasoner {
25
- /**
26
- * IRI scheme to be prepended to inference graph URIs.
27
- */
28
- protected readonly inferenceScheme = "inference:";
29
46
  protected store: rdfjs.DatasetCore;
30
47
  sourceGraph?: rdfjs.Quad_Graph;
31
48
  targetGraph?: rdfjs.Quad_Graph;
@@ -33,13 +50,8 @@ export declare abstract class ReasonerBase implements Reasoner {
33
50
  message: string;
34
51
  quad: rdfjs.Quad;
35
52
  }[];
36
- /**
37
- * Get the IRI of the graph containing the inferenced triples.
38
- * @param uri IRI of the graph to be reasoned upon.
39
- * @returns The IRI of the graph containing the inferenced triples.
40
- */
41
- getInferenceGraphUri(uri: string | rdfjs.Quad_Graph): string;
42
- isInferenceGraphUri(uri: string | rdfjs.Quad_Graph): boolean;
53
+ readonly targetUriGenerator: GraphUriGenerator;
54
+ constructor(targetUriGenerator: GraphUriGenerator);
43
55
  protected getGraphNode(graph: string | rdfjs.Quad_Graph): rdfjs.Quad_Graph;
44
56
  protected isW3CNode(term: rdfjs.Quad_Subject | rdfjs.Quad_Object): boolean;
45
57
  /**
@@ -1,10 +1,12 @@
1
1
  import * as rdfjs from "@rdfjs/types";
2
2
  import { RdfsReasoner } from "./rdfs-reasoner";
3
+ import { GraphUriGenerator } from "./reasoner";
3
4
  /**
4
5
  * A simple SKOS reasoner that expands the graph with inferred triples.
5
6
  */
6
7
  export declare class ShaclReasoner extends RdfsReasoner {
7
8
  protected classes: Set<string>;
9
+ constructor(targetUriGenerator?: GraphUriGenerator);
8
10
  protected isClass(id: string): boolean;
9
11
  applyInference(quad: rdfjs.Quad): void;
10
12
  protected resetState(): void;
@@ -1,5 +1,5 @@
1
1
  import * as rdfjs from "@rdfjs/types";
2
- import { ReasonerBase } from "./reasoner";
2
+ import { GraphUriGenerator, ReasonerBase } from "./reasoner";
3
3
  /**
4
4
  * A simple SKOS reasoner that expands the graph with inferred triples.
5
5
  */
@@ -7,6 +7,7 @@ export declare class SkosReasoner extends ReasonerBase {
7
7
  protected concepts: Set<string>;
8
8
  protected conceptSchemes: Set<string>;
9
9
  protected collections: Set<string>;
10
+ constructor(targetUriGenerator?: GraphUriGenerator);
10
11
  applyInference(quad: rdfjs.Quad): void;
11
12
  protected assertConcept(subject: rdfjs.Quad_Subject): void;
12
13
  protected assertConceptScheme(subject: rdfjs.Quad_Subject): void;
package/package.json CHANGED
@@ -10,18 +10,18 @@
10
10
  "ontology",
11
11
  "vocabulary"
12
12
  ],
13
- "version": "0.2.54",
13
+ "version": "0.2.56",
14
14
  "private": false,
15
15
  "author": {
16
16
  "name": "Sebastian Faubel"
17
17
  },
18
- "main": "out/index.js",
19
- "types": "out/index.d.ts",
18
+ "main": "dist/index.js",
19
+ "types": "dist/index.d.ts",
20
20
  "exports": [
21
- "./out/index.js"
21
+ "./dist/index.js"
22
22
  ],
23
23
  "files": [
24
- "./out"
24
+ "./dist"
25
25
  ],
26
26
  "engines": {
27
27
  "node": ">=16"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes