-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Return single values if OWL indicates property maximum cardinality is 1 #14
Comments
Note that this will actually require two things:
In addition, we could use examples from the MOF2RDF specification, which include examples of |
Jena inference documentation, including how to create a reasoner for accessing a graph/model |
The OWL reasoner will be needed to access OWL-related information for properties. There are several reasoners for OWL, we can use either full or mini (no minimum Cardinality) both reasoners should cover maximum cardinality.
A reasoner is created and configured with 2 models (data and schema), and an inferred model is created (infmodel) |
maxCardinality can be applied via a schema model, which is visible in an inferred model produced by a reasoner. However, a property owl:maxCardinality is obfuscated by a generated graph node (_:b1) produced by the reasoner at runtime. This is not the same as if the owl:maxCardinality was defined in the original data model. :bigName42 rdf:type :Computer , owl:Thing , _:b1 , _:b0 , rdfs:Resource; :hasMotherBoard rdf:type rdf:Property , owl:ObjectProperty , rdfs:Resource , owl:Property; _:b1 rdf:type owl:Class , rdfs:Class , owl:Restriction , rdfs:Resource; |
Turn an Inferred model into an Ontology model, and gain access to more methods relating to OWL.
|
Gets all the Restriction types in the (ont)model (test model has referenced restrictions), gets the one that is MaxCardinality (there is only one).
|
Get a property from the ont model, check its referring restrictions for max cardinality, find the node and get value (if present)
|
During our chat today, we talked that Jena does not enforce maximum cardinalities during loading: this validation is something that has to be triggered by the user, and which will report issues, but it's perfectly possible for someone to load and query an invalid RDF model. I have added #20 to the backlog as we may want to trigger this validation during loading in the future, but for the time being, if we have more values than what maxCardinality allows, we should print a warning on the error stream and return the first values within the maxCardinality. If, for instance, we get 2 values and we should only have one, we will print a warning, return the first one we found, and discard the other. |
Based on the above experiments, we have tried extending RDFModel to have split schema + data URIs, and to run the OWL reasoner during loading. The next tasks for this issue would be:
Edit: after further consideration, we don't need the OntClass abstraction for the work in this issue. |
3 Tests need reviewing to see if they are still needed/appropriate. Originally, some tests checked a data model loaded as a |
Are the tests in the PR? Can you point me to their names?
|
The tests are on the branch for this project note, RDFModeTest.java and
they are marked with "TODO - review this test - OntModel changed results".
I had planned to go over them with you in the next catch-up, just to
confirm what you intended the tests to do and how you think they should now
be i.e. set new fix values for the expected returns.
|
At the moment,
x.property
will always return aSequence
as the driver is unaware of any OWL constraints on the cardinality of the property. It would be useful to access the OWL information from Jena to take this into account.This section of the W3C OWL guide explains how to represent this restriction:
https://www.w3.org/TR/2004/REC-owl-guide-20040210/#simpleCardinality
The text was updated successfully, but these errors were encountered: