-
Notifications
You must be signed in to change notification settings - Fork 2
Modeling Instructions for OWL
The Web Ontology Language (owl) is the standard we use to model data vocabularies. Its foundation on predicate logic and the open world assumption, makes that it allows us to model definitions in a manner that makes them reusable across use cases (applications/datasets).
The things we want to define in our vocabulary models might have labels and definitions in different languages. Metamorph uses the labels to render the objects in a schema in a specific language if so specified. If the schema supports this, it will also render the definitions inside the schema. For the definition, the value with the @en language tag is used by default.
ex:ClassA a owl:Class ;
skos:prefLabel "ClassA"@en ;
skos:prefLabel "KlasseA"@nl ;
skos:definition "A class that can be used for the purposes of this definition"@en ;
skos:definition "een Klasse die gebruikt kan worden ten behoeve van "@nl .As you can see, Metamorph prefers the use of SKOS annotations. However, many standards annotate their definitions with rdfs:label and rdfs:commment. So Metamorph supports this syntax as well. However, if multiple labels/comments in the same language are assigned to the same class, this might result in unexpected behavior in how these annotations are added to the schema.
ex:ClassA a owl:Class ;
rdfs:label "ClassA"@en ;
rdfs:label "KlasseA"@nl ;
rdfs:comment "A class that can be used for the purposes of this definition"@en ;
rdfs:comment "een Klasse die gebruikt kan worden ten behoeve van "@nl .In this section we'll look at how to model things and sets of things.
In data we often want to use a single definition to describe many individuals. For example, we want a way to talk about all cars as opposed to having to list all the cars we want to refer to individually. In OWL, this is modeled using owl:Class.
An example with a label and a defintion in two languages can be found below.
ex:ClassA a owl:Class ;
skos:prefLabel "ClassA"@en ;
skos:prefLabel "KlasseA"@nl ;
skos:definition "A class that can be used for the purposes of this definition"@en ;
skos:definition "een Klasse die gebruikt kan worden ten behoeve van "@nl .Individuals are typically the individual things about which we store information. These individuals aren't necessarily an instance of some class. In the context of data modeling and schema generation, we tend to use them to model enumerations in an enumerated class.
ex:individual1 a ex:SomeEnumeration ;
skos:prefLabel "IndividualOne"@en ;
skos:prefLabel "IndividuEen"@nl ;
skos:definition "an example individual that may be one choice in an enumerated class"@en .Sometimes we know something about how sets of things relate to each other that we want to express in a model.
If all individuals of set A are also members of set B, then we can say that set A is a subset of set B. An example of this would be that all dogs are mammals.
In RDFS/OWL, this is modeled using the rdfs:subClassOf relationship:
ex:Dogs a owl:Class ;
rdfs:subClassOf ex:Mammals .Sometimes we know that two sets share no individuals. An example is the set of fish and the set of mammals. We can express this in OWL as follows:
ex:Fish a owl:Class ;
owl:disjointWith ex:Mammals .While this relationship is not typically used in rendering schemas, declaring that two sets are disjoint can give a lot of context to the intended meaning of a definition, and can be very useful when integrating datasets from different domains.
Now that we are able to define things, we'd like to also be able to define characteristics of these things.
Many properties we'd like to capture about things take on simple values, such as name which is a string, or age which is a floating point number.
To model simple values as properties, we use owl:DatatypeProperty:
ex:name a owl:DatatypeProperty ;
skos:prefLabel "Naam"@nl ;
skos:definition "The symbol by which a person, place or thing is known" @en ;
rdfs:domain owl:Thing ;
rdfs:range xsd:string .Out of the box, Metamorph knows how to map the primitive value definitions specified in the xsd namespace onto those of the target schema.
Other properties of things are actually relationships between things. For example, ex:livesIn is a property of a person, but the value is typically a settlement or region about which we want to say other things.
ex:livesIn a owl:ObjectProperty ;
skos:prefLabel "woontIn"@nl ;
skos:definition "The place in which a person resides"@en ;
rdfs:domain ex:Person ;
rdfs:range ex:Settlement , ex:Region, ex:Country .Sometimes relationships behave in a specific way.
Sometimes relationships are transitive. What that means is explained best by an example.
Consider the relation "smaller than". Say we know that:
- Alice is smaller than Bob
- Bob is smaller than Carol
Because "smaller than" is transitive, we can infer:
- Alice is smaller then Carol
So, in general:
A transitive property is such that if
Arelates toB, andBrelates toC, thenAalso relates toC.
In OWL, this is modeled with the owl:TransitiveProperty relationship:
ex:smallerThan a owl:TransitiveProperty ;
skos:definition "when one thing is smaller than another thing"@en ;
rdfs:domain ex:PhysicalObject ;
rdfs:range ex:PhysicalObject .Note that owl:TransitiveProperty are subproperties of owl:ObjectProperties and may therefore be interpreted as such.
Sometimes a relationship from A to B is implicitly also true from B to A. For instance, if Alice if family of Bob, then Bob is also family of Alice.
The symmetric relation ex:hasFamilyMember can be modeled in OWL as follows:
ex:hasFamilyMember a owl:SymmetricProperty ;
skos:label "isCollegaVan"@nl ;
skos:definition "relates a person to another person who are family"@en ;
rdfs:domain ex:Person ;
rdfs:range ex:Person ;Sometimes we want to specify how different properties relate to each other.
Sometimes a relation is a special case of another relation. For example: ex:hasSibling is a specialization of ex:hasFamilyMember. This is mostly relevant for when you want to query data, in which case a query on ex:hasFamilyMember should ideally also return the ex:hasSibling relation. This is modeled using rdfs:subPropertyOf:
ex:hasSibling a owl:SymmetricProperty ;
rdfs:subPropertyOf ex:hasFamilyMember ;
skos:definition "When two people share one or more parents"@en ;
rdfs:domain ex:Person ;
rdfs:range ex:personSometimes there are relationships that are inverse of each other. For example, if a person has a "wrote" relationship to a book, then that book has a "was written by" relationship to that person. This is modeled using the owl:inverseOf relationship:
ex:wrote a owl:ObjectProperty ;
owl:inverseOf ex:wasWrittenBy ;
skos:definition "the relationship between the author and written work"@en ;
rdfs:domain ex:Person ;
rdfs:range ex:Book, ex:Poem, ex:Essay, ex:Report .Most schemas ignore this information, but for generating UML class diagrams this is useful information, as it significantly reduces the amount of association lines that need to be drawn.