Friday, March 30, 2007

Owl for lists

One of the slightly irritating thing about OWL for me is that there is no direct way of specifying a list of items.

Over the last day (using some great resources on the web) i have created a List class which allows lists of items to be specified. This means i can now define a category class that represents a category for a blog post as follows.

<owl:Class rdf:about="#Category">
<rdfs:comment rdf:datatype="&xsd;string">A simple category of the post.</rdfs:comment>
<rdfs:subClassOf>
<owl:Class rdf:about="&base;String"/>
</rdfs:subClassOf>
</owl:Class>


I can then define a list of Category classes as a Categories class which can then be used in other OWL classes i am working on as follows:


<owl:Class rdf:about="#Categories">
<rdfs:comment rdf:datatype="&xsd;string">A list of category of a post.</rdfs:comment>
<rdfs:subClassOf>
<owl:Class rdf:ID="&list;List" />
</rdfs:subClassOf>
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty>
<owl:ObjectProperty rdf:ID="&list;hasContents"/>
</owl:onProperty>
<owl:allValuesFrom rdf:resource="#Category"/>
</owl:Restriction>
</rdfs:subClassOf>
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty>
<owl:ObjectProperty rdf:ID="&list;isFollowedBy"/>
</owl:onProperty>
<owl:allValuesFrom rdf:resource="#Categories"/>
</owl:Restriction>
</rdfs:subClassOf>
</owl:Class>

No comments: