sszuev commented on issue #1968:
URL: https://github.com/apache/jena/issues/1968#issuecomment-1652193209

   1)
   A couple words about [OWL-API](https://github.com/owlcs/owlapi) and 
[ONT-API](https://github.com/owlcs/ont-api), once again.
   
   Each 
[org.semanticweb.owlapi.model.OWLOntology](https://github.com/owlcs/owlapi/blob/version5/api/src/main/java/org/semanticweb/owlapi/model/OWLOntology.java)
 provides access to 
[org.semanticweb.owlapi.model.OWLAxiom](https://github.com/owlcs/owlapi/blob/version5/api/src/main/java/org/semanticweb/owlapi/model/OWLAxiom.java)s
 which, in turn, consist of 
[org.semanticweb.owlapi.model.OWLObject](https://github.com/owlcs/owlapi/blob/version5/api/src/main/java/org/semanticweb/owlapi/model/OWLObject.java).
   There are 38 types of OWL2 axioms + SWRL-Rule "axiom".
   In the default 
[OWLAPI-impl](https://github.com/owlcs/owlapi/tree/version5/impl) each 
`OWLOntology` is a set of `OWLAxiom`s, stored in memory.
   
   There is a generic interface 
[org.semanticweb.owlapi.reasoner.OWLReasoner](https://github.com/owlcs/owlapi/blob/version5/api/src/main/java/org/semanticweb/owlapi/reasoner/OWLReasoner.java).
 In OWLAPI there are several limited reasoners.
   \+ There are several external implementations of `OWLReasoner`: 
[jfact](https://github.com/owlcs/jfact), 
[hermit](https://github.com/owlcs/hermit-reasoner), 
[openllet](https://github.com/Galigator/openllet).
   
   ONT-API is an alternative implementation of OWLAPI-api. There is no any 
reasoner, but of course it can be used by any `OWLReasoner`.
   There are tree layers:
   - Jena's `Graph`
   - Jena's extended `Model` with OWL2 support 
   - OWLAPI-api implementation
   
   Thanks to the fact that we have RDF under the hood, we can use OWL2 with 
SHACL, SPARQL, etc. Also, any Graph could underlay, not only in-memory 
implementations. If some RDF construction does not meet the OWL2 specification, 
it invisible from the top-level OWLAPI-api.
   
   There are limited concurrent support via `ReadWriteLock`, but only for the 
first level 
([`ReadWriteLockingGraph`](https://github.com/sszuev/concurrent-rdf-graph/blob/main/src/main/kotlin/ReadWriteLockingGraph.kt))
 and the last one.
   
   I think, the whole ONT-API's code is not very suitable to be merged into 
Jena. But secod level (Jena's extended `Model`) could be, it is closer to what 
Jena already has.
   
   2) 
   Here is a spin-off of ONT-API - https://github.com/sszuev/jena-owl2 project. 
It contains second level: extended Jena `Model` - 
[com.github.sszuev.jena.ontapi.model.OntModel](https://github.com/sszuev/jena-owl2/blob/main/src/main/java/com/github/sszuev/jena/ontapi/model/OntModel.java)
   The goal of this project is to repeat all the 
`org.apache.jena.ontology.OntModel`'s functionality, including rules-inference 
support, different specs, document-manager, etc. It is currently under 
development. There are only `OWL2_MEM`, `RDFS_MEM` and 
`OWL2_DL_MEM_RDFS_BUILTIN_INF` specs. `OntModel` is not `InfModel` yet.
   In the first release `ReadWriteLockingGraph` will not be part of this 
model-api.
   
   `OntModel` interface supports all the feature of OWL2 and also SWRL (since 
it is present in OWLAPI).
   Example:
   ```java
   OntModel m = 
OntModelFactory.createModel().setNsPrefixes(OntModelFactory.STANDARD);
   m.createDataAllValuesFrom(List.of(m.createDataProperty("dp")), 
m.createDataRestriction(m.getDatatype(XSD.xstring),
                   
m.createFacetRestriction(OntFacetRestriction.MaxLength.class, 
m.createTypedLiteral(42))))
           .addEquivalentClass(m.createOntClass("C"));
   m.ontObjects(OntClass.class).forEach(System.out::println);
   m.ontEntities().forEach(System.out::println);
   m.write(System.out, "ttl");
   
   ```
   There are no OWLAxiom objects, just like in 
`org.apache.jena.ontology.OntModel`.
   There is 
[com.github.sszuev.jena.ontapi.UnionGraph](https://github.com/sszuev/jena-owl2/blob/main/src/main/java/com/github/sszuev/jena/ontapi/UnionGraph.java),
 any changes in imported ontologies (`owl:import`) are visible in the top-level.
   
   For developing I use Jena's OntModel tests (cleanuped): 
https://gitlab.com/sszuev/jena-core-ont-tests, 
`org.apache.jena.ontology.OntModel`'s documentation, and sometimes its 
implementation (but usually it is difficult to understand that code, it's 
easier to write from scratch)
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to