@faubulous/mentor-rdf 0.2.16 → 0.2.18
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/ontologies/skos.d.ts +4 -4
- package/out/ontologies/skos.js +4 -4
- package/out/ontologies/skos.js.map +1 -1
- package/out/rdf/class-repository.d.ts +35 -27
- package/out/rdf/class-repository.js +54 -69
- package/out/rdf/class-repository.js.map +1 -1
- package/out/rdf/concept-repository.d.ts +66 -0
- package/out/rdf/concept-repository.js +155 -0
- package/out/rdf/concept-repository.js.map +1 -0
- package/out/rdf/index.d.ts +1 -2
- package/out/rdf/index.js +1 -2
- package/out/rdf/index.js.map +1 -1
- package/out/rdf/individual-repository.js +1 -3
- package/out/rdf/individual-repository.js.map +1 -1
- package/out/rdf/parsers/sparql-syntax-parser.d.ts +1 -1
- package/out/rdf/parsers/sparql-syntax-parser.js +3 -3
- package/out/rdf/parsers/sparql-syntax-parser.js.map +1 -1
- package/out/rdf/parsers/tokenizer.js +1 -1
- package/out/rdf/parsers/tokenizer.js.map +1 -1
- package/out/rdf/property-repository.d.ts +12 -8
- package/out/rdf/property-repository.js +46 -33
- package/out/rdf/property-repository.js.map +1 -1
- package/out/rdf/reasoners/rdfs-reasoner.js +0 -3
- package/out/rdf/reasoners/rdfs-reasoner.js.map +1 -1
- package/out/rdf/reasoners/reasoner.d.ts +1 -1
- package/out/rdf/resource-repository.d.ts +26 -1
- package/out/rdf/resource-repository.js +26 -8
- package/out/rdf/resource-repository.js.map +1 -1
- package/out/rdf/store.d.ts +3 -8
- package/out/rdf/store.js +19 -28
- package/out/rdf/store.js.map +1 -1
- package/out/rdf/tests/helpers.d.ts +0 -18
- package/out/rdf/tests/helpers.js +3 -31
- package/out/rdf/tests/helpers.js.map +1 -1
- package/out/rdf/tests/vocabularies/emmo.d.ts +5521 -0
- package/out/rdf/tests/vocabularies/emmo.js +5526 -0
- package/out/rdf/tests/vocabularies/emmo.js.map +1 -0
- package/out/rdf/tests/vocabularies/fibo-agents.js.map +1 -0
- package/out/rdf/tests/vocabularies/fibo-organization.js.map +1 -0
- package/out/rdf/tests/vocabularies/gist.js.map +1 -0
- package/out/rdf/tests/vocabularies/index.d.ts +12 -0
- package/out/rdf/tests/vocabularies/index.js +40 -0
- package/out/rdf/tests/vocabularies/index.js.map +1 -0
- package/out/rdf/tests/vocabularies/lob.d.ts +5665 -0
- package/out/rdf/tests/vocabularies/lob.js +5670 -0
- package/out/rdf/tests/vocabularies/lob.js.map +1 -0
- package/out/rdf/tests/vocabularies/multi.d.ts +25 -0
- package/out/rdf/tests/vocabularies/multi.js +30 -0
- package/out/rdf/tests/vocabularies/multi.js.map +1 -0
- package/out/rdf/tests/vocabularies/owl.js.map +1 -0
- package/out/rdf/tests/vocabularies/prov-o.d.ts +387 -0
- package/out/rdf/tests/vocabularies/prov-o.js +392 -0
- package/out/rdf/tests/vocabularies/prov-o.js.map +1 -0
- package/out/rdf/tests/vocabularies/schema-nq.d.ts +12075 -0
- package/out/rdf/tests/vocabularies/schema-nq.js +12080 -0
- package/out/rdf/tests/vocabularies/schema-nq.js.map +1 -0
- package/out/rdf/tests/vocabularies/schema-nt.d.ts +12075 -0
- package/out/rdf/tests/vocabularies/schema-nt.js +12080 -0
- package/out/rdf/tests/vocabularies/schema-nt.js.map +1 -0
- package/out/rdf/tests/{ontologies → vocabularies}/schema.d.ts +2 -2
- package/out/rdf/tests/{ontologies → vocabularies}/schema.js +2 -2
- package/out/rdf/tests/vocabularies/schema.js.map +1 -0
- package/out/rdf/tests/{ontologies → vocabularies}/skos.d.ts +4 -4
- package/out/rdf/tests/{ontologies → vocabularies}/skos.js +4 -4
- package/out/rdf/tests/vocabularies/skos.js.map +1 -0
- package/out/rdf/vocabulary-generator.js +74 -44
- package/out/rdf/vocabulary-generator.js.map +1 -1
- package/out/rdf/vocabulary-repository.d.ts +37 -0
- package/out/rdf/{ontology-repository.js → vocabulary-repository.js} +37 -4
- package/out/rdf/vocabulary-repository.js.map +1 -0
- package/package.json +1 -1
- package/out/rdf/ontology-repository.d.ts +0 -18
- package/out/rdf/ontology-repository.js.map +0 -1
- package/out/rdf/store-factory.d.ts +0 -31
- package/out/rdf/store-factory.js +0 -46
- package/out/rdf/store-factory.js.map +0 -1
- package/out/rdf/tests/ontologies/fibo-agents.js.map +0 -1
- package/out/rdf/tests/ontologies/fibo-organization.js.map +0 -1
- package/out/rdf/tests/ontologies/gist.js.map +0 -1
- package/out/rdf/tests/ontologies/index.d.ts +0 -8
- package/out/rdf/tests/ontologies/index.js +0 -12
- package/out/rdf/tests/ontologies/index.js.map +0 -1
- package/out/rdf/tests/ontologies/owl.js.map +0 -1
- package/out/rdf/tests/ontologies/schema.js.map +0 -1
- package/out/rdf/tests/ontologies/skos.js.map +0 -1
- /package/out/rdf/tests/{ontologies → vocabularies}/fibo-agents.d.ts +0 -0
- /package/out/rdf/tests/{ontologies → vocabularies}/fibo-agents.js +0 -0
- /package/out/rdf/tests/{ontologies → vocabularies}/fibo-organization.d.ts +0 -0
- /package/out/rdf/tests/{ontologies → vocabularies}/fibo-organization.js +0 -0
- /package/out/rdf/tests/{ontologies → vocabularies}/gist.d.ts +0 -0
- /package/out/rdf/tests/{ontologies → vocabularies}/gist.js +0 -0
- /package/out/rdf/tests/{ontologies → vocabularies}/owl.d.ts +0 -0
- /package/out/rdf/tests/{ontologies → vocabularies}/owl.js +0 -0
package/out/ontologies/skos.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export declare const SKOS: {
|
|
|
15
15
|
broadMatch: string;
|
|
16
16
|
/** Relates a concept to a concept that is more general in meaning. */
|
|
17
17
|
broader: string;
|
|
18
|
-
/** skos:broaderTransitive is
|
|
18
|
+
/** By convention, skos:broaderTransitive is not used to make assertions. Rather, the properties can be used to draw inferences about the transitive closure of the hierarchical relation, which is useful e.g. when implementing a simple query expansion algorithm in a search application. */
|
|
19
19
|
broaderTransitive: string;
|
|
20
20
|
/** A note about a modification to a concept. */
|
|
21
21
|
changeNote: string;
|
|
@@ -47,7 +47,7 @@ export declare const SKOS: {
|
|
|
47
47
|
narrowMatch: string;
|
|
48
48
|
/** Relates a concept to a concept that is more specific in meaning. */
|
|
49
49
|
narrower: string;
|
|
50
|
-
/** skos:narrowerTransitive is
|
|
50
|
+
/** By convention, skos:narrowerTransitive is not used to make assertions. Rather, the properties can be used to draw inferences about the transitive closure of the hierarchical relation, which is useful e.g. when implementing a simple query expansion algorithm in a search application. */
|
|
51
51
|
narrowerTransitive: string;
|
|
52
52
|
/** A notation, also known as classification code, is a string of characters such as "T58.5" or "303.4833" used to uniquely identify a concept within the scope of a given concept scheme. */
|
|
53
53
|
notation: string;
|
|
@@ -82,7 +82,7 @@ export declare const skos: {
|
|
|
82
82
|
broadMatch: n3.NamedNode<"http://www.w3.org/2004/02/skos/core#broadMatch">;
|
|
83
83
|
/** Relates a concept to a concept that is more general in meaning. */
|
|
84
84
|
broader: n3.NamedNode<"http://www.w3.org/2004/02/skos/core#broader">;
|
|
85
|
-
/** skos:broaderTransitive is
|
|
85
|
+
/** By convention, skos:broaderTransitive is not used to make assertions. Rather, the properties can be used to draw inferences about the transitive closure of the hierarchical relation, which is useful e.g. when implementing a simple query expansion algorithm in a search application. */
|
|
86
86
|
broaderTransitive: n3.NamedNode<"http://www.w3.org/2004/02/skos/core#broaderTransitive">;
|
|
87
87
|
/** A note about a modification to a concept. */
|
|
88
88
|
changeNote: n3.NamedNode<"http://www.w3.org/2004/02/skos/core#changeNote">;
|
|
@@ -114,7 +114,7 @@ export declare const skos: {
|
|
|
114
114
|
narrowMatch: n3.NamedNode<"http://www.w3.org/2004/02/skos/core#narrowMatch">;
|
|
115
115
|
/** Relates a concept to a concept that is more specific in meaning. */
|
|
116
116
|
narrower: n3.NamedNode<"http://www.w3.org/2004/02/skos/core#narrower">;
|
|
117
|
-
/** skos:narrowerTransitive is
|
|
117
|
+
/** By convention, skos:narrowerTransitive is not used to make assertions. Rather, the properties can be used to draw inferences about the transitive closure of the hierarchical relation, which is useful e.g. when implementing a simple query expansion algorithm in a search application. */
|
|
118
118
|
narrowerTransitive: n3.NamedNode<"http://www.w3.org/2004/02/skos/core#narrowerTransitive">;
|
|
119
119
|
/** A notation, also known as classification code, is a string of characters such as "T58.5" or "303.4833" used to uniquely identify a concept within the scope of a given concept scheme. */
|
|
120
120
|
notation: n3.NamedNode<"http://www.w3.org/2004/02/skos/core#notation">;
|
package/out/ontologies/skos.js
CHANGED
|
@@ -19,7 +19,7 @@ exports.SKOS = {
|
|
|
19
19
|
'broadMatch': 'http://www.w3.org/2004/02/skos/core#broadMatch',
|
|
20
20
|
/** Relates a concept to a concept that is more general in meaning. */
|
|
21
21
|
'broader': 'http://www.w3.org/2004/02/skos/core#broader',
|
|
22
|
-
/** skos:broaderTransitive is
|
|
22
|
+
/** By convention, skos:broaderTransitive is not used to make assertions. Rather, the properties can be used to draw inferences about the transitive closure of the hierarchical relation, which is useful e.g. when implementing a simple query expansion algorithm in a search application. */
|
|
23
23
|
'broaderTransitive': 'http://www.w3.org/2004/02/skos/core#broaderTransitive',
|
|
24
24
|
/** A note about a modification to a concept. */
|
|
25
25
|
'changeNote': 'http://www.w3.org/2004/02/skos/core#changeNote',
|
|
@@ -51,7 +51,7 @@ exports.SKOS = {
|
|
|
51
51
|
'narrowMatch': 'http://www.w3.org/2004/02/skos/core#narrowMatch',
|
|
52
52
|
/** Relates a concept to a concept that is more specific in meaning. */
|
|
53
53
|
'narrower': 'http://www.w3.org/2004/02/skos/core#narrower',
|
|
54
|
-
/** skos:narrowerTransitive is
|
|
54
|
+
/** By convention, skos:narrowerTransitive is not used to make assertions. Rather, the properties can be used to draw inferences about the transitive closure of the hierarchical relation, which is useful e.g. when implementing a simple query expansion algorithm in a search application. */
|
|
55
55
|
'narrowerTransitive': 'http://www.w3.org/2004/02/skos/core#narrowerTransitive',
|
|
56
56
|
/** A notation, also known as classification code, is a string of characters such as "T58.5" or "303.4833" used to uniquely identify a concept within the scope of a given concept scheme. */
|
|
57
57
|
'notation': 'http://www.w3.org/2004/02/skos/core#notation',
|
|
@@ -86,7 +86,7 @@ exports.skos = {
|
|
|
86
86
|
'broadMatch': new n3.NamedNode('http://www.w3.org/2004/02/skos/core#broadMatch'),
|
|
87
87
|
/** Relates a concept to a concept that is more general in meaning. */
|
|
88
88
|
'broader': new n3.NamedNode('http://www.w3.org/2004/02/skos/core#broader'),
|
|
89
|
-
/** skos:broaderTransitive is
|
|
89
|
+
/** By convention, skos:broaderTransitive is not used to make assertions. Rather, the properties can be used to draw inferences about the transitive closure of the hierarchical relation, which is useful e.g. when implementing a simple query expansion algorithm in a search application. */
|
|
90
90
|
'broaderTransitive': new n3.NamedNode('http://www.w3.org/2004/02/skos/core#broaderTransitive'),
|
|
91
91
|
/** A note about a modification to a concept. */
|
|
92
92
|
'changeNote': new n3.NamedNode('http://www.w3.org/2004/02/skos/core#changeNote'),
|
|
@@ -118,7 +118,7 @@ exports.skos = {
|
|
|
118
118
|
'narrowMatch': new n3.NamedNode('http://www.w3.org/2004/02/skos/core#narrowMatch'),
|
|
119
119
|
/** Relates a concept to a concept that is more specific in meaning. */
|
|
120
120
|
'narrower': new n3.NamedNode('http://www.w3.org/2004/02/skos/core#narrower'),
|
|
121
|
-
/** skos:narrowerTransitive is
|
|
121
|
+
/** By convention, skos:narrowerTransitive is not used to make assertions. Rather, the properties can be used to draw inferences about the transitive closure of the hierarchical relation, which is useful e.g. when implementing a simple query expansion algorithm in a search application. */
|
|
122
122
|
'narrowerTransitive': new n3.NamedNode('http://www.w3.org/2004/02/skos/core#narrowerTransitive'),
|
|
123
123
|
/** A notation, also known as classification code, is a string of characters such as "T58.5" or "303.4833" used to uniquely identify a concept within the scope of a given concept scheme. */
|
|
124
124
|
'notation': new n3.NamedNode('http://www.w3.org/2004/02/skos/core#notation'),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skos.js","sourceRoot":"","sources":["../../src/ontologies/skos.ts"],"names":[],"mappings":";;;;AAAA,+CAAyB;AAEZ,Q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E,UAAU,EAAE,IAAI,EAAE,CAAC,SAAS,CAAC,8CAA8C,CAAC;IAC5E,iSAAiS;IACjS,oBAAoB,EAAE,IAAI,EAAE,CAAC,SAAS,CAAC,wDAAwD,CAAC;IAChG,6LAA6L;IAC7L,UAAU,EAAE,IAAI,EAAE,CAAC,SAAS,CAAC,8CAA8C,CAAC;IAC5E,uCAAuC;IACvC,MAAM,EAAE,IAAI,EAAE,CAAC,SAAS,CAAC,0CAA0C,CAAC;IACpE,uEAAuE;IACvE,WAAW,EAAE,IAAI,EAAE,CAAC,SAAS,CAAC,+CAA+C,CAAC;IAC9E,+FAA+F;IAC/F,SAAS,EAAE,IAAI,EAAE,CAAC,SAAS,CAAC,6CAA6C,CAAC;IAC1E,oIAAoI;IACpI,cAAc,EAAE,IAAI,EAAE,CAAC,SAAS,CAAC,kDAAkD,CAAC;IACpF,4EAA4E;IAC5E,WAAW,EAAE,IAAI,EAAE,CAAC,SAAS,CAAC,+CAA+C,CAAC;IAC9E,uDAAuD;IACvD,kBAAkB,EAAE,IAAI,EAAE,CAAC,SAAS,CAAC,sDAAsD,CAAC;IAC5F,iFAAiF;IACjF,cAAc,EAAE,IAAI,EAAE,CAAC,SAAS,CAAC,kDAAkD,CAAC;CACpF,CAAA"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { Store } from "./store";
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { ConceptRepository } from "./concept-repository";
|
|
3
|
+
import { DefinitionQueryOptions, QueryOptions } from "./resource-repository";
|
|
4
|
+
/**
|
|
5
|
+
* Common options for class retrieval.
|
|
6
|
+
*/
|
|
7
|
+
interface ClassQueryOptions extends DefinitionQueryOptions {
|
|
4
8
|
/**
|
|
5
9
|
* Indicate if classes what are not defined in the ontology should be included when retrieving classes (default true).
|
|
6
10
|
*/
|
|
@@ -9,20 +13,30 @@ interface ClassRetrievalOptions {
|
|
|
9
13
|
/**
|
|
10
14
|
* A repository for retrieving classes from graphs.
|
|
11
15
|
*/
|
|
12
|
-
export declare class ClassRepository extends
|
|
16
|
+
export declare class ClassRepository extends ConceptRepository {
|
|
13
17
|
constructor(store: Store);
|
|
14
|
-
private
|
|
18
|
+
private _skipClass;
|
|
15
19
|
/**
|
|
16
20
|
* Get all classes in the repository.
|
|
21
|
+
* @param graphUris URIs of the graphs to search, `undefined` for the default graph.
|
|
22
|
+
* @param options Optional query parameters.
|
|
17
23
|
* @returns A list of all classes in the repository.
|
|
18
24
|
*/
|
|
19
|
-
getClasses(graphUris: string | string[] | undefined, options?:
|
|
25
|
+
getClasses(graphUris: string | string[] | undefined, options?: ClassQueryOptions): string[];
|
|
20
26
|
/**
|
|
21
27
|
* Get the super classes of a given class.
|
|
28
|
+
* @param graphUris URIs of the graphs to search, `undefined` for the default graph.
|
|
22
29
|
* @param subjectUri URI of a class.
|
|
30
|
+
* @param options Optional query parameters.
|
|
23
31
|
* @returns An array of super classes of the given class, an empty array if the class has no super classes.
|
|
24
32
|
*/
|
|
25
|
-
getSuperClasses(graphUris: string | string[] | undefined, subjectUri: string, options?:
|
|
33
|
+
getSuperClasses(graphUris: string | string[] | undefined, subjectUri: string, options?: ClassQueryOptions): string[];
|
|
34
|
+
/**
|
|
35
|
+
* Get the first discovered path from a given class to a root class.
|
|
36
|
+
* @param subjectUri URI of a class.
|
|
37
|
+
* @returns A string array containing the first path that is found from the given class to a root class.
|
|
38
|
+
*/
|
|
39
|
+
getRootClassPath(graphUris: string | string[] | undefined, subjectUri: string, options?: ClassQueryOptions): string[];
|
|
26
40
|
/**
|
|
27
41
|
* Recursively find the first path from a given class to a root class.
|
|
28
42
|
* @param subjectUri URI of a class.
|
|
@@ -31,34 +45,30 @@ export declare class ClassRepository extends ResourceRepository {
|
|
|
31
45
|
* @returns The first path that is found from the given class to a root class.
|
|
32
46
|
*/
|
|
33
47
|
private _getRootClassPath;
|
|
34
|
-
/**
|
|
35
|
-
* Get the first discovered path from a given class to a root class.
|
|
36
|
-
* @param subjectUri URI of a class.
|
|
37
|
-
* @returns A string array containing the first path that is found from the given class to a root class.
|
|
38
|
-
*/
|
|
39
|
-
getRootClassPath(graphUris: string | string[] | undefined, subjectUri: string, options?: ClassRetrievalOptions): string[];
|
|
40
48
|
/**
|
|
41
49
|
* Indicate if there are sub classes of a given class.
|
|
42
50
|
* @param subjectUri URI of a class.
|
|
43
51
|
* @returns true if the class has sub classes, false otherwise.
|
|
44
52
|
*/
|
|
45
|
-
hasSubClasses(graphUris: string | string[] | undefined, subjectUri: string, options?:
|
|
53
|
+
hasSubClasses(graphUris: string | string[] | undefined, subjectUri: string, options?: ClassQueryOptions): boolean;
|
|
46
54
|
/**
|
|
47
55
|
* Get the sub classes of a given class or all root classes.
|
|
48
56
|
* @param subjectUri URI of a class or undefined to get all root classes.
|
|
49
57
|
* @returns An array of sub classes of the given class, an empty array if the class has no sub classes.
|
|
50
58
|
*/
|
|
51
|
-
getSubClasses(graphUris: string | string[] | undefined, subjectUri?: string, options?:
|
|
59
|
+
getSubClasses(graphUris: string | string[] | undefined, subjectUri?: string, options?: ClassQueryOptions): string[];
|
|
52
60
|
/**
|
|
53
61
|
* Indicate if a given class is direct or indirect (inferred) sub class of another class.
|
|
62
|
+
* @param graphUris URIs of the graphs to search, `undefined` for the default graph.
|
|
54
63
|
* @param subjectUri URI of a class.
|
|
55
64
|
* @param classUri URI of a class.
|
|
65
|
+
* @param options Optional query parameters.
|
|
56
66
|
* @returns true if the class is a sub class of the other class, false otherwise.
|
|
57
67
|
*/
|
|
58
|
-
isSubClassOf(graphUris: string | string[] | undefined, subjectUri: string, classUri: string): boolean;
|
|
68
|
+
isSubClassOf(graphUris: string | string[] | undefined, subjectUri: string, classUri: string, options?: ClassQueryOptions): boolean;
|
|
59
69
|
/**
|
|
60
70
|
* Indicate if a given class is the intersection of classes.
|
|
61
|
-
* @param graphUris
|
|
71
|
+
* @param graphUris URIs of the graphs to search, `undefined` for the default graph.
|
|
62
72
|
* @param subjectUri URI of a class.
|
|
63
73
|
* @returns `true` if the class is the intersection of classes, `false` otherwise.
|
|
64
74
|
*/
|
|
@@ -66,36 +76,34 @@ export declare class ClassRepository extends ResourceRepository {
|
|
|
66
76
|
private _isIntersectionOfClasses;
|
|
67
77
|
/**
|
|
68
78
|
* Indicate if a given class is a (disjoint) union of classes.
|
|
69
|
-
* @param graphUris
|
|
79
|
+
* @param graphUris URIs of the graphs to search, `undefined` for the default graph.
|
|
70
80
|
* @param subjectUri URI of a class.
|
|
71
81
|
* @returns `true` if the class is a (disjoint) union of classes, `false` otherwise.
|
|
72
82
|
*/
|
|
73
83
|
isUnionOfClasses(graphUris: string | string[] | undefined, subjectUri: string): boolean;
|
|
74
84
|
private _isUnionOfClasses;
|
|
75
|
-
/**
|
|
76
|
-
* Indicate if a given class has property restrictions.
|
|
77
|
-
* @param graphUris Graph URIs to search in, undefined for the default graph.
|
|
78
|
-
* @param subjectUri URI of a class.
|
|
79
|
-
* @returns `true` if the class has property restrictions, `false` otherwise.
|
|
80
|
-
*/
|
|
81
|
-
hasRestrictions(graphUris: string | string[] | undefined, subjectUri: string): boolean;
|
|
82
85
|
/**
|
|
83
86
|
* Get all classes from the repository that have no super classes.
|
|
87
|
+
* @param graphUris URIs of the graphs to search, `undefined` for the default graph.
|
|
88
|
+
* @param options Optional query parameters.
|
|
84
89
|
* @returns An array of root classes in the repository.
|
|
85
90
|
*/
|
|
86
|
-
getRootClasses(graphUris: string | string[] | undefined, options?:
|
|
91
|
+
getRootClasses(graphUris: string | string[] | undefined, options?: ClassQueryOptions): string[];
|
|
87
92
|
/**
|
|
88
93
|
* Indicate if there is an equivalent class of a given class.
|
|
94
|
+
* @param graphUris URIs of the graphs to search, `undefined` for the default graph.
|
|
89
95
|
* @param subjectUri URI of a class.
|
|
96
|
+
* @param options Optional query parameters.
|
|
90
97
|
* @returns `true` if the class has an equivalent class, `false` otherwise.
|
|
91
98
|
*/
|
|
92
|
-
hasEquivalentClass(graphUris: string | string[] | undefined, subjectUri: string): boolean;
|
|
99
|
+
hasEquivalentClass(graphUris: string | string[] | undefined, subjectUri: string, options?: QueryOptions): boolean;
|
|
93
100
|
/**
|
|
94
101
|
* Indicate if a given class has at least one individual defined for it or for one of its sub classes.
|
|
95
102
|
* @param graphUris Graph URIs to search in, undefined for the default graph.
|
|
96
103
|
* @param classUri URI of a class.
|
|
104
|
+
* @param options Optional query parameters.
|
|
97
105
|
* @returns `true` if the class has individuals, `false` otherwise.
|
|
98
106
|
*/
|
|
99
|
-
hasIndividuals(graphUris: string | string[] | undefined, classUri: string): boolean;
|
|
107
|
+
hasIndividuals(graphUris: string | string[] | undefined, classUri: string, options?: ClassQueryOptions): boolean;
|
|
100
108
|
}
|
|
101
109
|
export {};
|
|
@@ -4,16 +4,19 @@ exports.ClassRepository = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const n3 = tslib_1.__importStar(require("n3"));
|
|
6
6
|
const ontologies_1 = require("../ontologies");
|
|
7
|
-
const
|
|
7
|
+
const concept_repository_1 = require("./concept-repository");
|
|
8
8
|
/**
|
|
9
9
|
* A repository for retrieving classes from graphs.
|
|
10
10
|
*/
|
|
11
|
-
class ClassRepository extends
|
|
11
|
+
class ClassRepository extends concept_repository_1.ConceptRepository {
|
|
12
12
|
constructor(store) { super(store); }
|
|
13
|
-
|
|
13
|
+
_skipClass(graphUris, node, options) {
|
|
14
14
|
if (node.termType != "NamedNode") {
|
|
15
15
|
return true;
|
|
16
16
|
}
|
|
17
|
+
if ((options === null || options === void 0 ? void 0 : options.definedBy) !== undefined) {
|
|
18
|
+
return !this.isDefinedBy(graphUris, node, options.definedBy);
|
|
19
|
+
}
|
|
17
20
|
if ((options === null || options === void 0 ? void 0 : options.includeReferencedClasses) === false && !this.hasSubject(graphUris, node.value)) {
|
|
18
21
|
return true;
|
|
19
22
|
}
|
|
@@ -21,36 +24,46 @@ class ClassRepository extends resource_repository_1.ResourceRepository {
|
|
|
21
24
|
}
|
|
22
25
|
/**
|
|
23
26
|
* Get all classes in the repository.
|
|
27
|
+
* @param graphUris URIs of the graphs to search, `undefined` for the default graph.
|
|
28
|
+
* @param options Optional query parameters.
|
|
24
29
|
* @returns A list of all classes in the repository.
|
|
25
30
|
*/
|
|
26
31
|
getClasses(graphUris, options) {
|
|
27
32
|
const result = new Set();
|
|
28
|
-
for (let q of this.store.match(graphUris, null, ontologies_1.rdf.type, ontologies_1.rdfs.Class)) {
|
|
33
|
+
for (let q of this.store.match(graphUris, null, ontologies_1.rdf.type, ontologies_1.rdfs.Class, options === null || options === void 0 ? void 0 : options.includeInferred)) {
|
|
29
34
|
const s = q.subject;
|
|
30
|
-
if (this.
|
|
31
|
-
|
|
35
|
+
if (!this._skipClass(graphUris, s, options)) {
|
|
36
|
+
result.add(s.value);
|
|
32
37
|
}
|
|
33
|
-
result.add(s.value);
|
|
34
38
|
}
|
|
35
39
|
return Array.from(result);
|
|
36
40
|
}
|
|
37
41
|
/**
|
|
38
42
|
* Get the super classes of a given class.
|
|
43
|
+
* @param graphUris URIs of the graphs to search, `undefined` for the default graph.
|
|
39
44
|
* @param subjectUri URI of a class.
|
|
45
|
+
* @param options Optional query parameters.
|
|
40
46
|
* @returns An array of super classes of the given class, an empty array if the class has no super classes.
|
|
41
47
|
*/
|
|
42
48
|
getSuperClasses(graphUris, subjectUri, options) {
|
|
43
49
|
const result = new Set();
|
|
44
50
|
const s = n3.DataFactory.namedNode(subjectUri);
|
|
45
|
-
for (let q of this.store.match(graphUris, s, ontologies_1.rdfs.subClassOf, null)) {
|
|
51
|
+
for (let q of this.store.match(graphUris, s, ontologies_1.rdfs.subClassOf, null, options === null || options === void 0 ? void 0 : options.includeInferred)) {
|
|
46
52
|
const o = q.object;
|
|
47
|
-
if (this.
|
|
48
|
-
|
|
53
|
+
if (!this._skipClass(graphUris, o, options)) {
|
|
54
|
+
result.add(o.value);
|
|
49
55
|
}
|
|
50
|
-
result.add(o.value);
|
|
51
56
|
}
|
|
52
57
|
return Array.from(result);
|
|
53
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Get the first discovered path from a given class to a root class.
|
|
61
|
+
* @param subjectUri URI of a class.
|
|
62
|
+
* @returns A string array containing the first path that is found from the given class to a root class.
|
|
63
|
+
*/
|
|
64
|
+
getRootClassPath(graphUris, subjectUri, options) {
|
|
65
|
+
return this._getRootClassPath(graphUris, subjectUri, [], new Set(), options);
|
|
66
|
+
}
|
|
54
67
|
/**
|
|
55
68
|
* Recursively find the first path from a given class to a root class.
|
|
56
69
|
* @param subjectUri URI of a class.
|
|
@@ -65,14 +78,6 @@ class ClassRepository extends resource_repository_1.ResourceRepository {
|
|
|
65
78
|
}
|
|
66
79
|
return path;
|
|
67
80
|
}
|
|
68
|
-
/**
|
|
69
|
-
* Get the first discovered path from a given class to a root class.
|
|
70
|
-
* @param subjectUri URI of a class.
|
|
71
|
-
* @returns A string array containing the first path that is found from the given class to a root class.
|
|
72
|
-
*/
|
|
73
|
-
getRootClassPath(graphUris, subjectUri, options) {
|
|
74
|
-
return this._getRootClassPath(graphUris, subjectUri, [], new Set(), options);
|
|
75
|
-
}
|
|
76
81
|
/**
|
|
77
82
|
* Indicate if there are sub classes of a given class.
|
|
78
83
|
* @param subjectUri URI of a class.
|
|
@@ -81,10 +86,7 @@ class ClassRepository extends resource_repository_1.ResourceRepository {
|
|
|
81
86
|
hasSubClasses(graphUris, subjectUri, options) {
|
|
82
87
|
const o = n3.DataFactory.namedNode(subjectUri);
|
|
83
88
|
for (let _q of this.store.match(graphUris, null, ontologies_1.rdfs.subClassOf, o)) {
|
|
84
|
-
if (this.
|
|
85
|
-
continue;
|
|
86
|
-
}
|
|
87
|
-
else {
|
|
89
|
+
if (!this._skipClass(graphUris, _q.subject, options)) {
|
|
88
90
|
return true;
|
|
89
91
|
}
|
|
90
92
|
}
|
|
@@ -99,12 +101,11 @@ class ClassRepository extends resource_repository_1.ResourceRepository {
|
|
|
99
101
|
if (subjectUri) {
|
|
100
102
|
const result = new Set();
|
|
101
103
|
const o = n3.DataFactory.namedNode(subjectUri);
|
|
102
|
-
for (let q of this.store.match(graphUris, null, ontologies_1.rdfs.subClassOf, o)) {
|
|
104
|
+
for (let q of this.store.match(graphUris, null, ontologies_1.rdfs.subClassOf, o, options === null || options === void 0 ? void 0 : options.includeInferred)) {
|
|
103
105
|
const s = q.subject;
|
|
104
|
-
if (this.
|
|
105
|
-
|
|
106
|
+
if (!this._skipClass(graphUris, s, options)) {
|
|
107
|
+
result.add(s.value);
|
|
106
108
|
}
|
|
107
|
-
result.add(s.value);
|
|
108
109
|
}
|
|
109
110
|
return Array.from(result);
|
|
110
111
|
}
|
|
@@ -114,16 +115,18 @@ class ClassRepository extends resource_repository_1.ResourceRepository {
|
|
|
114
115
|
}
|
|
115
116
|
/**
|
|
116
117
|
* Indicate if a given class is direct or indirect (inferred) sub class of another class.
|
|
118
|
+
* @param graphUris URIs of the graphs to search, `undefined` for the default graph.
|
|
117
119
|
* @param subjectUri URI of a class.
|
|
118
120
|
* @param classUri URI of a class.
|
|
121
|
+
* @param options Optional query parameters.
|
|
119
122
|
* @returns true if the class is a sub class of the other class, false otherwise.
|
|
120
123
|
*/
|
|
121
|
-
isSubClassOf(graphUris, subjectUri, classUri) {
|
|
122
|
-
return this.getRootClassPath(graphUris, subjectUri).includes(classUri);
|
|
124
|
+
isSubClassOf(graphUris, subjectUri, classUri, options) {
|
|
125
|
+
return this.getRootClassPath(graphUris, subjectUri, options).includes(classUri);
|
|
123
126
|
}
|
|
124
127
|
/**
|
|
125
128
|
* Indicate if a given class is the intersection of classes.
|
|
126
|
-
* @param graphUris
|
|
129
|
+
* @param graphUris URIs of the graphs to search, `undefined` for the default graph.
|
|
127
130
|
* @param subjectUri URI of a class.
|
|
128
131
|
* @returns `true` if the class is the intersection of classes, `false` otherwise.
|
|
129
132
|
*/
|
|
@@ -132,7 +135,8 @@ class ClassRepository extends resource_repository_1.ResourceRepository {
|
|
|
132
135
|
if (this._isIntersectionOfClasses(graphUris, s)) {
|
|
133
136
|
return true;
|
|
134
137
|
}
|
|
135
|
-
|
|
138
|
+
// Note: The intersection must be defined in the original graphs, so inference is not required.
|
|
139
|
+
for (let q of this.store.match(graphUris, s, ontologies_1.owl.equivalentClass, null, false)) {
|
|
136
140
|
if (this._isIntersectionOfClasses(graphUris, q.object)) {
|
|
137
141
|
return true;
|
|
138
142
|
}
|
|
@@ -141,7 +145,7 @@ class ClassRepository extends resource_repository_1.ResourceRepository {
|
|
|
141
145
|
}
|
|
142
146
|
_isIntersectionOfClasses(graphUris, subject) {
|
|
143
147
|
if (subject instanceof n3.BlankNode || subject instanceof n3.NamedNode) {
|
|
144
|
-
for (let _ of this.store.match(graphUris, subject, ontologies_1.owl.intersectionOf)) {
|
|
148
|
+
for (let _ of this.store.match(graphUris, subject, ontologies_1.owl.intersectionOf, null, false)) {
|
|
145
149
|
return true;
|
|
146
150
|
}
|
|
147
151
|
}
|
|
@@ -149,7 +153,7 @@ class ClassRepository extends resource_repository_1.ResourceRepository {
|
|
|
149
153
|
}
|
|
150
154
|
/**
|
|
151
155
|
* Indicate if a given class is a (disjoint) union of classes.
|
|
152
|
-
* @param graphUris
|
|
156
|
+
* @param graphUris URIs of the graphs to search, `undefined` for the default graph.
|
|
153
157
|
* @param subjectUri URI of a class.
|
|
154
158
|
* @returns `true` if the class is a (disjoint) union of classes, `false` otherwise.
|
|
155
159
|
*/
|
|
@@ -158,7 +162,8 @@ class ClassRepository extends resource_repository_1.ResourceRepository {
|
|
|
158
162
|
if (this._isUnionOfClasses(graphUris, s)) {
|
|
159
163
|
return true;
|
|
160
164
|
}
|
|
161
|
-
|
|
165
|
+
// Note: The union must be defined in the original graphs, so inference is not required.
|
|
166
|
+
for (let q of this.store.match(graphUris, s, ontologies_1.owl.equivalentClass, null, false)) {
|
|
162
167
|
if (this._isUnionOfClasses(graphUris, q.object)) {
|
|
163
168
|
return true;
|
|
164
169
|
}
|
|
@@ -167,41 +172,19 @@ class ClassRepository extends resource_repository_1.ResourceRepository {
|
|
|
167
172
|
}
|
|
168
173
|
_isUnionOfClasses(graphUris, subject) {
|
|
169
174
|
if (subject instanceof n3.BlankNode || subject instanceof n3.NamedNode) {
|
|
170
|
-
for (let _ of this.store.match(graphUris, subject, ontologies_1.owl.unionOf)) {
|
|
175
|
+
for (let _ of this.store.match(graphUris, subject, ontologies_1.owl.unionOf, null, false)) {
|
|
171
176
|
return true;
|
|
172
177
|
}
|
|
173
|
-
for (let _ of this.store.match(graphUris, subject, ontologies_1.owl.disjointUnionOf)) {
|
|
178
|
+
for (let _ of this.store.match(graphUris, subject, ontologies_1.owl.disjointUnionOf, null, false)) {
|
|
174
179
|
return true;
|
|
175
180
|
}
|
|
176
181
|
}
|
|
177
182
|
return false;
|
|
178
183
|
}
|
|
179
|
-
/**
|
|
180
|
-
* Indicate if a given class has property restrictions.
|
|
181
|
-
* @param graphUris Graph URIs to search in, undefined for the default graph.
|
|
182
|
-
* @param subjectUri URI of a class.
|
|
183
|
-
* @returns `true` if the class has property restrictions, `false` otherwise.
|
|
184
|
-
*/
|
|
185
|
-
hasRestrictions(graphUris, subjectUri) {
|
|
186
|
-
const s = n3.DataFactory.namedNode(subjectUri);
|
|
187
|
-
for (let q of this.store.match(graphUris, s, ontologies_1.owl.equivalentClass)) {
|
|
188
|
-
if (q.object instanceof n3.BlankNode || q.object instanceof n3.NamedNode) {
|
|
189
|
-
for (let _ of this.store.match(graphUris, q.object, ontologies_1.rdf.type, ontologies_1.owl.Restriction)) {
|
|
190
|
-
return true;
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
for (let q of this.store.match(graphUris, s, ontologies_1.rdfs.subClassOf)) {
|
|
195
|
-
if (q.object instanceof n3.BlankNode || q.object instanceof n3.NamedNode) {
|
|
196
|
-
for (let _ of this.store.match(graphUris, q.object, ontologies_1.rdf.type, ontologies_1.owl.Restriction)) {
|
|
197
|
-
return true;
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
return false;
|
|
202
|
-
}
|
|
203
184
|
/**
|
|
204
185
|
* Get all classes from the repository that have no super classes.
|
|
186
|
+
* @param graphUris URIs of the graphs to search, `undefined` for the default graph.
|
|
187
|
+
* @param options Optional query parameters.
|
|
205
188
|
* @returns An array of root classes in the repository.
|
|
206
189
|
*/
|
|
207
190
|
getRootClasses(graphUris, options) {
|
|
@@ -210,16 +193,15 @@ class ClassRepository extends resource_repository_1.ResourceRepository {
|
|
|
210
193
|
// 1. Get all classes that are defined in the ontology.
|
|
211
194
|
for (let q of this.store.match(graphUris, null, ontologies_1.rdf.type, ontologies_1.rdfs.Class)) {
|
|
212
195
|
const s = q.subject;
|
|
213
|
-
if (this.
|
|
214
|
-
|
|
196
|
+
if (!this._skipClass(graphUris, s, options)) {
|
|
197
|
+
classes.add(s.value);
|
|
215
198
|
}
|
|
216
|
-
classes.add(s.value);
|
|
217
199
|
}
|
|
218
200
|
// 2. Get all classes that have a sub class relationship.
|
|
219
201
|
for (let q of this.store.match(graphUris, null, ontologies_1.rdfs.subClassOf, null)) {
|
|
220
202
|
const s = q.subject;
|
|
221
203
|
const o = q.object;
|
|
222
|
-
if (this.
|
|
204
|
+
if (this._skipClass(graphUris, s, options) || this._skipClass(graphUris, o, options)) {
|
|
223
205
|
continue;
|
|
224
206
|
}
|
|
225
207
|
classes.add(s.value);
|
|
@@ -230,13 +212,15 @@ class ClassRepository extends resource_repository_1.ResourceRepository {
|
|
|
230
212
|
}
|
|
231
213
|
/**
|
|
232
214
|
* Indicate if there is an equivalent class of a given class.
|
|
215
|
+
* @param graphUris URIs of the graphs to search, `undefined` for the default graph.
|
|
233
216
|
* @param subjectUri URI of a class.
|
|
217
|
+
* @param options Optional query parameters.
|
|
234
218
|
* @returns `true` if the class has an equivalent class, `false` otherwise.
|
|
235
219
|
*/
|
|
236
|
-
hasEquivalentClass(graphUris, subjectUri) {
|
|
220
|
+
hasEquivalentClass(graphUris, subjectUri, options) {
|
|
237
221
|
const s = n3.DataFactory.namedNode(subjectUri);
|
|
238
222
|
// The OWL resoner will assert the equivalent class relationship in both directions.
|
|
239
|
-
for (let _ of this.store.match(graphUris, s, ontologies_1.owl.equivalentClass, null)) {
|
|
223
|
+
for (let _ of this.store.match(graphUris, s, ontologies_1.owl.equivalentClass, null, options === null || options === void 0 ? void 0 : options.includeInferred)) {
|
|
240
224
|
return true;
|
|
241
225
|
}
|
|
242
226
|
return false;
|
|
@@ -245,16 +229,17 @@ class ClassRepository extends resource_repository_1.ResourceRepository {
|
|
|
245
229
|
* Indicate if a given class has at least one individual defined for it or for one of its sub classes.
|
|
246
230
|
* @param graphUris Graph URIs to search in, undefined for the default graph.
|
|
247
231
|
* @param classUri URI of a class.
|
|
232
|
+
* @param options Optional query parameters.
|
|
248
233
|
* @returns `true` if the class has individuals, `false` otherwise.
|
|
249
234
|
*/
|
|
250
|
-
hasIndividuals(graphUris, classUri) {
|
|
235
|
+
hasIndividuals(graphUris, classUri, options) {
|
|
251
236
|
const s = n3.DataFactory.namedNode(classUri);
|
|
252
|
-
for (let q of this.store.match(graphUris, null, ontologies_1.rdf.type, s)) {
|
|
237
|
+
for (let q of this.store.match(graphUris, null, ontologies_1.rdf.type, s, options === null || options === void 0 ? void 0 : options.includeInferred)) {
|
|
253
238
|
if (q.subject.termType == "NamedNode") {
|
|
254
239
|
return true;
|
|
255
240
|
}
|
|
256
241
|
}
|
|
257
|
-
for (let c of this.getSubClasses(graphUris, classUri)) {
|
|
242
|
+
for (let c of this.getSubClasses(graphUris, classUri, options)) {
|
|
258
243
|
if (this.hasIndividuals(graphUris, c)) {
|
|
259
244
|
return true;
|
|
260
245
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"class-repository.js","sourceRoot":"","sources":["../../src/rdf/class-repository.ts"],"names":[],"mappings":";;;;AAAA,+CAAyB;AAEzB,8CAA+C;AAE/C
|
|
1
|
+
{"version":3,"file":"class-repository.js","sourceRoot":"","sources":["../../src/rdf/class-repository.ts"],"names":[],"mappings":";;;;AAAA,+CAAyB;AAEzB,8CAA+C;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AC,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,EAAE,gBAAG,CAAC,eAAe,EAAE,IAAI,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,eAAe,CAAC,EAAE;YAC/F,OAAO,IAAI,CAAC;SACf;QAED,OAAO,KAAK,CAAC;IACjB,CAAC;IAED;;;;;;OAMG;IACI,cAAc,CAAC,SAAwC,EAAE,QAAgB,EAAE,OAA2B;QACzG,MAAM,CAAC,GAAG,EAAE,CAAC,WAAW,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QAE7C,KAAK,IAAI,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,EAAE,IAAI,EAAE,gBAAG,CAAC,IAAI,EAAE,CAAC,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,eAAe,CAAC,EAAE;YACpF,IAAI,CAAC,CAAC,OAAO,CAAC,QAAQ,IAAI,WAAW,EAAE;gBACnC,OAAO,IAAI,CAAC;aACf;SACJ;QAED,KAAK,IAAI,CAAC,IAAI,IAAI,CAAC,aAAa,CAAC,SAAS,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE;YAC5D,IAAI,IAAI,CAAC,cAAc,CAAC,SAAS,EAAE,CAAC,CAAC,EAAE;gBACnC,OAAO,IAAI,CAAC;aACf;SACJ;QAED,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ;AAjSD,0CAiSC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { ResourceRepository } from "./resource-repository";
|
|
2
|
+
export declare class ConceptRepository extends ResourceRepository {
|
|
3
|
+
/**
|
|
4
|
+
* Get all concepts.
|
|
5
|
+
* @param graphUris URIs of the graphs to search for concepts.
|
|
6
|
+
*/
|
|
7
|
+
getConcepts(graphUris: string | string[] | undefined): string[];
|
|
8
|
+
/**
|
|
9
|
+
* Get all concept schemes.
|
|
10
|
+
* @param graphUris URIs of the graphs to search for concepts.
|
|
11
|
+
*/
|
|
12
|
+
getConceptSchemes(graphUris: string | string[] | undefined): string[];
|
|
13
|
+
/**
|
|
14
|
+
* Get all broader concepts of a concept scheme.
|
|
15
|
+
* @param graphUris URIs of the graphs to search for concepts.
|
|
16
|
+
* @param subjectUri URI of a concept scheme.
|
|
17
|
+
*/
|
|
18
|
+
getBroaderConcepts(graphUris: string | string[] | undefined, subjectUri: string): string[];
|
|
19
|
+
/**
|
|
20
|
+
* Indicates whether a concept has broader concepts.
|
|
21
|
+
* @param graphUris URIs of the graphs to search for concepts.
|
|
22
|
+
* @param subjectUri URI of a concept.
|
|
23
|
+
*/
|
|
24
|
+
hasBroaderConcepts(graphUris: string | string[] | undefined, subjectUri: string): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Get all narrower concepts of a concept or top concepts of a concept scheme.
|
|
27
|
+
* @param graphUris URIs of the graphs to search for concepts.
|
|
28
|
+
* @param subjectUri URI of a concept or concept scheme.
|
|
29
|
+
*/
|
|
30
|
+
getNarrowerConcepts(graphUris: string | string[] | undefined, subjectUri?: string): string[];
|
|
31
|
+
/**
|
|
32
|
+
* Indicates whether a concept has narrower concepts.
|
|
33
|
+
* @param graphUris URIs of the graphs to search for concepts.
|
|
34
|
+
* @param subjectUri URI of a concept.
|
|
35
|
+
*/
|
|
36
|
+
hasNarrowerConcepts(graphUris: string | string[] | undefined, subjectUri: string): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Indicates whether a concept is a narrower concept of another concept.
|
|
39
|
+
* @param graphUris URIs of the graphs to search for concepts.
|
|
40
|
+
* @param subjectUri URI of a concept.
|
|
41
|
+
* @param broaderUri URI of a broader concept.
|
|
42
|
+
* @returns `true` if the concept is a narrower concept of the broader concept, `false` otherwise.
|
|
43
|
+
*/
|
|
44
|
+
isNarrowerConceptOf(graphUris: string | string[] | undefined, subjectUri: string, broaderUri: string): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Indicates whether a subject is a concept scheme.
|
|
47
|
+
* @param graphUris URIs of the graphs to search for concepts.
|
|
48
|
+
* @param subjectUri URI of a subject.
|
|
49
|
+
* @returns `true` if the subject is a concept scheme, `false` otherwise.
|
|
50
|
+
*/
|
|
51
|
+
isConceptScheme(graphUris: string | string[] | undefined, subjectUri: string): boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Get all broader concepts up to and including a concept scheme.
|
|
54
|
+
* @param graphUris URIs of the graphs to search for concepts.
|
|
55
|
+
* @param subjectUri URI of a concept.
|
|
56
|
+
*/
|
|
57
|
+
getConceptSchemePath(graphUris: string | string[] | undefined, subjectUri: string): string[];
|
|
58
|
+
/**
|
|
59
|
+
* Recursively find the first path from a given class to a root class.
|
|
60
|
+
* @param subjectUri URI of a class.
|
|
61
|
+
* @param path The current class path.
|
|
62
|
+
* @param backtrack Set of URIs that have already been visited.
|
|
63
|
+
* @returns The first path that is found from the given class to a root class.
|
|
64
|
+
*/
|
|
65
|
+
private _getConceptSchemePath;
|
|
66
|
+
}
|