How to determine the type of elements in rdf: Seq?

I want to create a property that defines rdf:Seq as the rdfs:range object:

 eg:myProperty a rdf:Property; rdfs:range rdf:Seq; . 

I am looking for a way to determine the type of elements stored in rdf:Seq . For example, I do not want this:

 eg:typeOfElement a rdf:Class; . eg:somethingElse a rdf:Class; . [] eg:myProperty [ a rdf:Seq; rdf:_1 [a eg:typeOfElement]; # It the type I want rdf:_2 [a eg:typeOfElement]; # It the type I want rdf:_3 [a eg:somethingElse]; # I don't want this type ]; . 

Is there a way to determine that rdf:Seq elements are only of type eg:typeOfElement when I define eg:myProperty ?

(If necessary, I can use an owl.)

+5
source share
1 answer

There are probably several ways to do this, depending on your implementation preferences. My advice is to use rdf:li special property instead of an arbitrary rdf:_nnn , which is easier to extend. rdf:li equivalent to rdf:_1 , rdf:_2 in order. Thus, the following code blocks are equivalent:

 :mySeq a rdf:Seq; rdf:_1 :foo; rdf:_2 :bar . :mySeq a rdf:Seq; rdf:li :foo; rdf:li :bar . 

Please note that the order in the second block is significant.

To accomplish what you are asking, you can extend rdf:li with a new property and refine its domain / range (although they really make sense to readers, since the child property inherits the semantics of the parent):

 :myItem rdfs:subPropertyOf rdf:li; rdfs:range :typeOfElement; rdfs:domain :mySeq . 

:myItem inherits the semantics of rdf:li , so any implementation logic you have can conclude that the values :myItem are in some meaningful order. Next, define the class :mySeq through a property constraint:

 :mySeq rdfs:subClassOf [ a owl:Restriction; owl:onProperty :myItem; owl:allValuesFrom :typeOfElement;]. 

which claims that :mySeq is a class of all things, where the :myItem property :myItem explicitly used for :typeOfElement values. Now you can create lists with :mySeq .


To take another step, you can define :mySeq as the intersection of the above rule and rdf:Seq :

 :mySeq a owl:Class; owl:equivalentClass [ a owl:Class; owl:intersectionOf ( rdf:Seq [a owl:Restriction; owl:onProperty :myItem; owl:allValuesFrom :typeOfElement ]) ] . 

Note the use of owl:equivalentClass instead of rdfs:subClassOf . If we consider owl:equivalentClass as symmetric and substitute it under rdfs:subClassOf , for example:

 owl:equivalentClass a owl:SymmetricProperty . owl:equivalentClass rdfs:subPropertyOf rdfs:subClassOf . 

then we can have equivalence that goes both ways. Therefore, all rdf:Seq instances whose values ​​for :myItem have :typeOfElement are also :mySeq . In this case, you infer the type. So, through the instructions:

 :xa rdf:Seq; :myItem :foo, :bar . 

you can conclude that :xa :mySeq .

+3
source

All Articles