I just started using OWL for a project at the university.
The project is about pizza, which seems to be a common problem when it comes to RDF and OWL. So what we have to do first is model a pizza that consists of two toppings: tomatoes and cheese. I used the property madeof to connect them. This is a minimal code snippet that I tried to validate at: http://www.mygrid.org.uk/OWL/Validator
<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns="http://example.org/pizzeria#">
<owl:Ontology rdf:about=""/>
<!-- ========================= -->
<owl:Class rdf:ID="Topping"/>
<Topping rdf:ID="Cheese"/>
<Topping rdf:ID="Tomato"/>
<owl:ObjectProperty rdf:ID="madeOf">
<rdfs:range rdf:resource="#Topping"/>
<rdfs:domain rdf:resource="#Pizza"/>
</owl:ObjectProperty>
<!-- Pizza -->
<owl:Class rdf:ID="Pizza">
<!-- comes with Cheese and Tomato -->
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="#madeOf"/>
<owl:hasValue rdf:resource="#Tomato"/>
</owl:Restriction>
</rdfs:subClassOf>
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="#madeOf"/>
<owl:hasValue rdf:resource="#Cheese"/>
</owl:Restriction>
</rdfs:subClassOf>
</owl:Class>
</rdf:RDF>
However, the validator tells me:
OWL DL
Individual Value: restriction(a:madeOf value (a:Cheese))
Individual Value: restriction(a:madeOf value (a:Tomato))
OWL Full
Untyped Class: http://example.org/pizzeria#Topping
Which means, I guess, that the Toppings class was not defined (I think I did this…) and that something is wrong with the madeof property. I think I am doing something wrong here and am pretty much stuck at the moment.
Your OWL is fine, the only problem you have is with the XML encoding of RDF. Generally speaking, avoid working directly with RDF/XML if you can. Turtle is a much more compact and readable syntax, and has fewer gotchas than RDF/XML.
So the gotcha that you fell into is that, while you did define the expansion for the empty prefix:
you didn’t define the base URI for the document. Subject resources like:
will be interpreted as relative to the base URI, rather than as though they had a default blank prefix. See paragraph one, above!
The fix is to define the base URI as well as the default prefix: