0

I have some hierarchy and I need to write them in owl syntax. All objects are classes no individuals here.

The relation between classes in each hierarchy is the same. For example "relates" is the relation in one hierarchy between all classes.

How should I define these relations? I know object property but I need something like subClassof relation that is between all classes in the tree(protege).

Is it possible to define such a relation in owl syntax, how should I define it?

I did it but when i validated my file i got errors.

<?xml version="1.0"?>
<rdf:RDF
    xmlns="http://example.org/1#"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:owl="http://www.w3.org/2002/07/owl#"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
  xml:base="http://example.org/1">
  <owl:Ontology rdf:about="">
    <owl:versionInfo rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
    >Created with TopBraid Composer</owl:versionInfo>
  </owl:Ontology>
  <owl:Class rdf:ID="a">
    <haspart>
      <owl:Class rdf:ID="b"/>
    </haspart>
  </owl:Class>
  <rdf:Property rdf:ID="haspart">
    <rdfs:range rdf:resource="http://www.w3.org/2000/01/rdf-schema#Class"/>
    <rdfs:domain rdf:resource="http://www.w3.org/2000/01/rdf-schema#Class"/>
  </rdf:Property>
</rdf:RDF>

these are errors

Untyped Object Property: http://example.org/1#haspart Untyped Class: http://www.w3.org/2000/01/rdf-schema#Class

Persian
  • 45
  • 6
  • If you want to write your ontology manually, then do it! Why do you have a quetion opened about writing owl file?! I would still recommend using a tool like protege first to understand what it generates in Owl Syntax. Once you are familiar with the OWL, then you can start modeling your ontologies directly on a file. – Al-Punk Oct 27 '12 at 12:11
  • @ Armand plz check the question again i had completed it. – Persian Oct 27 '12 at 12:30
  • 2
    Honestly, take this advice: *Don't Write RDF/XML By Hand*. Use an ontology editor, like Protege, or if you prefer writing by hand, use a more convenient syntax, like Turtle, or Manchester Syntax. – Jeen Broekstra Oct 28 '12 at 04:34
  • @ Jeen Broekstra :can u write an owl file and show class a isPartOf class B.these are classes not individuals. – Persian Oct 28 '12 at 07:26
  • @ William Niu can you help me? – Persian Oct 31 '12 at 09:06

1 Answers1

4

The problem is in your definition of the hasPart relation. To get rid of the two errors you mention, you should first of all define it to be an owl:ObjectProperty rather than an rdf:Property, and second of all, the domains and ranges should point to http://www.w3.org/2002/07/owl#Class, not http://www.w3.org/2000/01/rdf-schema#Class.

But heed the advice in the comments: don't write RDF/XML syntax by hand. It's the worst possible way to learn how to use OWL.

FWIW, here's what your ontology (with corrections) would look like in Turtle:

@prefix : <http://example.org/1#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .

[] a owl:Ontology ;
   owl:versionInfo "Created with TopBraid Composer"^^xsd:string .

:a a owl:Class ;
   :hasPart :b .
:b a owl:Class .

:hasPart a owl:ObjectProperty ;
         rdfs:domain owl:Class ;
         rdfs:range owl:Class .
Jeen Broekstra
  • 21,642
  • 4
  • 51
  • 73
  • i had done this but when it validated the file i got error by owl-lite and owl-Dl but it was ok by Owl full. what should i do? – Persian Oct 28 '12 at 08:44
  • What you should do depends on what you need. I personally almost never worry about OWL Lite/DL validity, but whether or not it matters for you depends on what you want to use the ontology for. I suspect (haven't tested) that the reason the model is OWL Full is that OWL DL does not allow relationships between classes (at least OWL 1 does not, there is some way around this in OWL 2 I believe). – Jeen Broekstra Oct 29 '12 at 00:33
  • @ Jeen Broekstra if i use isPartOf instead of owl:ObjectProperty those errors will be removed for OWl(DL-EL-QL_RL). Is it true to do this? – Persian Oct 29 '12 at 07:49
  • @ontology, yes, that's possible, but OWL annotation properties are somewhat limited in their use, compared with object properties. See http://www.w3.org/TR/owl-ref/#Header for more information. – Jeen Broekstra Oct 29 '12 at 08:02
  • @ Jeen Broekstra i just need to have a graph that all nodes are connected through these relations(any kind:AnnotationProperty-object properties) and i want to write an inference engine to infer some info from my graph. do you think it is important what kind of property i use – Persian Oct 29 '12 at 08:33
  • @ Jeen Broekstra if i use annotation property to connect my classes can infer the results that i need from my ontology. – Persian Oct 31 '12 at 08:32
  • @Persian, well since you say you will write your own reasoner, of course you can. But we're getting a bit far afield here from the original question. – Jeen Broekstra Oct 31 '12 at 21:10