@faubulous/mentor-rdf 1.0.1 → 1.1.0

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 (37) hide show
  1. package/README.md +51 -2
  2. package/dist/index.js +888 -737
  3. package/dist/index.js.map +4 -4
  4. package/dist/ontologies/dcat.d.ts +57 -57
  5. package/dist/ontologies/owl.d.ts +79 -79
  6. package/dist/ontologies/rdf.d.ts +24 -24
  7. package/dist/ontologies/rdfa.d.ts +23 -23
  8. package/dist/ontologies/rdfs.d.ts +17 -17
  9. package/dist/ontologies/sh.d.ts +223 -223
  10. package/dist/ontologies/skos-xl.d.ts +9 -9
  11. package/dist/ontologies/skos.d.ts +35 -35
  12. package/dist/ontologies/xsd.d.ts +26 -26
  13. package/dist/rdf/data-factory.d.ts +131 -0
  14. package/dist/rdf/index.d.ts +1 -0
  15. package/dist/rdf/property-repository.d.ts +2 -3
  16. package/dist/rdf/store.d.ts +5 -1
  17. package/dist/rdf/tests/vocabularies/bfo.d.ts +103 -103
  18. package/dist/rdf/tests/vocabularies/cidoc-crm.d.ts +387 -387
  19. package/dist/rdf/tests/vocabularies/dcat.d.ts +57 -57
  20. package/dist/rdf/tests/vocabularies/emmo.d.ts +2398 -2398
  21. package/dist/rdf/tests/vocabularies/fibo-agents.d.ts +4 -4
  22. package/dist/rdf/tests/vocabularies/fibo-organization.d.ts +17 -17
  23. package/dist/rdf/tests/vocabularies/gist.d.ts +268 -268
  24. package/dist/rdf/tests/vocabularies/i18n.d.ts +7 -7
  25. package/dist/rdf/tests/vocabularies/lob.d.ts +1428 -1428
  26. package/dist/rdf/tests/vocabularies/mentor.d.ts +5 -5
  27. package/dist/rdf/tests/vocabularies/multi.d.ts +11 -11
  28. package/dist/rdf/tests/vocabularies/org.d.ts +49 -49
  29. package/dist/rdf/tests/vocabularies/owl.d.ts +79 -79
  30. package/dist/rdf/tests/vocabularies/prov-o.d.ts +103 -103
  31. package/dist/rdf/tests/vocabularies/schema-nq.d.ts +2823 -2823
  32. package/dist/rdf/tests/vocabularies/schema-nt.d.ts +2823 -2823
  33. package/dist/rdf/tests/vocabularies/schema.d.ts +2823 -2823
  34. package/dist/rdf/tests/vocabularies/shapes.d.ts +23 -23
  35. package/dist/rdf/tests/vocabularies/skos.d.ts +35 -35
  36. package/dist/rdf/tests/vocabularies/unesco.d.ts +4588 -4588
  37. package/package.json +2 -2
package/README.md CHANGED
@@ -1,14 +1,63 @@
1
1
  # Mentor RDF API
2
2
 
3
- A library for working with RDF vocabularies based on the [N3.js](https://github.com/rdfjs/N3.js#readme) library. It provides basic OWL and RDFS inference for retrieving classes, propertis and individuals.
3
+ A TypeScript library for working with RDF vocabularies in Node.js and browsers. It powers the [Mentor](https://github.com/faubulous/mentor-vscode) VS Code extension, providing structured access to ontologies through a repository pattern and lightweight structural reasoning.
4
4
 
5
5
  - [API Documentation](https://faubulous.github.io/mentor-rdf/)
6
6
  - [Test Coverage](https://faubulous.github.io/mentor-rdf/coverage/)
7
7
 
8
+ ## Features
9
+
10
+ ### Repository Pattern
11
+ Access RDF resources through specialized repositories that provide type-safe, SPARQL-free querying:
12
+
13
+ - **VocabularyRepository** – Query ontologies and SKOS concept schemes
14
+ - **ClassRepository** – Retrieve OWL/RDFS classes with hierarchy traversal
15
+ - **PropertyRepository** – Access object, datatype, and annotation properties
16
+ - **IndividualRepository** – Query class instances and their properties
17
+ - **ShapeRepository** – Work with SHACL node and property shapes
18
+
19
+ ### Structural Reasoning
20
+ Built-in reasoners expand your RDF graphs with inferred triples:
21
+
22
+ - **RdfsReasoner** – `rdfs:subClassOf`, `rdfs:subPropertyOf`, domain/range inference
23
+ - **OwlReasoner** – OWL class expressions, property characteristics, equivalences
24
+ - **SkosReasoner** – SKOS concept hierarchies and semantic relations
25
+ - **ShaclReasoner** – SHACL shape target inference
26
+
27
+ ### RDF Store
28
+ An [RDF.js](https://rdf.js.org/)-compatible triple store with:
29
+
30
+ - Multiple format support: Turtle, N3, N-Triples, N-Quads, TriG, RDF/XML
31
+ - Named graph management
32
+ - Bundled W3C ontologies (RDF, RDFS, OWL, SKOS, SHACL, XSD)
33
+
8
34
  ## Installation
9
35
 
10
- For Node.js, Mentor RDF comes as an [npm package](https://npmjs.org/package/n3).
36
+ Works in Node.js (>=16) and modern browsers:
11
37
 
12
38
  ```bash
13
39
  npm install @faubulous/mentor-rdf
40
+ ```
41
+
42
+ ## Quick Start
43
+
44
+ ```typescript
45
+ import { Store, VocabularyRepository, OwlReasoner } from '@faubulous/mentor-rdf';
46
+
47
+ // Create a store with OWL reasoning
48
+ const store = new Store(new OwlReasoner());
49
+
50
+ // Load an ontology
51
+ await store.loadFromTurtleStream(turtleData, 'http://example.org/my-ontology');
52
+
53
+ // Query using repositories
54
+ const repository = new VocabularyRepository(store);
55
+
56
+ // Get all classes defined in the ontology
57
+ for (const classUri of repository.getClasses('http://example.org/my-ontology')) {
58
+ console.log(classUri);
59
+ }
60
+
61
+ // Get class hierarchy (includes inferred subclass relationships)
62
+ const subClasses = repository.getSubClasses('http://example.org/my-ontology', 'http://example.org/MyClass');
14
63
  ```