Question

How do I state in OWL that a Property must have a set of ordered values?

For example: a Programme must have an rdf:Seq of Series, and a Series must have an rdf:Seq of Episodes?

The http://purl.org/ontology/po/ ontology uses the property http://purl.org/ontology/po/position instead.

Which approach is better?

Was it helpful?

Solution

It's difficult in OWL (and RDF) to represent sequences, it's more about unordered sets of things. The best way to do this I find is to assign a number via a property, you then keep track of this index and use it to iterate over when needed.

The OWL ontology representing what you want to capture could be like that (using Manchester syntax - you can save as .owl file and open with Protege - # are comments):

Prefix: xsd: <http://www.w3.org/2001/XMLSchema#>
Prefix: owl: <http://www.w3.org/2002/07/owl#>
Prefix: : <brain#>
Prefix: xml: <http://www.w3.org/XML/1998/namespace>
Prefix: rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
Prefix: dc: <http://purl.org/dc/elements/1.1/>
Prefix: rdfs: <http://www.w3.org/2000/01/rdf-schema#>
Ontology: <brain.owl>

Datatype: xsd:int

ObjectProperty: has
  Characteristics: 
    Transitive

# Property used to save the number in the sequence
DataProperty: episode-number
  Range: 
    xsd:int

# Definition of a program: A program as at least a series
Class: Program
  SubClassOf: 
    has some Series

Class: owl:Thing

# Definition of series: A series as at least one episode
Class: Series
  SubClassOf: 
    has some Episode

Class: Episode

# Instance of episode
Individual: episode1
  Types: 
    Episode

  # Episode number
  Facts:  
   episode-number  "1"^^xsd:int

# Second instance of episode
Individual: episode2
  Types: 
    Episode

Facts:  
 episode-number  "2"^^xsd:int

Let's say that then you want to iterate over the episode instances. This can be achieved with the OWL query Episode and episode-number value 1. You have to take care of updating the number yourself.

OTHER TIPS

How do I state in OWL that a Property must have a set of ordered values? For example: a Programme must have an rdf:Seq of Series, and a Series must have an rdf:Seq of Episodes?

If you're working in OWL (DL), then you shouldn't really be using RDF collections. loopasam's answer is good if you can reify the relation and include the position numbers, but you can also declare your own list structure in OWL that's analogous to the RDF list (which is just an RDF encoding of a singly linked list). Thus you could have

:series hasEpisodeList [ ex:first :episodeA ;
                         ex:rest [ ex:first :episodeB ;
                                   ex:rest [ :episodeC ;
                                             ex:rest ex:nil ] ] ] .

The disadvantage to this approach, though, is that the number information is just implicit, and it's hard to reconstruct using DL queries (although it's not too hard using SPARQL). Both approaches to representing sequences are described in a bit more detail in Ordering of entities in an ontology and in the other questions and answers it links to.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top