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

Issue 571: Reduce UCO OWL RDF List review scope to OWL Sequences #572

Merged
merged 6 commits into from
Jan 19, 2024

Conversation

ajnelson-nist
Copy link
Contributor

@ajnelson-nist ajnelson-nist commented Dec 5, 2023

This Pull Request resolves all requirements of Issue #571 .

Coordination

  • Pull Request is against correct branch
  • Pull Request is in, or reverted to, Draft status before Solutions Approval vote has passed
  • CI passes in UCO feature branch against develop
  • CI passes in UCO current unstable branch (c5eba72)
  • CI passes in CASE current unstable branch tracking UCO's unstable as submodule (ce25a0b)
  • Impact on SHACL validation reviewed for CASE-Corpora
  • Impact on SHACL validation remediated for CASE-Corpora
  • Impact on SHACL validation reviewed for CASE-Examples
  • Impact on SHACL validation remediated for CASE-Examples (N/A)
  • Impact on SHACL validation reviewed for casework.github.io
  • Impact on SHACL validation remediated for casework.github.io (N/A)
  • Milestone linked
  • Solutions Approval vote logged on corresponding Issue (once logged, can be taken out of Draft PR status)

A follow-on patch will regenerate Make-managed files.

References:
* #571

Signed-off-by: Alex Nelson <[email protected]>
References:
* #571

Signed-off-by: Alex Nelson <[email protected]>
@ajnelson-nist ajnelson-nist linked an issue Dec 5, 2023 that may be closed by this pull request
15 tasks
@ajnelson-nist
Copy link
Contributor Author

When testing CASE-Corpora, I found an error in an OWL assertion I'd written:

dcat:Dataset
        rdfs:comment "Within CASE-Corpora, the property hasDatasetDirectory is a unique identifier for a Dataset."@en ;
        owl:hasKey case-corpora:hasDatasetDirectory ;
        . 

This turns out to be incorrect. owl:hasKey is a sequence-valued predicate. Instead of dcat:Dataset owl:hasKey case-corpora:hasDatasetDirectory ., it should be dcat:Dataset owl:hasKey ( case-corpora:hasDatasetDirectory ) ..

The SHACL validation report from state a65ebe9 (brought in via the unstable branch) read like this:

@prefix case-corpora: <http://example.org/ontology/case-corpora/> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix uco-owl: <https://ontology.unifiedcyberontology.org/owl/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

[] a sh:ValidationReport ;
    sh:conforms false ;
    sh:result [ a sh:ValidationResult ;
            sh:detail [ a sh:ValidationResult ;
                    sh:focusNode case-corpora:hasDatasetDirectory ;
                    sh:resultMessage "Node case-corpora:hasDatasetDirectory does not conform to exactly one shape in [ rdf:type sh:NodeShape ; sh:hasValue rdf:nil ] , [ rdf:type sh:NodeShape ; sh:nodeKind sh:BlankNode ; sh:property [ rdf:type sh:PropertyShape ; sh:path [ sh:oneOrMorePath rdf:rest ] ; sh:xone ( [ rdf:type sh:NodeShape ; sh:hasValue rdf:nil ] [ rdf:type sh:NodeShape ; sh:nodeKind sh:BlankNode ; sh:property [ rdf:type sh:PropertyShape ; sh:maxCount Literal(\"1\", datatype=xsd:integer) ; sh:minCount Literal(\"1\", datatype=xsd:integer) ; sh:path rdf:first ] ] ) ] ]" ;
                    sh:resultSeverity sh:Violation ;
                    sh:sourceConstraintComponent sh:XoneConstraintComponent ;
                    sh:sourceShape uco-owl:Sequence-shape ;
                    sh:value case-corpora:hasDatasetDirectory ] ;
            sh:focusNode case-corpora:hasDatasetDirectory ;
            sh:resultMessage "Value does not conform to Shape uco-owl:Sequence-shape. See details for more information." ;
            sh:resultSeverity sh:Violation ;
            sh:sourceConstraintComponent sh:NodeConstraintComponent ;
            sh:sourceShape uco-owl:hasKey-objects-shape ;
            sh:value case-corpora:hasDatasetDirectory ] .

