@faubulous/mentor-rdf 0.2.48 → 0.2.50
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.
- package/out/index.d.ts +0 -0
- package/out/index.js +2 -2
- package/out/ontologies/index.d.ts +0 -0
- package/out/ontologies/owl.d.ts +0 -0
- package/out/ontologies/rdf.d.ts +0 -0
- package/out/ontologies/rdfa.d.ts +0 -0
- package/out/ontologies/rdfs.d.ts +0 -0
- package/out/ontologies/sh.d.ts +0 -0
- package/out/ontologies/skos-xl.d.ts +0 -0
- package/out/ontologies/skos.d.ts +0 -0
- package/out/ontologies/src.d.ts +0 -0
- package/out/ontologies/xsd.d.ts +0 -0
- package/out/rdf/class-repository.d.ts +0 -0
- package/out/rdf/concept-repository.d.ts +0 -0
- package/out/rdf/index.d.ts +0 -0
- package/out/rdf/individual-repository.d.ts +0 -0
- package/out/rdf/parsers/rdf-syntax.d.ts +0 -0
- package/out/rdf/parsers/sparql-syntax-parser.d.ts +0 -0
- package/out/rdf/parsers/syntax-parser.d.ts +0 -0
- package/out/rdf/parsers/trig-syntax-parser.d.ts +0 -0
- package/out/rdf/parsers/turtle-syntax-parser.d.ts +0 -0
- package/out/rdf/property-repository.d.ts +0 -0
- package/out/rdf/reasoners/owl-reasoner.d.ts +0 -0
- package/out/rdf/reasoners/rdfs-reasoner.d.ts +0 -0
- package/out/rdf/reasoners/reasoner.d.ts +0 -0
- package/out/rdf/reasoners/shacl-reasoner.d.ts +0 -0
- package/out/rdf/reasoners/skos-reasoner.d.ts +0 -0
- package/out/rdf/resource-repository.d.ts +53 -0
- package/out/rdf/shape-repository.d.ts +0 -0
- package/out/rdf/store.d.ts +0 -0
- package/out/rdf/uri.d.ts +0 -0
- package/out/rdf/vocabulary-repository.d.ts +0 -0
- package/package.json +66 -66
- package/out/index.js.map +0 -1
- package/out/ontologies/index.js +0 -44
- package/out/ontologies/index.js.map +0 -1
- package/out/ontologies/owl.js +0 -322
- package/out/ontologies/owl.js.map +0 -1
- package/out/ontologies/rdf.js +0 -102
- package/out/ontologies/rdf.js.map +0 -1
- package/out/ontologies/rdfa.js +0 -56
- package/out/ontologies/rdfa.js.map +0 -1
- package/out/ontologies/rdfs.js +0 -76
- package/out/ontologies/rdfs.js.map +0 -1
- package/out/ontologies/sh.js +0 -822
- package/out/ontologies/sh.js.map +0 -1
- package/out/ontologies/skos-xl.js +0 -40
- package/out/ontologies/skos-xl.js.map +0 -1
- package/out/ontologies/skos.js +0 -144
- package/out/ontologies/skos.js.map +0 -1
- package/out/ontologies/src.js +0 -3016
- package/out/ontologies/src.js.map +0 -1
- package/out/ontologies/xsd.js +0 -108
- package/out/ontologies/xsd.js.map +0 -1
- package/out/rdf/class-repository.js +0 -324
- package/out/rdf/class-repository.js.map +0 -1
- package/out/rdf/concept-repository.js +0 -220
- package/out/rdf/concept-repository.js.map +0 -1
- package/out/rdf/index.js +0 -18
- package/out/rdf/index.js.map +0 -1
- package/out/rdf/individual-repository.js +0 -77
- package/out/rdf/individual-repository.js.map +0 -1
- package/out/rdf/parsers/rdf-syntax.js +0 -19
- package/out/rdf/parsers/rdf-syntax.js.map +0 -1
- package/out/rdf/parsers/sparql-syntax-parser.js +0 -61
- package/out/rdf/parsers/sparql-syntax-parser.js.map +0 -1
- package/out/rdf/parsers/syntax-parser.js +0 -3
- package/out/rdf/parsers/syntax-parser.js.map +0 -1
- package/out/rdf/parsers/trig-syntax-parser.js +0 -30
- package/out/rdf/parsers/trig-syntax-parser.js.map +0 -1
- package/out/rdf/parsers/turtle-syntax-parser.js +0 -30
- package/out/rdf/parsers/turtle-syntax-parser.js.map +0 -1
- package/out/rdf/property-repository.js +0 -257
- package/out/rdf/property-repository.js.map +0 -1
- package/out/rdf/reasoners/owl-reasoner.js +0 -218
- package/out/rdf/reasoners/owl-reasoner.js.map +0 -1
- package/out/rdf/reasoners/rdfs-reasoner.js +0 -144
- package/out/rdf/reasoners/rdfs-reasoner.js.map +0 -1
- package/out/rdf/reasoners/reasoner.js +0 -106
- package/out/rdf/reasoners/reasoner.js.map +0 -1
- package/out/rdf/reasoners/shacl-reasoner.js +0 -170
- package/out/rdf/reasoners/shacl-reasoner.js.map +0 -1
- package/out/rdf/reasoners/skos-reasoner.js +0 -109
- package/out/rdf/reasoners/skos-reasoner.js.map +0 -1
- package/out/rdf/resource-repository.js +0 -136
- package/out/rdf/resource-repository.js.map +0 -1
- package/out/rdf/shape-repository.js +0 -298
- package/out/rdf/shape-repository.js.map +0 -1
- package/out/rdf/store.js +0 -240
- package/out/rdf/store.js.map +0 -1
- package/out/rdf/tests/helpers.d.ts +0 -39
- package/out/rdf/tests/helpers.js +0 -85
- package/out/rdf/tests/helpers.js.map +0 -1
- package/out/rdf/tests/vocabularies/bfo.d.ts +0 -413
- package/out/rdf/tests/vocabularies/bfo.js +0 -418
- package/out/rdf/tests/vocabularies/bfo.js.map +0 -1
- package/out/rdf/tests/vocabularies/cidoc-crm.d.ts +0 -2101
- package/out/rdf/tests/vocabularies/cidoc-crm.js +0 -2106
- package/out/rdf/tests/vocabularies/cidoc-crm.js.map +0 -1
- package/out/rdf/tests/vocabularies/emmo.d.ts +0 -5525
- package/out/rdf/tests/vocabularies/emmo.js +0 -5530
- package/out/rdf/tests/vocabularies/emmo.js.map +0 -1
- package/out/rdf/tests/vocabularies/fibo-agents.d.ts +0 -17
- package/out/rdf/tests/vocabularies/fibo-agents.js +0 -22
- package/out/rdf/tests/vocabularies/fibo-agents.js.map +0 -1
- package/out/rdf/tests/vocabularies/fibo-organization.d.ts +0 -69
- package/out/rdf/tests/vocabularies/fibo-organization.js +0 -74
- package/out/rdf/tests/vocabularies/fibo-organization.js.map +0 -1
- package/out/rdf/tests/vocabularies/gist.d.ts +0 -1071
- package/out/rdf/tests/vocabularies/gist.js +0 -1076
- package/out/rdf/tests/vocabularies/gist.js.map +0 -1
- package/out/rdf/tests/vocabularies/index.d.ts +0 -17
- package/out/rdf/tests/vocabularies/index.js +0 -90
- package/out/rdf/tests/vocabularies/index.js.map +0 -1
- package/out/rdf/tests/vocabularies/lob.d.ts +0 -5669
- package/out/rdf/tests/vocabularies/lob.js +0 -5674
- package/out/rdf/tests/vocabularies/lob.js.map +0 -1
- package/out/rdf/tests/vocabularies/multi.d.ts +0 -29
- package/out/rdf/tests/vocabularies/multi.js +0 -34
- package/out/rdf/tests/vocabularies/multi.js.map +0 -1
- package/out/rdf/tests/vocabularies/org.d.ts +0 -193
- package/out/rdf/tests/vocabularies/org.js +0 -198
- package/out/rdf/tests/vocabularies/org.js.map +0 -1
- package/out/rdf/tests/vocabularies/owl.d.ts +0 -317
- package/out/rdf/tests/vocabularies/owl.js +0 -322
- package/out/rdf/tests/vocabularies/owl.js.map +0 -1
- package/out/rdf/tests/vocabularies/prov-o.d.ts +0 -391
- package/out/rdf/tests/vocabularies/prov-o.js +0 -396
- package/out/rdf/tests/vocabularies/prov-o.js.map +0 -1
- package/out/rdf/tests/vocabularies/schema-nq.d.ts +0 -12079
- package/out/rdf/tests/vocabularies/schema-nq.js +0 -12084
- package/out/rdf/tests/vocabularies/schema-nq.js.map +0 -1
- package/out/rdf/tests/vocabularies/schema-nt.d.ts +0 -12079
- package/out/rdf/tests/vocabularies/schema-nt.js +0 -12084
- package/out/rdf/tests/vocabularies/schema-nt.js.map +0 -1
- package/out/rdf/tests/vocabularies/schema.d.ts +0 -12079
- package/out/rdf/tests/vocabularies/schema.js +0 -12084
- package/out/rdf/tests/vocabularies/schema.js.map +0 -1
- package/out/rdf/tests/vocabularies/shapes.d.ts +0 -53
- package/out/rdf/tests/vocabularies/shapes.js +0 -58
- package/out/rdf/tests/vocabularies/shapes.js.map +0 -1
- package/out/rdf/tests/vocabularies/skos.d.ts +0 -139
- package/out/rdf/tests/vocabularies/skos.js +0 -144
- package/out/rdf/tests/vocabularies/skos.js.map +0 -1
- package/out/rdf/tests/vocabularies/unesco.d.ts +0 -10517
- package/out/rdf/tests/vocabularies/unesco.js +0 -10522
- package/out/rdf/tests/vocabularies/unesco.js.map +0 -1
- package/out/rdf/uri.js +0 -84
- package/out/rdf/uri.js.map +0 -1
- package/out/rdf/vocabulary-generator.d.ts +0 -86
- package/out/rdf/vocabulary-generator.js +0 -294
- package/out/rdf/vocabulary-generator.js.map +0 -1
- package/out/rdf/vocabulary-repository.js +0 -121
- package/out/rdf/vocabulary-repository.js.map +0 -1
package/out/index.d.ts
CHANGED
|
File without changes
|
package/out/index.js
CHANGED
|
@@ -665,7 +665,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
|
665
665
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
666
666
|
|
|
667
667
|
"use strict";
|
|
668
|
-
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.SparqlSyntaxParser = void 0;\nconst millan_1 = __webpack_require__(/*! millan */ \"./node_modules/millan/dist/millan.js\");\n/**\n * An extended version of the Millan SPARQL parser that also returns semantic errors such as undefined prefixes.\n */\nclass SparqlSyntaxParser {\n constructor() {\n this.parser = new millan_1.W3SpecSparqlParser();\n this.parse = (document) => {\n const { cst, errors, comments } = this.parser.parse(document);\n const tokens = this.parser.input;\n const semanticErrors = [];\n const declaredPrefixes = new Set();\n for (let i = 0; i < tokens.length; i++) {\n const token = tokens[i];\n const tokenName = token.tokenType?.name;\n switch (tokenName) {\n case \"PNAME_NS\": {\n const prefix = token.image.split(\":\")[0];\n declaredPrefixes.add(prefix);\n break;\n }\n case \"PNAME_LN\": {\n const prefix = token.image.split(\":\")[0];\n if (!declaredPrefixes.has(prefix)) {\n semanticErrors.push({\n message: `Undefined prefix: ${prefix}`,\n name: \"NoNamespacePrefixError\",\n token: token,\n resyncedTokens: [],\n context: {\n ruleStack: [],\n ruleOccurrenceStack: []\n }\n });\n }\n break;\n }\n }\n }\n return {\n comments: comments ? comments : [],\n cst,\n errors,\n semanticErrors,\n tokens,\n };\n };\n }\n get input() {\n return this.parser.input;\n }\n tokenize(document) {\n
|
|
668
|
+
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.SparqlSyntaxParser = void 0;\nconst millan_1 = __webpack_require__(/*! millan */ \"./node_modules/millan/dist/millan.js\");\n/**\n * An extended version of the Millan SPARQL parser that also returns semantic errors such as undefined prefixes.\n */\nclass SparqlSyntaxParser {\n constructor() {\n this.parser = new millan_1.W3SpecSparqlParser();\n this.parse = (document) => {\n const { cst, errors, comments } = this.parser.parse(document);\n const tokens = this.parser.input;\n const semanticErrors = [];\n const declaredPrefixes = new Set();\n for (let i = 0; i < tokens.length; i++) {\n const token = tokens[i];\n const tokenName = token.tokenType?.name;\n switch (tokenName) {\n case \"PNAME_NS\": {\n const prefix = token.image.split(\":\")[0];\n declaredPrefixes.add(prefix);\n break;\n }\n case \"PNAME_LN\": {\n const prefix = token.image.split(\":\")[0];\n if (!declaredPrefixes.has(prefix)) {\n semanticErrors.push({\n message: `Undefined prefix: ${prefix}`,\n name: \"NoNamespacePrefixError\",\n token: token,\n resyncedTokens: [],\n context: {\n ruleStack: [],\n ruleOccurrenceStack: []\n }\n });\n }\n break;\n }\n }\n }\n return {\n comments: comments ? comments : [],\n cst,\n errors,\n semanticErrors,\n tokens,\n };\n };\n }\n get input() {\n return this.parser ? this.parser.input : [];\n }\n tokenize(document) {\n // Note: The Millan SPARQL parser is crashing when parsing large files to build the CST tree for error detection.\n // Therefore, we access the lexer directly to tokenize the document including comments.\n const lexer = this.parser.lexer;\n const result = lexer.tokenize(document);\n const tokens = result.tokens;\n const comments = result.groups.comments;\n return comments ? [...tokens, ...comments] : tokens;\n }\n}\nexports.SparqlSyntaxParser = SparqlSyntaxParser;\n\n\n//# sourceURL=webpack://@faubulous/mentor-rdf/./src/rdf/parsers/sparql-syntax-parser.ts?");
|
|
669
669
|
|
|
670
670
|
/***/ }),
|
|
671
671
|
|
|
@@ -775,7 +775,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
|
775
775
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
776
776
|
|
|
777
777
|
"use strict";
|
|
778
|
-
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.ResourceRepository = 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 uri_1 = __webpack_require__(/*! ./uri */ \"./src/rdf/uri.ts\");\n/**\n * A repository for retrieving resources from graphs.\n */\nclass ResourceRepository {\n constructor(store) {\n this.store = store;\n }\n /**\n * Inidiates if a node should not be included in the result of a definition query.\n * @param graphUris URIs of the graphs to search.\n * @param subject The focus node.\n * @param options Definition query options.\n * @param optionDefaults Custom default values for the query options.\n * @returns\n */\n skip(graphUris, subject, options, optionDefaults = { includeBlankNodes: false, includeReferenced: false }) {\n const opts = { ...optionDefaults, ...options };\n if (!opts.includeBlankNodes && subject.termType != \"NamedNode\") {\n // We are only interested in named nodes.\n return true;\n }\n if (!opts.includeReferenced && !this.hasSubject(graphUris, subject)) {\n // Skip the node if it is not explicitly defined in the graph as a subject.\n return true;\n }\n if (opts?.definedBy !== undefined) {\n const isDefined = this.isDefinedBy(graphUris, subject, opts.definedBy);\n // Do not skip the node if it has a different namespace but is *explicitly* defined by the given URI.\n if (opts.definedBy === null && isDefined || opts.definedBy !== null && !isDefined) {\n return true;\n }\n }\n else if (opts?.notDefinedBy !== undefined) {\n for (const source of opts.notDefinedBy) {\n if (this.isDefinedBy(graphUris, subject, source)) {\n return true;\n }\n }\n }\n return false;\n }\n /**\n * Indicate if a given URI exists as the subject of a triple in the graph.\n * @param graphUris URIs of the graphs to search.\n * @param subjectUri URI of the subject to search for.\n * @returns true if the URI is a subject, false otherwise.\n */\n hasSubject(graphUris, subjectUri) {\n let s;\n if (typeof subjectUri === \"string\") {\n s = n3.DataFactory.namedNode(subjectUri);\n }\n else if (subjectUri.termType !== \"Literal\") {\n s = subjectUri;\n }\n if (s) {\n for (let _ of this.store.match(graphUris, s, null, null, false)) {\n return true;\n }\n }\n return false;\n }\n /**\n * Indicate if a node is explicitly defined by the given URI using the `rdfs:isDefinedBy` property, or implicitly by sharing the same namespace.\n * @param graphUris URIs of the graphs to search.\n * @param node A named node to check if it is defined by the given URI.\n * @param definedBy URI of the vocabulary that defines the resource (rdfs:isDefinedBy). Provide `null` to only return resources that have no `rdfs:isDefinedBy` property.\n * @returns `true` if the node is defined by the given URI, `false` otherwise.\n */\n isDefinedBy(graphUris, node, definedBy) {\n const s = node;\n if (definedBy === null) {\n // If there is no definedBy URI, we assume that the resource is not\n // explicitly defined by any ontology.\n for (let _ of this.store.match(graphUris, s, ontologies_1.rdfs.isDefinedBy, null)) {\n return true;\n }\n }\n else {\n // We assume that a resource is defined by an ontology if it starts with the namespace of the ontology.\n if (node.value.startsWith(definedBy)) {\n return true;\n }\n // If the ontology is something like <http://purl.obolibrary.org/obo/bfo.owl> or <http://www.w3.org/ns/prov#>\n // and the subject is <http://purl.obolibrary.org/obo/BFO_0000001> or <http://www.w3.org/ns/prov#Entity>\n // then we assume that it is defined by the ontology. The OBO case shows that we need to remove the file\n // name in oder to be able to compare the namespace URIs.\n const ontologyNamespace = uri_1.Uri.getNormalizedUri(uri_1.Uri.getNamespaceUri(definedBy));\n const subjectNamespace = uri_1.Uri.getNormalizedUri(uri_1.Uri.getNamespaceUri(node.value));\n if (subjectNamespace === ontologyNamespace) {\n return true;\n }\n const o = n3.DataFactory.namedNode(uri_1.Uri.getNormalizedUri(definedBy));\n // The explicit annotation of the definition source has precedence over heuristic checks.\n for (let q of this.store.match(graphUris, s, ontologies_1.rdfs.isDefinedBy, null)) {\n if (uri_1.Uri.getNormalizedUri(q.object.value) === o.value) {\n return true;\n }\n }\n // A blank node is defined in the namespace if it is the object of a triple that is defined by the URI.\n if (s.termType === \"BlankNode\") {\n for (let q of this.store.match(graphUris, null, null, s, false)) {\n return this.isDefinedBy(graphUris, q.subject, definedBy);\n }\n }\n }\n return false;\n }\n /**\n * Indicate if a resource has a given type in the graph.\n * @param graphUris URIs of the graphs to search.\n * @param subjectUri URI or blank node id of the subject to match.\n * @param typeUri URI of the type to match.\n * @param options Optional query parameters.\n * @returns `true` if the resource has the type, `false` otherwise.\n */\n hasType(graphUris, subjectUri, typeUri, options) {\n const o = n3.DataFactory.namedNode(typeUri);\n for (let _ of this.store.match(graphUris, n3.DataFactory.namedNode(subjectUri), ontologies_1.rdf.type, o, options?.includeInferred)) {\n return true;\n }\n for (let _ of this.store.match(graphUris, n3.DataFactory.blankNode(subjectUri), ontologies_1.rdf.type, o, options?.includeInferred)) {\n return true;\n }\n return false;\n }\n}\nexports.ResourceRepository = ResourceRepository;\n\n\n//# sourceURL=webpack://@faubulous/mentor-rdf/./src/rdf/resource-repository.ts?");
|
|
778
|
+
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.ResourceRepository = 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 uri_1 = __webpack_require__(/*! ./uri */ \"./src/rdf/uri.ts\");\n/**\n * A repository for retrieving resources from graphs.\n */\nclass ResourceRepository {\n constructor(store) {\n this.store = store;\n }\n /**\n * Inidiates if a node should not be included in the result of a definition query.\n * @param graphUris URIs of the graphs to search.\n * @param subject The focus node.\n * @param options Definition query options.\n * @param optionDefaults Custom default values for the query options.\n * @returns\n */\n skip(graphUris, subject, options, optionDefaults = { includeBlankNodes: false, includeReferenced: false }) {\n const opts = { ...optionDefaults, ...options };\n if (!opts.includeBlankNodes && subject.termType != \"NamedNode\") {\n // We are only interested in named nodes.\n return true;\n }\n if (!opts.includeReferenced && !this.hasSubject(graphUris, subject)) {\n // Skip the node if it is not explicitly defined in the graph as a subject.\n return true;\n }\n if (opts?.definedBy !== undefined) {\n const isDefined = this.isDefinedBy(graphUris, subject, opts.definedBy);\n // Do not skip the node if it has a different namespace but is *explicitly* defined by the given URI.\n if (opts.definedBy === null && isDefined || opts.definedBy !== null && !isDefined) {\n return true;\n }\n }\n else if (opts?.notDefinedBy !== undefined) {\n for (const source of opts.notDefinedBy) {\n if (this.isDefinedBy(graphUris, subject, source)) {\n return true;\n }\n }\n }\n return false;\n }\n /**\n * Indicate if a given URI exists as the subject of a triple in the graph.\n * @param graphUris URIs of the graphs to search.\n * @param subjectUri URI of the subject to search for.\n * @returns true if the URI is a subject, false otherwise.\n */\n hasSubject(graphUris, subjectUri) {\n let s;\n if (typeof subjectUri === \"string\") {\n s = n3.DataFactory.namedNode(subjectUri);\n }\n else if (subjectUri.termType !== \"Literal\") {\n s = subjectUri;\n }\n if (s) {\n for (let _ of this.store.match(graphUris, s, null, null, false)) {\n return true;\n }\n }\n return false;\n }\n /**\n * Indicate if a node is explicitly defined by the given URI using the `rdfs:isDefinedBy` property, or implicitly by sharing the same namespace.\n * @param graphUris URIs of the graphs to search.\n * @param node A named node to check if it is defined by the given URI.\n * @param definedBy URI of the vocabulary that defines the resource (rdfs:isDefinedBy). Provide `null` to only return resources that have no `rdfs:isDefinedBy` property.\n * @returns `true` if the node is defined by the given URI, `false` otherwise.\n */\n isDefinedBy(graphUris, node, definedBy) {\n const s = node;\n if (definedBy === null) {\n // If there is no definedBy URI, we assume that the resource is not\n // explicitly defined by any ontology.\n for (let _ of this.store.match(graphUris, s, ontologies_1.rdfs.isDefinedBy, null)) {\n return true;\n }\n }\n else {\n // We assume that a resource is defined by an ontology if it starts with the namespace of the ontology.\n if (node.value.startsWith(definedBy)) {\n return true;\n }\n // If the ontology is something like <http://purl.obolibrary.org/obo/bfo.owl> or <http://www.w3.org/ns/prov#>\n // and the subject is <http://purl.obolibrary.org/obo/BFO_0000001> or <http://www.w3.org/ns/prov#Entity>\n // then we assume that it is defined by the ontology. The OBO case shows that we need to remove the file\n // name in oder to be able to compare the namespace URIs.\n const ontologyNamespace = uri_1.Uri.getNormalizedUri(uri_1.Uri.getNamespaceUri(definedBy));\n const subjectNamespace = uri_1.Uri.getNormalizedUri(uri_1.Uri.getNamespaceUri(node.value));\n if (subjectNamespace === ontologyNamespace) {\n return true;\n }\n const o = n3.DataFactory.namedNode(uri_1.Uri.getNormalizedUri(definedBy));\n // The explicit annotation of the definition source has precedence over heuristic checks.\n for (let q of this.store.match(graphUris, s, ontologies_1.rdfs.isDefinedBy, null)) {\n if (uri_1.Uri.getNormalizedUri(q.object.value) === o.value) {\n return true;\n }\n }\n // A blank node is defined in the namespace if it is the object of a triple that is defined by the URI.\n if (s.termType === \"BlankNode\") {\n for (let q of this.store.match(graphUris, null, null, s, false)) {\n return this.isDefinedBy(graphUris, q.subject, definedBy);\n }\n }\n }\n return false;\n }\n /**\n * Indicate if a resource has a given type in the graph.\n * @param graphUris URIs of the graphs to search.\n * @param subjectUri URI or blank node id of the subject to match.\n * @param typeUri URI of the type to match.\n * @param options Optional query parameters.\n * @returns `true` if the resource has the type, `false` otherwise.\n */\n hasType(graphUris, subjectUri, typeUri, options) {\n const o = n3.DataFactory.namedNode(typeUri);\n for (let _ of this.store.match(graphUris, n3.DataFactory.namedNode(subjectUri), ontologies_1.rdf.type, o, options?.includeInferred)) {\n return true;\n }\n for (let _ of this.store.match(graphUris, n3.DataFactory.blankNode(subjectUri), ontologies_1.rdf.type, o, options?.includeInferred)) {\n return true;\n }\n return false;\n }\n /**\n * Get information about the usage of predicates in the document such as the frequency of use and the use of language tags.\n * @param graphUris URIs of the graphs to search.\n * @param predicateUris URIs of the predicates to match.\n */\n getPredicateUsageStats(graphUris, predicateUris = undefined) {\n const result = {};\n const predicates = predicateUris ? new Set(predicateUris) : undefined;\n for (let q of this.store.match(graphUris, null, null, null, false)) {\n if (predicates && !predicates.has(q.predicate.value)) {\n continue;\n }\n // Create stats for all predicates and add language tags for literals if available.\n let predicateStats = result[q.predicate.value];\n if (!predicateStats) {\n predicateStats = {\n predicateIri: q.predicate.value,\n subjects: new Set(),\n usageFrequency: 0,\n languageTags: {}\n };\n result[q.predicate.value] = predicateStats;\n }\n predicateStats.subjects.add(q.subject.value);\n predicateStats.usageFrequency++;\n if (q.object.termType === \"Literal\") {\n let language = q.object.language;\n if (!predicateStats.languageTags[language]) {\n predicateStats.languageTags[language] = 1;\n }\n else {\n predicateStats.languageTags[language] += 1;\n }\n }\n }\n return result;\n }\n /**\n * Get the language tags used in the object of triples with a given set of predicates.\n * @param graphUris URIs of the graphs to search.\n * @param predicateUris URIs of the predicates to match.\n * @returns An array of language tag statistics, sorted by the number of occurrences in descending order.\n */\n getLanguageTagUsageStats(graphUris) {\n const stats = {};\n for (let q of this.store.match(graphUris, null, null, null, false)) {\n if (q.object.termType === \"Literal\" && q.object.language) {\n const language = q.object.language;\n if (!stats[language]) {\n stats[language] = 1;\n }\n else {\n stats[language] += 1;\n }\n }\n }\n return stats;\n }\n /**\n * Get the most frequently used language tag in the object of triples with a given set of predicates.\n * @param graphUris URIs of the graphs to search.\n */\n getMostFrequentLanguageTag(graphUris) {\n let stats = this.getLanguageTagUsageStats(graphUris);\n let max = 0;\n let primary;\n for (let language in stats) {\n if (stats[language] > max) {\n max = stats[language];\n primary = language;\n }\n }\n return primary;\n }\n}\nexports.ResourceRepository = ResourceRepository;\n\n\n//# sourceURL=webpack://@faubulous/mentor-rdf/./src/rdf/resource-repository.ts?");
|
|
779
779
|
|
|
780
780
|
/***/ }),
|
|
781
781
|
|
|
File without changes
|
package/out/ontologies/owl.d.ts
CHANGED
|
File without changes
|
package/out/ontologies/rdf.d.ts
CHANGED
|
File without changes
|
package/out/ontologies/rdfa.d.ts
CHANGED
|
File without changes
|
package/out/ontologies/rdfs.d.ts
CHANGED
|
File without changes
|
package/out/ontologies/sh.d.ts
CHANGED
|
File without changes
|
|
File without changes
|
package/out/ontologies/skos.d.ts
CHANGED
|
File without changes
|
package/out/ontologies/src.d.ts
CHANGED
|
File without changes
|
package/out/ontologies/xsd.d.ts
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/out/rdf/index.d.ts
CHANGED
|
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
|
|
@@ -40,6 +40,41 @@ export interface TypedInstanceQueryOptions extends QueryOptions {
|
|
|
40
40
|
*/
|
|
41
41
|
includeSubTypes?: boolean;
|
|
42
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Maps a language tag to the number of occurrences in the document.
|
|
45
|
+
*/
|
|
46
|
+
export interface LanguageTagUsageStats {
|
|
47
|
+
[key: string]: number;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Maps a predicate IRI to information about its usage in the document.
|
|
51
|
+
*/
|
|
52
|
+
export interface PredicateUsageStats {
|
|
53
|
+
[key: string]: PredicateUsageInfo;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Information about the usage of a single predicate in a document.
|
|
57
|
+
*/
|
|
58
|
+
export interface PredicateUsageInfo {
|
|
59
|
+
/**
|
|
60
|
+
* The predicate IRI.
|
|
61
|
+
*/
|
|
62
|
+
predicateIri: string;
|
|
63
|
+
/**
|
|
64
|
+
* The set of subjects that use the predicate.
|
|
65
|
+
*/
|
|
66
|
+
subjects: Set<string>;
|
|
67
|
+
/**
|
|
68
|
+
* The number of occurrences of the predicate in a document.
|
|
69
|
+
*/
|
|
70
|
+
usageFrequency: number;
|
|
71
|
+
/**
|
|
72
|
+
* Information about the language tags used in the object of triples with the predicate.
|
|
73
|
+
*/
|
|
74
|
+
languageTags: {
|
|
75
|
+
[key: string]: number;
|
|
76
|
+
};
|
|
77
|
+
}
|
|
43
78
|
/**
|
|
44
79
|
* A repository for retrieving resources from graphs.
|
|
45
80
|
*/
|
|
@@ -82,4 +117,22 @@ export declare class ResourceRepository {
|
|
|
82
117
|
* @returns `true` if the resource has the type, `false` otherwise.
|
|
83
118
|
*/
|
|
84
119
|
hasType(graphUris: string | string[] | undefined, subjectUri: string, typeUri: string, options?: QueryOptions): boolean;
|
|
120
|
+
/**
|
|
121
|
+
* Get information about the usage of predicates in the document such as the frequency of use and the use of language tags.
|
|
122
|
+
* @param graphUris URIs of the graphs to search.
|
|
123
|
+
* @param predicateUris URIs of the predicates to match.
|
|
124
|
+
*/
|
|
125
|
+
getPredicateUsageStats(graphUris: string | string[] | undefined, predicateUris?: string[] | undefined): PredicateUsageStats;
|
|
126
|
+
/**
|
|
127
|
+
* Get the language tags used in the object of triples with a given set of predicates.
|
|
128
|
+
* @param graphUris URIs of the graphs to search.
|
|
129
|
+
* @param predicateUris URIs of the predicates to match.
|
|
130
|
+
* @returns An array of language tag statistics, sorted by the number of occurrences in descending order.
|
|
131
|
+
*/
|
|
132
|
+
getLanguageTagUsageStats(graphUris: string | string[] | undefined): LanguageTagUsageStats;
|
|
133
|
+
/**
|
|
134
|
+
* Get the most frequently used language tag in the object of triples with a given set of predicates.
|
|
135
|
+
* @param graphUris URIs of the graphs to search.
|
|
136
|
+
*/
|
|
137
|
+
getMostFrequentLanguageTag(graphUris: string | string[] | undefined): string | undefined;
|
|
85
138
|
}
|
|
File without changes
|
package/out/rdf/store.d.ts
CHANGED
|
File without changes
|
package/out/rdf/uri.d.ts
CHANGED
|
File without changes
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,66 +1,66 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@faubulous/mentor-rdf",
|
|
3
|
-
"description": "A library for working with RDF vocabularies with support for basic RDFS and OWL inference.",
|
|
4
|
-
"keywords": [
|
|
5
|
-
"rdf",
|
|
6
|
-
"rdfs",
|
|
7
|
-
"owl",
|
|
8
|
-
"reasoning",
|
|
9
|
-
"inference",
|
|
10
|
-
"ontology",
|
|
11
|
-
"vocabulary"
|
|
12
|
-
],
|
|
13
|
-
"version": "0.2.
|
|
14
|
-
"private": false,
|
|
15
|
-
"author": {
|
|
16
|
-
"name": "Sebastian Faubel"
|
|
17
|
-
},
|
|
18
|
-
"main": "out/index.js",
|
|
19
|
-
"types": "out/index.d.ts",
|
|
20
|
-
"exports": [
|
|
21
|
-
"./out/index.js"
|
|
22
|
-
],
|
|
23
|
-
"files": [
|
|
24
|
-
"./out"
|
|
25
|
-
],
|
|
26
|
-
"engines": {
|
|
27
|
-
"node": ">=16"
|
|
28
|
-
},
|
|
29
|
-
"repository": {
|
|
30
|
-
"type": "git",
|
|
31
|
-
"url": "https://github.com/faubulous/mentor-rdf.git"
|
|
32
|
-
},
|
|
33
|
-
"bugs": {
|
|
34
|
-
"url": "https://github.com/faubulous/mentor-rdf/issues"
|
|
35
|
-
},
|
|
36
|
-
"license": "GPL",
|
|
37
|
-
"scripts": {
|
|
38
|
-
"prepublish": "npm run build",
|
|
39
|
-
"compile": "tsc -p tsconfig.json",
|
|
40
|
-
"build": "npx webpack build",
|
|
41
|
-
"build:ontologies": "npx ts-node build-ontologies.ts",
|
|
42
|
-
"test": "npx jest",
|
|
43
|
-
"test:coverage": "npx jest --coverage --coverageDirectory=docs/coverage"
|
|
44
|
-
},
|
|
45
|
-
"devDependencies": {
|
|
46
|
-
"@types/jest": "^29.5.4",
|
|
47
|
-
"@types/node": "^20.5.7",
|
|
48
|
-
"@webpack-cli/generators": "^3.0.7",
|
|
49
|
-
"jest": "^29.7.0",
|
|
50
|
-
"jest-environment-node": "^29.6.4",
|
|
51
|
-
"ts-jest": "^29.1.1",
|
|
52
|
-
"ts-loader": "^9.5.0",
|
|
53
|
-
"ts-node": "^10.9.1",
|
|
54
|
-
"ts-node-dev": "^2.0.0",
|
|
55
|
-
"tslib": "^2.6.2",
|
|
56
|
-
"typescript": "^5.6.2",
|
|
57
|
-
"webpack": "^5.94.0",
|
|
58
|
-
"webpack-cli": "^5.1.4"
|
|
59
|
-
},
|
|
60
|
-
"dependencies": {
|
|
61
|
-
"@types/n3": "^1.16.0",
|
|
62
|
-
"millan": "^5.3.0",
|
|
63
|
-
"n3": "^1.17.1",
|
|
64
|
-
"rxjs": "^7.8.1"
|
|
65
|
-
}
|
|
66
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@faubulous/mentor-rdf",
|
|
3
|
+
"description": "A library for working with RDF vocabularies with support for basic RDFS and OWL inference.",
|
|
4
|
+
"keywords": [
|
|
5
|
+
"rdf",
|
|
6
|
+
"rdfs",
|
|
7
|
+
"owl",
|
|
8
|
+
"reasoning",
|
|
9
|
+
"inference",
|
|
10
|
+
"ontology",
|
|
11
|
+
"vocabulary"
|
|
12
|
+
],
|
|
13
|
+
"version": "0.2.50",
|
|
14
|
+
"private": false,
|
|
15
|
+
"author": {
|
|
16
|
+
"name": "Sebastian Faubel"
|
|
17
|
+
},
|
|
18
|
+
"main": "out/index.js",
|
|
19
|
+
"types": "out/index.d.ts",
|
|
20
|
+
"exports": [
|
|
21
|
+
"./out/index.js"
|
|
22
|
+
],
|
|
23
|
+
"files": [
|
|
24
|
+
"./out"
|
|
25
|
+
],
|
|
26
|
+
"engines": {
|
|
27
|
+
"node": ">=16"
|
|
28
|
+
},
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "https://github.com/faubulous/mentor-rdf.git"
|
|
32
|
+
},
|
|
33
|
+
"bugs": {
|
|
34
|
+
"url": "https://github.com/faubulous/mentor-rdf/issues"
|
|
35
|
+
},
|
|
36
|
+
"license": "GPL",
|
|
37
|
+
"scripts": {
|
|
38
|
+
"prepublish": "npm run build",
|
|
39
|
+
"compile": "tsc -p tsconfig.json",
|
|
40
|
+
"build": "npx webpack build",
|
|
41
|
+
"build:ontologies": "npx ts-node build-ontologies.ts",
|
|
42
|
+
"test": "npx jest",
|
|
43
|
+
"test:coverage": "npx jest --coverage --coverageDirectory=docs/coverage"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@types/jest": "^29.5.4",
|
|
47
|
+
"@types/node": "^20.5.7",
|
|
48
|
+
"@webpack-cli/generators": "^3.0.7",
|
|
49
|
+
"jest": "^29.7.0",
|
|
50
|
+
"jest-environment-node": "^29.6.4",
|
|
51
|
+
"ts-jest": "^29.1.1",
|
|
52
|
+
"ts-loader": "^9.5.0",
|
|
53
|
+
"ts-node": "^10.9.1",
|
|
54
|
+
"ts-node-dev": "^2.0.0",
|
|
55
|
+
"tslib": "^2.6.2",
|
|
56
|
+
"typescript": "^5.6.2",
|
|
57
|
+
"webpack": "^5.94.0",
|
|
58
|
+
"webpack-cli": "^5.1.4"
|
|
59
|
+
},
|
|
60
|
+
"dependencies": {
|
|
61
|
+
"@types/n3": "^1.16.0",
|
|
62
|
+
"millan": "^5.3.0",
|
|
63
|
+
"n3": "^1.17.1",
|
|
64
|
+
"rxjs": "^7.8.1"
|
|
65
|
+
}
|
|
66
|
+
}
|
package/out/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,uDAA4B;AAC5B,gDAAqB"}
|
package/out/ontologies/index.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports._xsd = exports.xsd = exports._XSD = exports.XSD = exports._skos = exports.skos = exports._SKOS = exports.SKOS = exports._skos_xl = exports.skos_xl = exports._SKOS_XL = exports.SKOS_XL = exports._sh = exports.sh = exports._SH = exports.SH = exports._rdfs = exports.rdfs = exports._RDFS = exports.RDFS = exports._rdfa = exports.rdfa = exports._RDFA = exports.RDFA = exports._rdf = exports.rdf = exports._RDF = exports.RDF = exports._owl = exports.owl = exports._OWL = exports.OWL = void 0;
|
|
4
|
-
var owl_1 = require("./owl");
|
|
5
|
-
Object.defineProperty(exports, "OWL", { enumerable: true, get: function () { return owl_1.OWL; } });
|
|
6
|
-
Object.defineProperty(exports, "_OWL", { enumerable: true, get: function () { return owl_1._OWL; } });
|
|
7
|
-
Object.defineProperty(exports, "owl", { enumerable: true, get: function () { return owl_1.owl; } });
|
|
8
|
-
Object.defineProperty(exports, "_owl", { enumerable: true, get: function () { return owl_1._owl; } });
|
|
9
|
-
var rdf_1 = require("./rdf");
|
|
10
|
-
Object.defineProperty(exports, "RDF", { enumerable: true, get: function () { return rdf_1.RDF; } });
|
|
11
|
-
Object.defineProperty(exports, "_RDF", { enumerable: true, get: function () { return rdf_1._RDF; } });
|
|
12
|
-
Object.defineProperty(exports, "rdf", { enumerable: true, get: function () { return rdf_1.rdf; } });
|
|
13
|
-
Object.defineProperty(exports, "_rdf", { enumerable: true, get: function () { return rdf_1._rdf; } });
|
|
14
|
-
var rdfa_1 = require("./rdfa");
|
|
15
|
-
Object.defineProperty(exports, "RDFA", { enumerable: true, get: function () { return rdfa_1.RDFA; } });
|
|
16
|
-
Object.defineProperty(exports, "_RDFA", { enumerable: true, get: function () { return rdfa_1._RDFA; } });
|
|
17
|
-
Object.defineProperty(exports, "rdfa", { enumerable: true, get: function () { return rdfa_1.rdfa; } });
|
|
18
|
-
Object.defineProperty(exports, "_rdfa", { enumerable: true, get: function () { return rdfa_1._rdfa; } });
|
|
19
|
-
var rdfs_1 = require("./rdfs");
|
|
20
|
-
Object.defineProperty(exports, "RDFS", { enumerable: true, get: function () { return rdfs_1.RDFS; } });
|
|
21
|
-
Object.defineProperty(exports, "_RDFS", { enumerable: true, get: function () { return rdfs_1._RDFS; } });
|
|
22
|
-
Object.defineProperty(exports, "rdfs", { enumerable: true, get: function () { return rdfs_1.rdfs; } });
|
|
23
|
-
Object.defineProperty(exports, "_rdfs", { enumerable: true, get: function () { return rdfs_1._rdfs; } });
|
|
24
|
-
var sh_1 = require("./sh");
|
|
25
|
-
Object.defineProperty(exports, "SH", { enumerable: true, get: function () { return sh_1.SH; } });
|
|
26
|
-
Object.defineProperty(exports, "_SH", { enumerable: true, get: function () { return sh_1._SH; } });
|
|
27
|
-
Object.defineProperty(exports, "sh", { enumerable: true, get: function () { return sh_1.sh; } });
|
|
28
|
-
Object.defineProperty(exports, "_sh", { enumerable: true, get: function () { return sh_1._sh; } });
|
|
29
|
-
var skos_xl_1 = require("./skos-xl");
|
|
30
|
-
Object.defineProperty(exports, "SKOS_XL", { enumerable: true, get: function () { return skos_xl_1.SKOS_XL; } });
|
|
31
|
-
Object.defineProperty(exports, "_SKOS_XL", { enumerable: true, get: function () { return skos_xl_1._SKOS_XL; } });
|
|
32
|
-
Object.defineProperty(exports, "skos_xl", { enumerable: true, get: function () { return skos_xl_1.skos_xl; } });
|
|
33
|
-
Object.defineProperty(exports, "_skos_xl", { enumerable: true, get: function () { return skos_xl_1._skos_xl; } });
|
|
34
|
-
var skos_1 = require("./skos");
|
|
35
|
-
Object.defineProperty(exports, "SKOS", { enumerable: true, get: function () { return skos_1.SKOS; } });
|
|
36
|
-
Object.defineProperty(exports, "_SKOS", { enumerable: true, get: function () { return skos_1._SKOS; } });
|
|
37
|
-
Object.defineProperty(exports, "skos", { enumerable: true, get: function () { return skos_1.skos; } });
|
|
38
|
-
Object.defineProperty(exports, "_skos", { enumerable: true, get: function () { return skos_1._skos; } });
|
|
39
|
-
var xsd_1 = require("./xsd");
|
|
40
|
-
Object.defineProperty(exports, "XSD", { enumerable: true, get: function () { return xsd_1.XSD; } });
|
|
41
|
-
Object.defineProperty(exports, "_XSD", { enumerable: true, get: function () { return xsd_1._XSD; } });
|
|
42
|
-
Object.defineProperty(exports, "xsd", { enumerable: true, get: function () { return xsd_1.xsd; } });
|
|
43
|
-
Object.defineProperty(exports, "_xsd", { enumerable: true, get: function () { return xsd_1._xsd; } });
|
|
44
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ontologies/index.ts"],"names":[],"mappings":";;;AAAA,6BAA6C;AAApC,0FAAA,GAAG,OAAA;AAAE,2FAAA,IAAI,OAAA;AAAE,0FAAA,GAAG,OAAA;AAAE,2FAAA,IAAI,OAAA;AAC7B,6BAA6C;AAApC,0FAAA,GAAG,OAAA;AAAE,2FAAA,IAAI,OAAA;AAAE,0FAAA,GAAG,OAAA;AAAE,2FAAA,IAAI,OAAA;AAC7B,+BAAkD;AAAzC,4FAAA,IAAI,OAAA;AAAE,6FAAA,KAAK,OAAA;AAAE,4FAAA,IAAI,OAAA;AAAE,6FAAA,KAAK,OAAA;AACjC,+BAAkD;AAAzC,4FAAA,IAAI,OAAA;AAAE,6FAAA,KAAK,OAAA;AAAE,4FAAA,IAAI,OAAA;AAAE,6FAAA,KAAK,OAAA;AACjC,2BAAwC;AAA/B,wFAAA,EAAE,OAAA;AAAE,yFAAA,GAAG,OAAA;AAAE,wFAAA,EAAE,OAAA;AAAE,yFAAA,GAAG,OAAA;AACzB,qCAAiE;AAAxD,kGAAA,OAAO,OAAA;AAAE,mGAAA,QAAQ,OAAA;AAAE,kGAAA,OAAO,OAAA;AAAE,mGAAA,QAAQ,OAAA;AAC7C,+BAAkD;AAAzC,4FAAA,IAAI,OAAA;AAAE,6FAAA,KAAK,OAAA;AAAE,4FAAA,IAAI,OAAA;AAAE,6FAAA,KAAK,OAAA;AACjC,6BAA6C;AAApC,0FAAA,GAAG,OAAA;AAAE,2FAAA,IAAI,OAAA;AAAE,0FAAA,GAAG,OAAA;AAAE,2FAAA,IAAI,OAAA"}
|