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

Implement and test ordering in observable:MessageThread #394

Merged
merged 10 commits into from
Jul 22, 2022
56 changes: 46 additions & 10 deletions ontology/uco/observable/observable.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# imports: https://ontology.unifiedcyberontology.org/uco/vocabulary

@prefix action: <https://ontology.unifiedcyberontology.org/uco/action/> .
@prefix co: <http://purl.org/co/> .
@prefix core: <https://ontology.unifiedcyberontology.org/uco/core/> .
@prefix identity: <https://ontology.unifiedcyberontology.org/uco/identity/> .
@prefix location: <https://ontology.unifiedcyberontology.org/uco/location/> .
Expand Down Expand Up @@ -3873,16 +3874,51 @@ observable:MessageThreadFacet
rdfs:comment "A message thread facet is a grouping of characteristics unique to a running commentary of electronic messages pertaining to one topic or question."@en ;
sh:property
[
sh:class observable:ObservableObject ;
sh:minCount "1"^^xsd:integer ;
sh:nodeKind sh:BlankNodeOrIRI ;
sh:path observable:message ;
sh:class observable:Message ;
sh:description "The contents of ordered items in the Thread linked by messageThread must be Message objects."@en ;
sh:path (
observable:messageThread
co:item
co:itemContent
) ;
] ,
[
sh:class observable:Message ;
sh:description "The contents of origin items in the Thread linked by messageThread must be Message objects."@en ;
sh:path (
observable:messageThread
types:threadOriginItem
co:itemContent
) ;
] ,
[
sh:class observable:Message ;
sh:description "The contents of terminal items in the Thread linked by messageThread must be Message objects."@en ;
sh:path (
observable:messageThread
types:threadTerminalItem
co:itemContent
) ;
] ,
[
sh:class observable:Message ;
sh:description "The contents of unordered items in the Thread linked by messageThread must be Message objects."@en ;
sh:path (
observable:messageThread
co:element
) ;
] ,
[
sh:class observable:ObservableObject ;
sh:nodeKind sh:BlankNodeOrIRI ;
sh:path observable:participant ;
] ,
[
sh:class types:Thread ;
sh:maxCount "1"^^xsd:integer ;
sh:nodeKind sh:BlankNodeOrIRI ;
sh:path observable:messageThread ;
] ,
[
sh:datatype xsd:boolean ;
sh:maxCount "1"^^xsd:integer ;
Expand Down Expand Up @@ -10618,12 +10654,6 @@ observable:maxRunTime
rdfs:range xsd:integer ;
.

observable:message
a owl:ObjectProperty ;
rdfs:label "message"@en ;
rdfs:range observable:ObservableObject ;
.

observable:messageID
a owl:DatatypeProperty ;
rdfs:label "messageID"@en ;
Expand All @@ -10638,6 +10668,12 @@ observable:messageText
rdfs:range xsd:string ;
.

observable:messageThread
a owl:ObjectProperty ;
rdfs:label "messageThread"@en ;
rdfs:range types:Thread ;
.

observable:messageType
a owl:DatatypeProperty ;
rdfs:label "messageType"@en ;
Expand Down
218 changes: 218 additions & 0 deletions ontology/uco/types/types.ttl
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# imports: https://ontology.unifiedcyberontology.org/co
# imports: https://ontology.unifiedcyberontology.org/uco/core
# imports: https://ontology.unifiedcyberontology.org/uco/vocabulary

@prefix co: <http://purl.org/co/> .
@prefix core: <https://ontology.unifiedcyberontology.org/uco/core/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
Expand All @@ -13,6 +16,7 @@
a owl:Ontology ;
rdfs:label "uco-types"@en ;
owl:imports
<https://ontology.unifiedcyberontology.org/co> ,
<https://ontology.unifiedcyberontology.org/uco/core> ,
<https://ontology.unifiedcyberontology.org/uco/vocabulary>
;
Expand Down Expand Up @@ -169,6 +173,42 @@ types:StructuredText
rdfs:comment "Expresses string-based data in some information structuring format (e.g., HTML5)."@en ;
.

types:Thread
a
owl:Class ,
sh:NodeShape
;
rdfs:subClassOf
co:Bag ,
core:UcoObject
;
rdfs:label "Thread"@en ;
rdfs:comment "A semi-ordered array of items, that can be present in multiple copies. Implemetation of a UCO Thread is similar to a Collections Ontology List, except a Thread may fork and merge - that is, one of its members may have two or more direct successors, and two or more direct predecessors."@en ;
owl:disjointWith co:List ;
sh:property [
sh:class types:ThreadItem ;
sh:path co:item ;
] ;
.

types:ThreadItem
a
owl:Class ,
sh:NodeShape
;
rdfs:subClassOf
co:Item ,
core:UcoObject
;
rdfs:label "ThreadItem"@en ;
rdfs:comment "A ThreadItem is a member of a thread."@en ;
owl:disjointWith co:ListItem ;
sh:property [
sh:class core:UcoObject ;
sh:path co:itemContent ;
] ;
.

types:entry
a owl:ObjectProperty ;
rdfs:label "entry"@en ;
Expand Down Expand Up @@ -209,6 +249,184 @@ types:key
rdfs:range xsd:string ;
.

types:threadNextItem
a owl:ObjectProperty ;
rdfs:subPropertyOf types:threadSuccessor ;
rdfs:label "threadNextItem"@en ;
rdfs:comment "The link to a next item in a thread."@en ;
rdfs:seeAlso co:nextItem ;
.

types:threadNextItem-subjects-shape
a sh:PropertyShape ;
sh:class types:ThreadItem ;
sh:nodeKind sh:BlankNodeOrIRI ;
sh:path types:threadNextItem ;
sh:targetSubjectsOf types:threadNextItem ;
.

types:threadOriginItem
a owl:ObjectProperty ;
rdfs:subPropertyOf co:item ;
rdfs:label "threadOriginItem"@en ;
rdfs:comment "A link to an item of the thread known to have no predecessor."@en ;
rdfs:domain types:Thread ;
rdfs:range [
a owl:Class ;
owl:intersectionOf (
types:ThreadItem
[
a owl:Restriction ;
owl:onProperty types:threadPreviousItem ;
owl:cardinality "0"^^xsd:nonNegativeInteger ;
]
) ;
] ;
rdfs:seeAlso co:firstItem ;
.

types:threadOriginItem-subjects-shape
a sh:PropertyShape ;
sh:class types:ThreadItem ;
sh:nodeKind sh:BlankNodeOrIRI ;
sh:path types:threadOriginItem ;
sh:targetSubjectsOf types:threadOriginItem ;
.

types:threadOriginItem-subjects-threadPredecessor-shape
a sh:PropertyShape ;
sh:description "An origin item in a thread must not have a predecessor."@en ;
sh:maxCount "0"^^xsd:integer ;
sh:nodeKind sh:BlankNodeOrIRI ;
sh:path (
types:threadOriginItem
types:threadPredecessor
) ;
sh:targetSubjectsOf types:threadOriginItem ;
.

types:threadOriginItem-subjects-threadPreviousItem-shape
a sh:PropertyShape ;
sh:description "An origin item in a thread must not have a previous item."@en ;
sh:maxCount "0"^^xsd:integer ;
sh:nodeKind sh:BlankNodeOrIRI ;
sh:path (
types:threadOriginItem
types:threadPreviousItem
) ;
sh:targetSubjectsOf types:threadOriginItem ;
.

types:threadPredecessor
a
owl:ObjectProperty ,
owl:TransitiveProperty
;
rdfs:label "threadPredecessor"@en ;
rdfs:comment "The link to the preceding item in a thread."@en ;
rdfs:domain types:ThreadItem ;
rdfs:range types:ThreadItem ;
rdfs:seeAlso co:precededBy ;
owl:inverseOf types:threadSuccessor ;
.

types:threadPredecessor-subjects-shape
a sh:PropertyShape ;
sh:class types:ThreadItem ;
sh:nodeKind sh:BlankNodeOrIRI ;
sh:path types:threadPredecessor ;
sh:targetSubjectsOf types:threadPredecessor ;
.

types:threadPreviousItem
a owl:ObjectProperty ;
rdfs:subPropertyOf types:threadPredecessor ;
rdfs:label "threadPreviousItem"@en ;
rdfs:comment "A direct link to a previous item in a thread."@en ;
rdfs:seeAlso co:previousItem ;
owl:inverseOf types:threadNextItem ;
.

types:threadPreviousItem-subjects-shape
a sh:PropertyShape ;
sh:class types:ThreadItem ;
sh:nodeKind sh:BlankNodeOrIRI ;
sh:path types:threadPreviousItem ;
sh:targetSubjectsOf types:threadPreviousItem ;
.

types:threadSuccessor
a
owl:ObjectProperty ,
owl:TransitiveProperty
;
rdfs:label "threadSuccessor"@en ;
rdfs:comment "A link to a following item in a thread."@en ;
rdfs:domain types:ThreadItem ;
rdfs:range types:ThreadItem ;
rdfs:seeAlso co:followedBy ;
.

types:threadSuccessor-subjects-shape
a sh:PropertyShape ;
sh:class types:ThreadItem ;
sh:nodeKind sh:BlankNodeOrIRI ;
sh:path types:threadSuccessor ;
sh:targetSubjectsOf types:threadSuccessor ;
.

types:threadTerminalItem
a owl:ObjectProperty ;
rdfs:subPropertyOf co:item ;
rdfs:label "threadTerminalItem"@en ;
rdfs:comment "A link to an item of the thread known to have no successor."@en ;
rdfs:domain types:Thread ;
rdfs:range [
a owl:Class ;
owl:intersectionOf (
types:ThreadItem
[
a owl:Restriction ;
owl:onProperty types:threadNextItem ;
owl:cardinality "0"^^xsd:nonNegativeInteger ;
]
) ;
] ;
rdfs:seeAlso co:lastItem ;
.

types:threadTerminalItem-subjects-shape
a sh:PropertyShape ;
sh:class types:ThreadItem ;
sh:nodeKind sh:BlankNodeOrIRI ;
sh:path types:threadTerminalItem ;
sh:targetSubjectsOf types:threadTerminalItem ;
.

types:threadTerminalItem-subjects-threadNextItem-shape
a sh:PropertyShape ;
sh:description "A terminal item in a thread must not have a next item."@en ;
sh:maxCount "0"^^xsd:integer ;
sh:nodeKind sh:BlankNodeOrIRI ;
sh:path (
types:threadTerminalItem
types:threadNextItem
) ;
sh:targetSubjectsOf types:threadTerminalItem ;
.

types:threadTerminalItem-subjects-threadSuccessor-shape
a sh:PropertyShape ;
sh:description "A terminal item in a thread must not have a successor."@en ;
sh:maxCount "0"^^xsd:integer ;
sh:nodeKind sh:BlankNodeOrIRI ;
sh:path (
types:threadTerminalItem
types:threadSuccessor
) ;
sh:targetSubjectsOf types:threadTerminalItem ;
.

types:value
a owl:DatatypeProperty ;
rdfs:label "value"@en ;
Expand Down
12 changes: 10 additions & 2 deletions tests/examples/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,12 @@ all: \
hash_XFAIL_validation.ttl \
location_PASS_validation.ttl \
location_XFAIL_validation.ttl \
message_thread_PASS_validation.ttl \
message_thread_XFAIL_validation.ttl \
relationship_PASS_validation.ttl \
relationship_XFAIL_validation.ttl
relationship_XFAIL_validation.ttl \
thread_PASS_validation.ttl \
thread_XFAIL_validation.ttl

.PRECIOUS: \
%_validation.ttl
Expand Down Expand Up @@ -78,8 +82,12 @@ check: \
hash_XFAIL_validation.ttl \
location_PASS_validation.ttl \
location_XFAIL_validation.ttl \
message_thread_PASS_validation.ttl \
message_thread_XFAIL_validation.ttl \
relationship_PASS_validation.ttl \
relationship_XFAIL_validation.ttl
relationship_XFAIL_validation.ttl \
thread_PASS_validation.ttl \
thread_XFAIL_validation.ttl
source $(tests_srcdir)/venv/bin/activate \
&& pytest \
--log-level=DEBUG
Expand Down
Loading