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

pattern:PatternExpression is erroneously encoded as a datatype and class #562

Closed
15 tasks done
ajnelson-nist opened this issue Nov 14, 2023 · 11 comments · Fixed by #566
Closed
15 tasks done

pattern:PatternExpression is erroneously encoded as a datatype and class #562

ajnelson-nist opened this issue Nov 14, 2023 · 11 comments · Fixed by #566

Comments

@ajnelson-nist
Copy link
Contributor

ajnelson-nist commented Nov 14, 2023

Bug description

The class pattern:LogicalPattern constrains the predicate pattern:patternExpression to have a "range" of pattern:PatternExpression [sic.].

https://github.com/ucoProject/UCO/blob/1.2.0/ontology/uco/pattern/pattern.ttl#L20-L35

pattern:LogicalPattern
	a
		owl:Class ,
		sh:NodeShape
		;
	rdfs:subClassOf pattern:Pattern ;
	rdfs:label "LogicalPattern"@en ;
	rdfs:comment "A logical pattern is a grouping of characteristics unique to an informational pattern expressed via a structured pattern expression following the rules of logic."@en ;
	sh:property [
		sh:datatype pattern:PatternExpression ;
		sh:maxCount "1"^^xsd:integer ;
		sh:nodeKind sh:Literal ;
		sh:path pattern:patternExpression ;
	] ;
	sh:targetClass pattern:LogicalPattern ;
	.

pattern:patternExpression (the predicate) is a owl:DatatypeProperty, so it is expected to have a range of some literal.

https://github.com/ucoProject/UCO/blob/1.2.0/ontology/uco/pattern/pattern.ttl#L59-L64

pattern:patternExpression
	a owl:DatatypeProperty ;
	rdfs:label "patternExpression"@en ;
	rdfs:comment "An explicit logical pattern expression."@en ;
	rdfs:range pattern:PatternExpression ;
	.

But, pattern:PatternExpression (capital P) is a owl:Class, not rdfs:Datatype:

https://github.com/ucoProject/UCO/blob/1.2.0/ontology/uco/pattern/pattern.ttl#L48-L57

pattern:PatternExpression
	a
		owl:Class ,
		sh:NodeShape
		;
	rdfs:subClassOf core:UcoInherentCharacterizationThing ;
	rdfs:label "PatternExpression"@en ;
	rdfs:comment "A pattern expression is a grouping of characteristics unique to an explicit logical expression defining a pattern (e.g., regular expression, SQL Select expression, etc.)."@en ;
	sh:targetClass pattern:PatternExpression ;
	.

This is an OWL 2 DL error. Classes cannot be datatypes, and datatype properties cannot have class ranges.

I came across this while trying to figure out how to use pattern:LogicalPattern to represent a regular expression substitution command, s/foo/bar/g.

To the original drafters of pattern:Pattern: How was this supposed to work? Can somebody please provide a demonstration for that s/... regular expression I gave above, from which we can go back and fix PatternExpression?

Steps to reproduce

Please see snippets above.

Requirements

Requirement 1

UCO's SHACL constraints must remain consistent with OWL design constraints, particularly around object properties versus datatype (literal-value) properties. (This is not a new requirement.)

Requirement 2

pattern:patternExpression and pattern:PatternExpression must be mutually consistent with one another. Currently, patternExression is a datatype property with range PatternExpression, but PatternExpression is a owl:Class, not rdfs:Datatype.

Risk / Benefit analysis

Benefits

Having pattern:PatternExpression established and stable will enable further "downstream" specialization. See e.g. #550 (under draft).

Risks

The pattern namespace was not demonstrated before being included in UCO 1.0.0. If a demonstration is not provided, it will be unclear if freshly-chosen design will be satisfactory.

Competencies demonstrated

Competency 1

Pending demonstration

Competency Question 1.1

Pending demonstration

Result 1.1

Pending demonstration

Solution suggestion

  • Change pattern:patternExpression to an owl:ObjectProperty.
  • Change corresponding SHACL constraints around pattern:patternExpression.
  • Add test to find errant applications of sh:datatype attempting to constrain to owl:Classes.

Coordination

  • Administrative review completed, proposal announced to Ontology Committees (OCs) on 2023-11-20
  • Requirements to be discussed in OC meeting, 2023-11-28
  • Requirements Review vote occurred, passing, on 2023-11-28
  • Requirements development phase completed.
  • Solution announced to OCs on 2024-05-01
  • Solutions Approval to be discussed in OC meeting, 2024-05-30
  • Solutions Approval vote occurred, passing, on 2024-05-30
  • Solutions development phase completed.
  • Backwards-compatible implementation merged into develop for the next release (N/A)
  • develop state with backwards-compatible implementation merged into develop-2.0.0 (N/A)
  • Backwards-incompatible implementation merged into develop-2.0.0
  • Milestone linked
  • Documentation logged in pending release page
  • Prerelease publication: CASE develop branch updated to track UCO's updated develop branch (N/A)
  • Prerelease publication: CASE develop-2.0.0 branch updated to track UCO's updated develop-2.0.0 branch