It is a bit obscuring for the sh:focusNode and sh:value to be the same part of the triple.

@ajnelson-nist
Copy link
Contributor Author

I think it will be a better user experience to spell the shapes for each sequence-valued property like this instead:

# Replace this ...
uco-owl:hasKey-objects-shape
       a sh:NodeShape ;
       sh:node uco-owl:Sequence-shape ;
       sh:targetObjectsOf owl:hasKey ;
       .

# ... with this:
uco-owl:hasKey-subjects-shape
       a sh:NodeShape ;
       sh:property [
               a sh:PropertyShape ;
               sh:node uco-owl:Sequence-shape ;
               sh:path owl:hasKey ;
       ] ;
       sh:targetSubjectsOf owl:hasKey ;
       .

Here is how that same validation report on the incorrect hasKey usage now reads:

@prefix case-corpora: <http://example.org/ontology/case-corpora/> .
@prefix dcat: <http://www.w3.org/ns/dcat#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix uco-owl: <https://ontology.unifiedcyberontology.org/owl/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

[] a sh:ValidationReport ;
    sh:conforms false ;
    sh:result [ a sh:ValidationResult ;
            sh:detail [ a sh:ValidationResult ;
                    sh:focusNode case-corpora:hasDatasetDirectory ;
                    sh:resultMessage "Node case-corpora:hasDatasetDirectory does not conform to exactly one shape in [ rdf:type sh:NodeShape ; sh:hasValue rdf:nil ] , [ rdf:type sh:NodeShape ; sh:nodeKind sh:BlankNode ; sh:property [ rdf:type sh:PropertyShape ; sh:path [ sh:oneOrMorePath rdf:rest ] ; sh:xone ( [ rdf:type sh:NodeShape ; sh:hasValue rdf:nil ] [ rdf:type sh:NodeShape ; sh:nodeKind sh:BlankNode ; sh:property [ rdf:type sh:PropertyShape ; sh:maxCount Literal(\"1\", datatype=xsd:integer) ; sh:minCount Literal(\"1\", datatype=xsd:integer) ; sh:path rdf:first ] ] ) ] ]" ;
                    sh:resultSeverity sh:Violation ;
                    sh:sourceConstraintComponent sh:XoneConstraintComponent ;
                    sh:sourceShape uco-owl:Sequence-shape ;
                    sh:value case-corpora:hasDatasetDirectory ] ;
            sh:focusNode dcat:Dataset ;
            sh:resultMessage "Value does not conform to Shape uco-owl:Sequence-shape. See details for more information." ;
            sh:resultPath owl:hasKey ;
            sh:resultSeverity sh:Violation ;
            sh:sourceConstraintComponent sh:NodeConstraintComponent ;
            sh:sourceShape [ a sh:PropertyShape ;
                    sh:node uco-owl:Sequence-shape ;
                    sh:path owl:hasKey ] ;
            sh:value case-corpora:hasDatasetDirectory ] .

The whole flagged triple can now be found with sh:focusNode, sh:resultPath, and sh:value.

Signed-off-by: Alex Nelson <[email protected]>
This causes `ValidationResult`s to yield sufficient information to find
the whole triple that should have used a sequence.  With the prior
spelling, only the object of the triple would have been directly
identified; the predicate could be manually deduced from the shape name;
and the subject was completely absent from the validation result.

The noted comment on PR 572 illustrates the difference in results when
testing CASE-Corpora.  The issue is replicated as new PASS and XFAIL
test members.

A follow-on patch will regenerate Make-managed files.

References:
* #571
* #572 (comment)

Signed-off-by: Alex Nelson <[email protected]>
References:
* #571
* #572 (comment)

Signed-off-by: Alex Nelson <[email protected]>
@ajnelson-nist ajnelson-nist marked this pull request as ready for review January 19, 2024 14:35
@ajnelson-nist ajnelson-nist requested a review from a team January 19, 2024 14:35
@plbt5 plbt5 merged commit 3427df0 into develop Jan 19, 2024
1 check passed
@plbt5 plbt5 deleted the BugFix-Issue-571 branch January 19, 2024 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UCO OWL review of RDF List was scoped too broadly
2 participants