0

I want to use knowledge, which is modelled between classes. E.g. I have modelled a car and a bus have 4 wheels, a bike 2 wheels. Now, I want to express that bike can tip (if you don't keep them in balance - incompetent driver). If I add an instance "CB450", subClassOf Bike, a rule should enable reasoning: can(CB450,Tip). Way:

Type(Cb450,Bike) and has(Bike,TwoWheels) and can(TwoWheels,Tip) -> can (CB450,Tip)

I did not find any way to express this rule in SWRL, or Jena rules. Is there a possibility?

I know that it can be modelled differently, but I need to use class relations for rules in instances.

I use Protege 5.16 with pellet 2.3.1. See the example ontology below

Prefix: owl: <http://www.w3.org/2002/07/owl#>
Prefix: rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
Prefix: xml: <http://www.w3.org/XML/1998/namespace>
Prefix: xsd: <http://www.w3.org/2001/XMLSchema#>
Prefix: rdfs: <http://www.w3.org/2000/01/rdf-schema#>

Ontology: <http://www.semanticweb.org/vehicle>
ObjectProperty: <http://www.semanticweb.org/vehicle#has>
ObjectProperty: <http://www.semanticweb.org/vehicle#can>

Class: <http://www.semanticweb.org/vehicle#Car>

SubClassOf: 
    <http://www.semanticweb.org/vehicle#Vehicle>,
    <http://www.semanticweb.org/vehicle#has> some <http://www.semanticweb.org/vehicle#FourWheels>

Class: <http://www.semanticweb.org/vehicle#Vehicle>
Class: <http://www.semanticweb.org/vehicle#Bike>

SubClassOf: 
    <http://www.semanticweb.org/vehicle#Vehicle>,
    <http://www.semanticweb.org/vehicle#has> some     <http://www.semanticweb.org/vehicle#TwoWheels>

Class: <http://www.semanticweb.org/vehicle#FourWheels>

SubClassOf: 
    <http://www.semanticweb.org/vehicle#Property>
Class: <http://www.semanticweb.org/vehicle#TwoWheels>

SubClassOf: 
    <http://www.semanticweb.org/vehicle#can> some        <http://www.semanticweb.org/vehicle#Tip>,
    <http://www.semanticweb.org/vehicle#Property>

Class: <http://www.semanticweb.org/vehicle#Property>
Class: <http://www.semanticweb.org/vehicle#Tip>

SubClassOf: 
    <http://www.semanticweb.org/vehicle#Property>

Individual: <http://www.semanticweb.org/vehicle#CB450>

Types: 
    <http://www.semanticweb.org/vehicle#Bike>

Individual: <http://www.semanticweb.org/vehicle#Tip>

Types: 
    <http://www.semanticweb.org/vehicle#Tip>
2Application
  • 165
  • 10

1 Answers1

1

Based on the way you have explained the problem it looks like "CB40" isn't a subclass of Bike but rather an individual of type Bike. So say you have a class Vehicle, a data property hasWheels on Vehicle and a boolean property canTip on Vehicle, you can write a SWRL rule as

Vehicle(?x) ^ hasWheels(?x, 2) -> canTip(?x, true)

which translates as "A vehicle with two wheels can tip over" . The ?x is any individual of the specified type. So if you create a class Bike as a subclass of Vehicle and an individual CB40 of that class and set all the relevant data properties a reasoner will assign the canTip property to true for CB40

Kunal Khaladkar
  • 493
  • 3
  • 16
  • By the way, the ontology is written in Protege, so it should be ok. – 2Application Dec 14 '15 at 11:52
  • My bad, I was in a hurry when I typed out that answer and misread the code snippet. I'll edit once I am off mobile. – Kunal Khaladkar Dec 14 '15 at 11:59
  • I agree that your suggestions works, but every individual must have a data property "hasWheels", that is what I want to avoid. I tried to express that with relations between classes. I would like to create individuals which inherit such things from their class type without explicit model for every bike that it has 2 Wheels. Is that possible? – 2Application Dec 14 '15 at 11:59