@ajnelson-nist
Copy link
Contributor Author

It seems #550 is built on PatternExpression being an owl:Class. @sbarnum and/or @Bradichus , do you have input on this issue (562)? Should pattern:patternExpression be an owl:ObjectProperty?

@ajnelson-nist
Copy link
Contributor Author

I suspect that this bug fix will be a backwards-incompatible change, because a property will need to change its OWL property-class. Thus, I'm putting it on the UCO 2.0.0 track.

@ajnelson-nist ajnelson-nist added this to the UCO 2.0.0 milestone Nov 20, 2023
ajnelson-nist added a commit that referenced this issue Nov 20, 2023
This test is spelled as a "Negative" constraint to avoid attempting to
hard-code a list of the recognized OWL "built-in" datatypes alongside
custom RDFS datatypes (such as UCO's vocabulary namespace members).

The anonymous node shape design pattern is documented in PR 564, commit
77cd47d.

This patch is known to fail CI at the moment because it catches the
error described in 562, but does not resolve that situation.  This patch
is provided now to prevent this implementation error pattern from
arising in the future.

References:
* #562
* 77cd47d

Signed-off-by: Alex Nelson <[email protected]>
ajnelson-nist added a commit that referenced this issue Nov 20, 2023
This patch is implemented based on the early draft-state of Issue 550,
to correct the issue reported in Issue 562.

No effects were observed on Make-managed files.

References:
* #550
* #562

Signed-off-by: Alex Nelson <[email protected]>
@ajnelson-nist
Copy link
Contributor Author

PR 566 has been filed to address this issue. The PR includes a test that detects this OWL+SHACL error pattern. Fortunately, the test only reports this one occurrence.

Note: 566 was written not having seen a demonstration of PatternExpression.

ajnelson-nist added a commit that referenced this issue Nov 22, 2023
Commit ba77dea used a design pattern that I now believe is not
applicable.  This patch revises the new shape to the corrected from now
in PR 564.

No effects were observed on Make-managed files.

References:
* #562
* 6669aab

Signed-off-by: Alex Nelson <[email protected]>
ajnelson-nist added a commit to casework/CASE-Archive that referenced this issue Nov 22, 2023
No effects were observed on Make-managed files.

References:
* ucoProject/UCO#562

Signed-off-by: Alex Nelson <[email protected]>
ajnelson-nist added a commit to casework/CASE-Archive that referenced this issue Nov 22, 2023
No effects were observed on Make-managed files.

References:
* ucoProject/UCO#562

Signed-off-by: Alex Nelson <[email protected]>
ajnelson-nist added a commit to casework/CASE-Archive that referenced this issue Nov 22, 2023
No effects were observed on Make-managed files.

References:
* ucoProject/UCO#562

Signed-off-by: Alex Nelson <[email protected]>
ajnelson-nist added a commit to casework/casework.github.io that referenced this issue Nov 22, 2023
A follow-on patch will regenerate Make-managed files.

References:
* ucoProject/UCO#562

Signed-off-by: Alex Nelson <[email protected]>
ajnelson-nist added a commit to casework/casework.github.io that referenced this issue Nov 22, 2023
References:
* ucoProject/UCO#562

Signed-off-by: Alex Nelson <[email protected]>
ajnelson-nist added a commit to casework/CASE-Corpora that referenced this issue Nov 27, 2023
No effects were observed on Make-managed files.

References:
* ucoProject/UCO#562

Signed-off-by: Alex Nelson <[email protected]>
ajnelson-nist added a commit to casework/CASE-Examples that referenced this issue Nov 27, 2023
No effects were observed on Make-managed files.

References:
* ucoProject/UCO#562

Signed-off-by: Alex Nelson <[email protected]>
@ajnelson-nist
Copy link
Contributor Author

Another note on the implementation in PR # 566 : It includes a new OWL test that UCO 1.x.0 fails, and can't be corrected in a backwards-compatible manner. I've not filed another PR to backport this test to 1.x.0 because, due to a logistical need for SHACL validation (where the ontology T-Box is necessarily mixed into the instance data A-Box), all runs of UCO's SHACL rules would report this error in the ontology, no matter the input data. This feels, to me, like a sufficiently unsatisfactory user experience that we should wait until UCO 2.0.0.

@ajnelson-nist
Copy link
Contributor Author

@plbt5 requested in PR 259 on the CASE website that the new OWL shape get a description comment.

@plbt5 , how about:

uco-owl:sh-datatype-objects-shape
    sh:description "This shape enforces that the sh:datatype constraining predicate does not bind an OWL class for a literal-valued constraint."@en ;
    .

@ajnelson-nist
Copy link
Contributor Author

A vote described in the meeting as a Solutions Approval vote was held 2023-11-28, and passed by the attending members.

However, in the email announcement, Jira tracking, and on the GitHub Issue, the pending vote was described to be a Requirements Review vote.

Because the solution is incomplete, I am going to “Split the difference” and consider this to be a passed Requirements Review vote.

The solution can’t be complete until the class being modified receives a demonstration.

@ajnelson-nist
Copy link
Contributor Author

The solution from today's call:

  • pattern:PatternExpression should be removed/permanently deprecated.
  • The datatype constraint on LogicalPattern should be set to xsd:string.
  • The rdfs:range on patternExpression should be set to xsd:string.

ajnelson-nist added a commit that referenced this issue Apr 30, 2024
No effects were observed on Make-managed files.

References:
* #562

Signed-off-by: Alex Nelson <[email protected]>
ajnelson-nist added a commit to casework/CASE-Archive that referenced this issue Apr 30, 2024
No effects were observed on Make-managed files.

References:
* ucoProject/UCO#562

Signed-off-by: Alex Nelson <[email protected]>
ajnelson-nist added a commit to casework/casework.github.io that referenced this issue Apr 30, 2024
A follow-on patch will regenerate Make-managed files.

References:
* ucoProject/UCO#562

Signed-off-by: Alex Nelson <[email protected]>
ajnelson-nist added a commit to casework/casework.github.io that referenced this issue Apr 30, 2024
References:
* ucoProject/UCO#562

Signed-off-by: Alex Nelson <[email protected]>
ajnelson-nist added a commit to casework/CASE-Corpora that referenced this issue Apr 30, 2024
No effects were observed on Make-managed files.

References:
* ucoProject/UCO#562

Signed-off-by: Alex Nelson <[email protected]>
ajnelson-nist added a commit to casework/CASE-Examples that referenced this issue Apr 30, 2024
No effects were observed on Make-managed files.

References:
* ucoProject/UCO#562

Signed-off-by: Alex Nelson <[email protected]>
@ajnelson-nist
Copy link
Contributor Author

@plbt5 requested in PR 259 on the CASE website that the new OWL shape get a description comment.

@plbt5 , how about:

uco-owl:sh-datatype-objects-shape
    sh:description "This shape enforces that the sh:datatype constraining predicate does not bind an OWL class for a literal-valued constraint."@en ;
    .

@plbt5 , do you have a response to this suggestion?

@plbt5
Copy link
Contributor

plbt5 commented May 2, 2024 via email

@plbt5
Copy link
Contributor

plbt5 commented May 2, 2024

Agree with suggested comment.

ajnelson-nist added a commit that referenced this issue May 3, 2024
No effects were observed on Make-managed files.

References:
* #562

Acked-by: Paul Brandt <[email protected]>
Signed-off-by: Alex Nelson <[email protected]>
@ajnelson-nist
Copy link
Contributor Author

Agree with suggested comment.

Added, thank you.

ajnelson-nist added a commit to casework/CASE-Archive that referenced this issue Jun 14, 2024
ajnelson-nist added a commit to casework/CASE that referenced this issue Jun 18, 2024
No effects were observed on Make-managed files.

References:
* ucoProject/UCO#562
* ucoProject/UCO#586
* ucoProject/UCO#590

Signed-off-by: Alex Nelson <[email protected]>
ajnelson-nist added a commit to ucoProject/ucoproject.github.io that referenced this issue Jun 18, 2024
References:
* ucoProject/UCO#562

Signed-off-by: Alex Nelson <[email protected]>
ajnelson-nist added a commit to casework/casework.github.io that referenced this issue Jun 18, 2024
A follow-on patch will regenerate Make-managed files.

References:
* ucoProject/UCO#562

Signed-off-by: Alex Nelson <[email protected]>
ajnelson-nist added a commit to casework/casework.github.io that referenced this issue Jun 18, 2024
References:
* ucoProject/UCO#562

Signed-off-by: Alex Nelson <[email protected]>
ajnelson-nist added a commit to casework/casework.github.io that referenced this issue Jun 18, 2024
A follow-on patch will regenerate Make-managed files.

References:
* ucoProject/UCO#562
* ucoProject/UCO#586
* ucoProject/UCO#590

Signed-off-by: Alex Nelson <[email protected]>
ajnelson-nist added a commit to casework/casework.github.io that referenced this issue Jun 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants