Skip to content
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

Functional properties, SameAs inference, validation #7

Closed
benoitdaireaux opened this issue Oct 2, 2023 · 8 comments
Closed

Functional properties, SameAs inference, validation #7

benoitdaireaux opened this issue Oct 2, 2023 · 8 comments
Assignees
Labels
enhancement Indicates the need for a new feature, or the backward-compatible change of an existing one
Milestone

Comments

@benoitdaireaux
Copy link

Hello,
I am not sure this is the best channel to ask this question...
I am a researcher at NORCE, and I am building an ontology to describe some industrial real-time signals. I have been using your packages for some time now, it is quite a beautiful work you've done!
Here is my question: I have a functional property (myProperty).
When I declare two assertions of this property for a single resource:

  • myResource myProperty resource1
  • myResource myProperty resource2
    I would expect a reasoner to infer that resource1 and resource2 are the same (resource1 SameAs resource2). This is the behavior described in many textbooks.
    I couldn't tune the reasoner to achieve this. So I created a custom rule (so far only valid for myProperty since it seems that custom rules can't apply to variable properties). It basically says: if q myProperty r1 AND q myProperty r2, THEN r1 SameAs r2.
    This works fine. But when trying to validate the ontology, the functional property rule is broken: there are 2 property assertions, even if they are the same.
    So:
  • is there a way (nicer than what I did) to infer the sameas property in my situation?
  • is there a way to enforce the validation to consider SameAs properties, and therefore not react in my situation?

Sorry for the long message, and again the library is a charm to use!
Regards,
Benoit Daireaux

@benoitdaireaux benoitdaireaux added the needs-triage Indicates that the request still need to be analyzed and properly classified label Oct 2, 2023
@mdesalvo mdesalvo added enhancement Indicates the need for a new feature, or the backward-compatible change of an existing one and removed needs-triage Indicates that the request still need to be analyzed and properly classified labels Oct 2, 2023
@mdesalvo
Copy link
Owner

mdesalvo commented Oct 2, 2023

Dear Benoit,
yes this is the best channel to interact with the project in every way :)

The reasoner will be updated to address the functional property case you described: a functional property linking an individual to 2+ individuals can only mean that those individuals are the same. I'll introduce a fresh new standard rule to cover this.

The GlobalCardinality validator rule (which I understand is your actual pain point) will also be relaxed to not complain when detecting functional properties linking target individuals being declared or inferred the same.

Regards,
Marco

@mdesalvo mdesalvo added this to the v3.8.0 milestone Oct 2, 2023
@benoitdaireaux
Copy link
Author

benoitdaireaux commented Oct 2, 2023 via email

@benoitdaireaux
Copy link
Author

benoitdaireaux commented Oct 3, 2023 via email

@mdesalvo
Copy link
Owner

mdesalvo commented Oct 3, 2023

Hi, Thanks for your swift response. I’ll monitor the progress to see when the changes are made. On a side note: at some point, we needed to parse some SPARQL query into a RDFSharp query. We couldn’t find such functionality in your library, so we started implementing a parser ourself. It is far from complete, and mainly parses SELECT queries, but please tell me if you’re interested in this type of code, I can point you to our repo. Regards, Benoit Daireaux Seniorforsker Senior Researcher +47 51 87 56 73 +47 957 87 884 Tullins gate 2, 0166 Oslo, Norway NORCE norceresearch.nohttps://www.norceresearch.no/

You are right, SPARQL parser is not available in the library since it would require unfeasible effort for the project. I would be grateful if you could contribute this as a feature though one or more PRs, even with initial scope set to SELECT queries only. Consider that we do not have a complete SPARQL algebra: a limited set of features (like MINUS operator and arithmetical property paths) are not implemented, so they should trigger error during the parsing process.

@mdesalvo
Copy link
Owner

mdesalvo commented Oct 3, 2023

Hello Marco, I have some other comments. I added to my ontology a reasoner rule that states that under certain conditions to individuals should be considered the same (SameAs). I used first the OWLReasonerRuleSameAsAtom as a consequent in my rule. I noticed that the SameAs consequence was disregarded when the two individuals were already marked as DifferentFrom. Although I understand the logic, I have a scenario where I still would like to have this property generated, and then have the validator detect the inconsistency. It is perhaps a standard scenario, I am not sure what should be the expected behavior of the OWLReasonerRuleSameAsAtom in that case, but I just wanted to inform you. I worked around the problem by using an ObjectPropertyAtom with the OWL.SAME_AS property. However, I couldn’t find in the validation any check for individuals marked SameAs and DifferentFrom at the same time. So I decided to add my own validation rule. My problem now when writing the delegate that is passed as an argument to the OWLValidatorRule is that is must return an OWLValidationReport. The only constructor for such a OWLValidationReport is internal, and I can therefore not instanciate the report from my external code… Could the constructor be made public? I appreciate your help, Benoit Daireaux Seniorforsker Senior Researcher +47 51 87 56 73 +47 957 87 884 Tullins gate 2, 0166 Oslo, Norway NORCE norceresearch.nohttps://www.norceresearch.no/

No problem, I'll open that ctor. It should be public of course.
Regarding the conflicts between sameAs and differentFrom they are checked at the moment of declaring them in the ontology data, so the ontology is always consistent. They are also checked in SWRL atoms, but I admit they cannot be checked outside these use cases at the moment. Maybe a standard validation rule for this would be appropriate.

@mdesalvo
Copy link
Owner

mdesalvo commented Oct 3, 2023

Three activities were done for this thread, now available in main after successful unit testing:

  • Introduced standard reasoner rule OWLFunctionalEntailmentRule to emit owl:sameAs relations under situations in which functional object properties are found to link different target individuals and these individuals are compatible
  • Modified standard validator rule OWLGlobalCardinalityRule to not complain when detecting functional property violations under situations in which target individuals are explicitly found to be related by owl:sameAs
  • Modified visibility of OWLValidatorReport ctor in order to be public

@mdesalvo mdesalvo closed this as completed Oct 3, 2023
@benoitdaireaux
Copy link
Author

benoitdaireaux commented Oct 4, 2023 via email

@mdesalvo
Copy link
Owner

mdesalvo commented Oct 4, 2023

@benoitdaireaux The library has been updated in Nuget with a new release (v3.8) containing these features.

Regards,
Marco

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Indicates the need for a new feature, or the backward-compatible change of an existing one
Projects
None yet
Development

No branches or pull requests

2 participants