@faubulous/mentor-rdf 2.1.4 → 2.1.6
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/dist/index.js
CHANGED
|
@@ -4224,21 +4224,30 @@ var PropertyRepository = class extends ClassRepository {
|
|
|
4224
4224
|
if (hasSuperProperty) {
|
|
4225
4225
|
continue;
|
|
4226
4226
|
}
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
const t = Array.from(this.store.matchAll(graphUris, q.subject, rdf.type, null, options?.includeInferred)).map((q2) => q2.object.value);
|
|
4230
|
-
if (new Set(t).size == 1) {
|
|
4231
|
-
shouldYield = true;
|
|
4232
|
-
}
|
|
4233
|
-
} else {
|
|
4234
|
-
shouldYield = true;
|
|
4227
|
+
if (typeUri === RDF.Property && this._hasSpecificType(graphUris, q.subject)) {
|
|
4228
|
+
continue;
|
|
4235
4229
|
}
|
|
4236
|
-
if (
|
|
4230
|
+
if (!yielded.has(q.subject.value)) {
|
|
4237
4231
|
yielded.add(q.subject.value);
|
|
4238
4232
|
yield q.subject.value;
|
|
4239
4233
|
}
|
|
4240
4234
|
}
|
|
4241
4235
|
}
|
|
4236
|
+
/**
|
|
4237
|
+
* Indicate whether a property is stated to be of a type that is more specific than rdf:Property.
|
|
4238
|
+
* Only asserted types are taken into account, because every property is an inferred rdf:Property.
|
|
4239
|
+
* @param graphUris URI of the graph or an array of graphs to search.
|
|
4240
|
+
* @param property The node of a property.
|
|
4241
|
+
* @returns `true` if the property has a more specific asserted type, `false` otherwise.
|
|
4242
|
+
*/
|
|
4243
|
+
_hasSpecificType(graphUris, property) {
|
|
4244
|
+
for (let q of this.store.matchAll(graphUris, property, rdf.type, null, false)) {
|
|
4245
|
+
if (q.object.value !== RDF.Property) {
|
|
4246
|
+
return true;
|
|
4247
|
+
}
|
|
4248
|
+
}
|
|
4249
|
+
return false;
|
|
4250
|
+
}
|
|
4242
4251
|
/**
|
|
4243
4252
|
* Get the super properties of a given property.
|
|
4244
4253
|
* @param subjectUri URI of a property.
|
|
@@ -4807,10 +4816,22 @@ var RdfsReasoner = class extends SkosReasoner {
|
|
|
4807
4816
|
this.store.add(quad2(subject, rdf.type, rdf.Property, this.targetGraph));
|
|
4808
4817
|
this.properties.add(subject.value);
|
|
4809
4818
|
}
|
|
4819
|
+
/**
|
|
4820
|
+
* Assert that a predicate denotes a property (RDFS entailment rule rdf1). Predicates of the
|
|
4821
|
+
* W3C vocabularies are left out, mirroring how classes are inferred from usage.
|
|
4822
|
+
* @param predicate The predicate of a statement.
|
|
4823
|
+
*/
|
|
4824
|
+
assertPropertyFromUsage(predicate) {
|
|
4825
|
+
if (predicate.termType != "NamedNode" || this.isW3CNode(predicate)) {
|
|
4826
|
+
return;
|
|
4827
|
+
}
|
|
4828
|
+
this.assertProperty(predicate);
|
|
4829
|
+
}
|
|
4810
4830
|
inferPropertyAxioms(quad5) {
|
|
4811
4831
|
let s = quad5.subject;
|
|
4812
4832
|
let p = quad5.predicate;
|
|
4813
4833
|
let o = quad5.object.termType != "Literal" ? quad5.object : void 0;
|
|
4834
|
+
this.assertPropertyFromUsage(p);
|
|
4814
4835
|
if (!o) {
|
|
4815
4836
|
return;
|
|
4816
4837
|
}
|