What Are Properties? |
Next: Enriching Semantics With OWL Properties in RDF allow us to define or describe characteristics of Individuals of a Class. How do we define properties in RDF? We show you by extending our previous tutorial ontology to add some new simple properties of our own. After this tutorial, you should be able to:
Estimated time: 10 minutes You should have already understood the following tutorial (and pre-requisites) before you begin: ![]() 1. Some Common Properties We Have Used AlreadyIf you have already read through our previous What Are Classes And Individuals? tutorial, you will have learned how we used RDF Schema (RDFS) to define a set of classes, and some individuals. Here's the RDFS ontology document we created again: Without really mentioning it, we used several common predicates such as rdf:type, rdfs:label and rdfs:subClassOf to describe the characteristics of some of the resources in this document. For example, we gave the animal class the human readable label "A classification of all members of the animal kingdom" and used the rdf:type predicate to indicate it was an individual of the RDFS class rdfs:Class. We learned this is how we defined a new class in RDFS. These are pre-defined properties we have used - defined in the RDF and RDFS vocabularies, that many semantic web readers understand. But what if now want to enhance the definition of our animal classes with some further properties of our own? We can do this by defining our own properties in our ontology in addition to the classes we have already defined. 2. Defining A New PropertyLet's do this now. We'll define a simple literal property that gives us a 'pet name' for our animal class individuals that we've defined already: thing:bengie, thing:bonnie and thing:benjamin. In RDFS we can define a new property by stating that our resource is an individual of the class rdf:Property: Note the parallel with defining classes that we saw in our previous tutorial; rather like we define a new class by stating an individual of the RDFS class rdfs:Class, we define a new property by stating an individual of the rdf:Property class (yes, rdf:Property is a class - a class of all properties). Note If others import our ontology and see this property on individuals defined elsewhere, they'll know that this states the pet name of the individual of the class. We could have for example used rdfs:label to give the pet name - but this would have been too general for other consumers of our data to understand. Now we can start enriching our definition of the property immediately by starting to constrain what things this property can describe - starting with the domain of things that this property is validly applied to. 2.1 Property domainWe start in RDFS by indicating the domain over which this property is valid. The domain tells us what individuals (of a given class) this property is allowed to be applied to. In this case, we know that this new property should only be applied to individuals of the tutorial:animal class, and its subclasses. We can indicate this by using the rdfs:domain predicate: Now, if any semantic web reader sees this property applied to anything other than an individual of the class tutorial:animal, it can either flag an error or ignore it. But, we've also clearly stated that this property applies to individuals of tutorial:animal and made it granular (specific) enough to know that whatever value given to this property is always going to be a pet name (the text won't mean anything else). The rdfs:domain property is called 'transitive' in semantic web terms - because by defining a domain of the class tutorial:animal, we encapsulate all its subclasses too. ![]() NEW! Semantic Web Primer e-Book (First Edition) Includes all our primer tutorials. Plus two exclusive new tutorials on RDF syntaxes, and NoSQL databases found only in the e-Book. 2.2 Property rangeWe also know that our 'pet name' property is always going to be a textual value - or a literal value. We can indicate this using the RDFS range predicate, which indicates the range of valid values this property can hold. We don't have to state this, but we can in this case because we know we have a definite valid range. We can do this like so: Now we've defined the domain and range of our new property, we can apply it to the individuals of the tutorial:animal class we have defined already - Bengie our dog, Bonnie our cat and Benjamin our mouse. 3. Applying The New Property To Our IndividualsWe can now use our newly defined property just like any other property (predicate) we have used such as rdfs:label or rdf:type - by using it as a predicate and, in this case, setting the object value to the pet names like so: You can see now that we have given Bengie, Bonnie and Benjamin their literal names using our new property. As an exercise, see now that you can identify all the component parts we have learned of in these tutorials - the resources, classes, subclasses, individuals and properties. Note Hopefully, you can now see how classes and properties help us define the semantics (or, meaning) behind the data, as well as the data itself. We have defined a simple hierarchy of classifications, some individuals we wish to belong in those classifications, and a simple property we wish to apply to those individuals. We have also then defined some individuals, and given some values for that property. ![]() NEW! Semantic Web Primer e-Book (First Edition) Includes all our primer tutorials. Plus two exclusive new tutorials on RDF syntaxes, and NoSQL databases found only in the e-Book. 3.1 A Quick Note On Reasoning And InferenceAs we described in our previous tutorial on classes and individuals, a semantic web reader could infer simple added information from an RDF model, even if some information was missing. We can do more of the same here now we have added some properties. For example, the very fact that we have used tutorial:petName as a predicate in the ontology above means that (under RDF Schema), it is implicitly an instance of rdf:Property, because under RDFS all properties are individuals of rdf:Property. So, strictly speaking we can remove the statement from our ontology that states tutorial:petName is an individual of the rdf:Property class, because this is implied already. In addition, because we have explicitly stated that the domain of valid individuals for our tutorial:petName property was individuals in the tutorial:animal class only, we could have omitted the statement that Bengie, Bonnie or Benjamin were individuals of the tutorial:animal class - because the property itself implicitly states that they are individuals in this class by the fact we have chosen to apply this property to them. You have completed this lesson. You should now understand the following:
You should now be able to start the following tutorial:
![]() |