I have an example ontology in Protege 5.5 (I added it below). With this ontology I need to classify individuals according to their object properties. My rules are like these;
if an individual A (
subClassOf: A
) has exact 1 object property (hasRelation
) with B (subClassOf: B
) OR individual B (subClassOf: B
) has exact 1 object property (hasRelation
) with A (subClassOf: A
) then it issubClassOf: OneToOne
.
if an individual A (
subClassOf: A
) has min 2 object properties (hasRelation
) with B (subClassOf: B
) then it issubClassOf: ManyToOne
.
if an individual B (
subClassOf: B
) has min 2 object properties (hasRelation
) with A (subClassOf: A
) then it issubClassOf: OneToMany
.
if an individual A (
subClassOf: A
) has min 2 object properties (hasRelation
) with A (subClassOf: A
) AND B (subClassOf: B
) has min 2 object properties (hasRelation
) with A (subClassOf: A
) then it issubClassOf: ManyToMany
.
I think maybe this can be done with SWRL but I couldn't make it work.
Any idea appreciated.
Prefix: : <http://www.semanticweb.org/ontologies/example#>
Prefix: owl: <http://www.w3.org/2002/07/owl#>
Prefix: rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
Prefix: rdfs: <http://www.w3.org/2000/01/rdf-schema#>
Prefix: xml: <http://www.w3.org/XML/1998/namespace>
Prefix: xsd: <http://www.w3.org/2001/XMLSchema#>
Ontology: <http://www.semanticweb.org/ontologies/example>
ObjectProperty: hasRelation
Characteristics:
Symmetric
Class: A
SubClassOf:
Data
Class: B
SubClassOf:
Data
Class: Data
Class: ManyToMany
SubClassOf:
RelationType
Class: ManyToOne
SubClassOf:
RelationType
Class: OneToMany
SubClassOf:
RelationType
Class: OneToOne
SubClassOf:
RelationType
Class: RelationType
Individual: A1
Facts:
hasRelation B1
Individual: A2
Facts:
hasRelation B2
Individual: A3
Facts:
hasRelation B2
Individual: A4
Facts:
hasRelation B3,
hasRelation B4
Individual: B1
Individual: B2
Individual: B3
Individual: B4
DisjointClasses:
ManyToMany,ManyToOne,OneToMany,OneToOne