Skip to content

Inferencing use case: Refining OWL-Time Intervals to ProperIntervals based on trinary relationship #515

@ajnelson-nist

Description

@ajnelson-nist

This is a use case motivating retaining SHACL-SPARQL CONSTRUCT-based rules as the inferencing work proceeds. It goes a bit into OWL theory, but I try to only go as far as I see some similar expressiveness constraints from SHACL AF's TripleRules.

Relevance for related issues

  • PR Initial content for 'Inference Rules' #452 introduces SHACL Rules post-SHACL-AF and Variables, which I think are necessary to satisfy this use case without SPARQL. SHACL AF's discussion around variables, aside from $this, only went as far as exposing annotation links, per Section 4.

  • The long writeup is to give a case of Rules performing an inference that I believe is unavailable to OWL. There is also some implication of recurrence in pre-validation steps: Rule execution as described in this Issue would have an influence on RDFS and/or OWL inferencing, due to rule-inferred owl:Class assignments. I could have sworn this ordering matter was filed as an Issue already, but I'm having trouble finding it. Link welcome if this jogs anyone's memory.

Caveat

This example is based on an interpretation of a property time:after as it pertains to two time:Instants: That x time:after y means there is a >0-duration interval of time between x and y. This is not explicit in the current OWL-Time specification, but it appears to be implied; discussion is here.

Background: OWL-Time excerpt

OWL-Time has a few top-level classes that relate to each other in this way:

  • TemporalEntity is the parent class of Instant and Interval
  • Interval is the parent class of ProperInterval: intervals can be 0-duration, but ProperIntervals are non-0 duration
  • Instants are disjoint with Intervals

If helpful, here is a diagram showing these classes:

flowchart

subgraph legend
direction BT
subclass -->|⊏| superclass
end

subgraph Classes
direction BT
owl_Thing[owl:Thing]
time_TemporalEntity[time:TemporalEntity]
time_Instant[time:Instant]
time_Interval[time:Interval]
time_ProperInterval[time:ProperInterval]
end

time_Instant ---|⊓=∅| time_ProperInterval
linkStyle 1 stroke:red,stroke-width:4px,color:red;
time_TemporalEntity -->|⊏| owl_Thing
time_Instant -->|⊏| time_TemporalEntity
time_Interval -->|⊏| time_TemporalEntity
time_ProperInterval -->|⊏| time_Interval
Loading

There is a property, time:inside, which denotes that an instant is inside an interval. time:inside has as part of its definition time:inside rdfs:domain time:Interval .---note this is not time:ProperInterval.

Use case

Take this example data graph:

ex:Interval-A time:inside ex:Instant-B .
ex:Interval-A time:inside ex:Instant-C .

Domain and range inferencing (either RDFS or OWL-RL) entail:

ex:Interval-A a time:Interval .
ex:Instant-B a time:Instant .
ex:Instant-C a time:Instant .

The example data graph, and even the example data graph with the inferred type triples, is insufficient information to determine whether ex:Interval-A is a time:ProperInterval. This is because:

  • ex:Instant-B and ex:Instant-C could pertain to the same graph-individual, just identified by different IRI.
  • ex:Instant-B and ex:Instant-C could be different graph-individuals (e.g., the independently-assigned end of some interval and beginning of some other interval), but pertain to the same temporal value (/position). This could occur with usage of time:intervalMeets.

If this statement were also in the knowledge graph ...

ex:Instant-C time:after ex:Instant-B .

... then, it should be possible to infer that ex:Interval-A is a time:ProperInterval, because it is an interval that contains two instants with a gap between them. (Reminder of caveat - this assumes time:after is a greater-than predicate, not a greater-than-or-equal-to.)

However, I don't think this is possible to infer using only mechanisms available to OWL, or SHACL Advanced Features (i.e., pre-SHACL-1.2) TripleRules. My understanding is that the matter comes down to variable binding and trinary (/3-ary) relationships not being available without SPARQL. (Though sh:disjoint / sh:equals are also trinary relators, I don't think they have enough information available to meet this use case, due to the Open World assumption sneaking in to this one particular spot of SHACL.)

I can express this in SPARQL and get the entailment I'm looking for:

CONSTRUCT {
	$this a time:ProperInterval .
}
WHERE {
	$this
		a time:Interval ;
		time:inside
			?nInstant1 ,
			?nInstant2
			.
	?nInstant2 time:after ?nInstant1 .
}

(Edited by @ajnelson-nist - fixed variable usage, h/t to @afs for catching that)

In OWL, I do not believe it is possible to write a set of owl:Restrictions that let me entail time:ProperInterval by some owl:EquivalentClass or owl:allValuesFrom on inverted properties. It's possible to come close, saying "A proper interval is an interval that contains at least two instants, and vice versa" - but it doesn't quite work because of the semantics specific to OWL-Time:

time:ProperInterval
	owl:equivalentClass [
		a owl:Class ;
		rdfs:subClassOf
			time:Interval ,
			[
				a owl:Restriction ;
				owl:onProperty time:inside ;
				owl:minCardinality "2"^^xsd:nonNegativeInteger ;
			]
		] .

owl:equivalentClass says that anonymous class's conditions are necessary and sufficient. They're necessary, but insufficient - the two time:Instants linked by time:inside could pertain to the same temporal position. They need to be asserted as one time:after the other.

To my understanding, OWL was consciously designed to not have a way to say "Not only are there two time:Instants linked by time:inside, but those two instants are also linked together by time:after"---more generally, to not have trinary restrictions available. This SPARQL path can be followed in OWL spelling with a lot of owl:Restriction nesting (which I'll skip typing out), but nInterval1 doesn't get to know anything about how it relates directly to nInterval2, due to the Open World assumption.

?nInterval1 time:inside/time:after/^time:inside ?nInterval2 .

Resolution

SHACL-AF had provided sh:SPARQLRule, which can satisfy this use case with a SPARQL CONSTRUCT query. I suggest sh:SPARQLRule carry forward, though there is an interesting question of the concept's home between the SPARQL Rules and SHACL-SPARQL documents.

(And/or)

This seems like a good opportunity to test the Variable work going on in the Inferences Rules PR #452 .

Metadata

Metadata

Assignees

No one assigned

    Labels

    InferencingFor SHACL 1.2 Inferencing spec.UCRUse Cases and Requirements

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions