[TASK] Introduce CarModel which can have CarInstances.

This commit is contained in:
Jan Philipp Timme 2016-08-17 15:48:13 +02:00
parent 9c8d49c6e8
commit 0338739c4d
5 changed files with 166 additions and 60 deletions

View File

@ -7,15 +7,56 @@
xmlns:simobjects="http://example.org/carSim/objects#" xmlns:simobjects="http://example.org/carSim/objects#"
xmlns:simontology="http://example.org/carSim/carSimulationOntology#"> xmlns:simontology="http://example.org/carSim/carSimulationOntology#">
<!-- Car data --> <!-- Car data -->
<owl:NamedIndividual rdf:about="http://example.org/carSim/objects/Car#0"> <owl:NamedIndividual rdf:about="http://example.org/carSim/objects/Car#0">
<rdf:type rdf:resource="http://example.org/carSim/carSimulationOntology#Car"/> <rdf:type rdf:resource="http://example.org/carSim/carSimulationOntology#Car"/>
<simontology:isDrivenBy rdf:resource="http://example.org/carSim/objects/Driver#0"/> <simontology:isCarModel rdf:resource="http://example.org/carSim/objects/CarModel#0"/>
<simontology:maximumMotorRPM rdf:datatype="xsd:integer">3500</simontology:maximumMotorRPM> </owl:NamedIndividual>
<simontology:maximumTirePressure rdf:datatype="xsd:double">3.5</simontology:maximumTirePressure>
<simontology:minimumMotorRPM rdf:datatype="xsd:integer">800</simontology:minimumMotorRPM> <owl:NamedIndividual rdf:about="http://example.org/carSim/objects/Car#1">
<rdf:type rdf:resource="http://example.org/carSim/carSimulationOntology#Car"/>
<simontology:isCarModel rdf:resource="http://example.org/carSim/objects/CarModel#2"/>
</owl:NamedIndividual>
<owl:NamedIndividual rdf:about="http://example.org/carSim/objects/Car#2">
<rdf:type rdf:resource="http://example.org/carSim/carSimulationOntology#Car"/>
<simontology:isCarModel rdf:resource="http://example.org/carSim/objects/CarModel#1"/>
</owl:NamedIndividual>
<owl:NamedIndividual rdf:about="http://example.org/carSim/objects/Car#3">
<rdf:type rdf:resource="http://example.org/carSim/carSimulationOntology#Car"/>
<simontology:isCarModel rdf:resource="http://example.org/carSim/objects/CarModel#0"/>
</owl:NamedIndividual>
<!-- Car Model data -->
<owl:NamedIndividual rdf:about="http://example.org/carSim/objects/CarModel#0">
<rdf:type rdf:resource="http://example.org/carSim/carSimulationOntology#CarModel"/>
<simontology:minimumMotorRPM rdf:datatype="xsd:integer">2000</simontology:minimumMotorRPM>
<simontology:maximumMotorRPM rdf:datatype="xsd:integer">4300</simontology:maximumMotorRPM>
<simontology:minimumTirePressure rdf:datatype="xsd:double">2.9</simontology:minimumTirePressure> <simontology:minimumTirePressure rdf:datatype="xsd:double">2.9</simontology:minimumTirePressure>
<simontology:maximumTirePressure rdf:datatype="xsd:double">3.2</simontology:maximumTirePressure>
<simontology:requiresDriverLicense rdf:datatype="xsd:string">B</simontology:requiresDriverLicense>
</owl:NamedIndividual>
<owl:NamedIndividual rdf:about="http://example.org/carSim/objects/CarModel#1">
<rdf:type rdf:resource="http://example.org/carSim/carSimulationOntology#CarModel"/>
<simontology:minimumMotorRPM rdf:datatype="xsd:integer">800</simontology:minimumMotorRPM>
<simontology:maximumMotorRPM rdf:datatype="xsd:integer">1900</simontology:maximumMotorRPM>
<simontology:minimumTirePressure rdf:datatype="xsd:double">3.5</simontology:minimumTirePressure>
<simontology:maximumTirePressure rdf:datatype="xsd:double">3.8</simontology:maximumTirePressure>
<simontology:requiresDriverLicense rdf:datatype="xsd:string">B</simontology:requiresDriverLicense>
</owl:NamedIndividual>
<owl:NamedIndividual rdf:about="http://example.org/carSim/objects/CarModel#2">
<rdf:type rdf:resource="http://example.org/carSim/carSimulationOntology#CarModel"/>
<simontology:minimumMotorRPM rdf:datatype="xsd:integer">1400</simontology:minimumMotorRPM>
<simontology:maximumMotorRPM rdf:datatype="xsd:integer">2500</simontology:maximumMotorRPM>
<simontology:minimumTirePressure rdf:datatype="xsd:double">2.6</simontology:minimumTirePressure>
<simontology:maximumTirePressure rdf:datatype="xsd:double">3.0</simontology:maximumTirePressure>
<simontology:requiresDriverLicense rdf:datatype="xsd:string">B</simontology:requiresDriverLicense> <simontology:requiresDriverLicense rdf:datatype="xsd:string">B</simontology:requiresDriverLicense>
</owl:NamedIndividual> </owl:NamedIndividual>
@ -24,10 +65,38 @@
<owl:NamedIndividual rdf:about="http://example.org/carSim/objects/Driver#0"> <owl:NamedIndividual rdf:about="http://example.org/carSim/objects/Driver#0">
<rdf:type rdf:resource="http://example.org/carSim/carSimulationOntology#Driver"/> <rdf:type rdf:resource="http://example.org/carSim/carSimulationOntology#Driver"/>
<simontology:drives rdf:resource="http://example.org/carSim/objects/Car#0"/> <simontology:hasName rdf:datatype="xsd:string">Max Mustermann</simontology:hasName>
<simontology:hasName rdf:datatype="xsd:string">Max</simontology:hasName> <simontology:hasPhoneNumber rdf:datatype="xsd:string">+49 111 123456789</simontology:hasPhoneNumber>
<simontology:hasPhoneNumber rdf:datatype="xsd:string">+49 12345</simontology:hasPhoneNumber>
<simontology:hasDriverLicense rdf:datatype="xsd:string">B</simontology:hasDriverLicense> <simontology:hasDriverLicense rdf:datatype="xsd:string">B</simontology:hasDriverLicense>
</owl:NamedIndividual> </owl:NamedIndividual>
<owl:NamedIndividual rdf:about="http://example.org/carSim/objects/Driver#1">
<rdf:type rdf:resource="http://example.org/carSim/carSimulationOntology#Driver"/>
<simontology:hasName rdf:datatype="xsd:string">Simone Mustermann</simontology:hasName>
<simontology:hasPhoneNumber rdf:datatype="xsd:string">+49 111 321654987</simontology:hasPhoneNumber>
<simontology:hasDriverLicense rdf:datatype="xsd:string">B</simontology:hasDriverLicense>
</owl:NamedIndividual>
<owl:NamedIndividual rdf:about="http://example.org/carSim/objects/Driver#2">
<rdf:type rdf:resource="http://example.org/carSim/carSimulationOntology#Driver"/>
<simontology:hasName rdf:datatype="xsd:string">Carl Chaos</simontology:hasName>
<simontology:hasPhoneNumber rdf:datatype="xsd:string">+49 111 112112112</simontology:hasPhoneNumber>
<simontology:hasDriverLicense rdf:datatype="xsd:string">B</simontology:hasDriverLicense>
</owl:NamedIndividual>
<owl:NamedIndividual rdf:about="http://example.org/carSim/objects/Driver#3">
<rdf:type rdf:resource="http://example.org/carSim/carSimulationOntology#Driver"/>
<simontology:hasName rdf:datatype="xsd:string">Vincent Vorsicht</simontology:hasName>
<simontology:hasPhoneNumber rdf:datatype="xsd:string">+49 111 000000000</simontology:hasPhoneNumber>
<simontology:hasDriverLicense rdf:datatype="xsd:string">B</simontology:hasDriverLicense>
</owl:NamedIndividual>
<owl:NamedIndividual rdf:about="http://example.org/carSim/objects/Driver#4">
<rdf:type rdf:resource="http://example.org/carSim/carSimulationOntology#Driver"/>
<simontology:hasName rdf:datatype="xsd:string">Erwin Eilig</simontology:hasName>
<simontology:hasPhoneNumber rdf:datatype="xsd:string">+49 111 007007007</simontology:hasPhoneNumber>
<simontology:hasDriverLicense rdf:datatype="xsd:string">B</simontology:hasDriverLicense>
</owl:NamedIndividual>
</rdf:RDF> </rdf:RDF>

View File

@ -35,6 +35,16 @@
<!-- http://example.org/carSim/carSimulationOntology#hasCarInstances -->
<owl:ObjectProperty rdf:about="http://example.org/carSim/carSimulationOntology#hasCarInstances">
<owl:inverseOf rdf:resource="http://example.org/carSim/carSimulationOntology#isOfCarModel"/>
<rdfs:domain rdf:resource="http://example.org/carSim/carSimulationOntology#CarModel"/>
<rdfs:range rdf:resource="http://example.org/carSim/carSimulationOntology#Car"/>
</owl:ObjectProperty>
<!-- http://example.org/carSim/carSimulationOntology#isDrivenBy --> <!-- http://example.org/carSim/carSimulationOntology#isDrivenBy -->
<owl:ObjectProperty rdf:about="http://example.org/carSim/carSimulationOntology#isDrivenBy"> <owl:ObjectProperty rdf:about="http://example.org/carSim/carSimulationOntology#isDrivenBy">
@ -44,6 +54,15 @@
<!-- http://example.org/carSim/carSimulationOntology#isOfCarModel -->
<owl:ObjectProperty rdf:about="http://example.org/carSim/carSimulationOntology#isOfCarModel">
<rdfs:domain rdf:resource="http://example.org/carSim/carSimulationOntology#Car"/>
<rdfs:range rdf:resource="http://example.org/carSim/carSimulationOntology#CarModel"/>
</owl:ObjectProperty>
<!-- http://example.org/carSim/carSimulationOntology#relatedCar --> <!-- http://example.org/carSim/carSimulationOntology#relatedCar -->
<owl:ObjectProperty rdf:about="http://example.org/carSim/carSimulationOntology#relatedCar"> <owl:ObjectProperty rdf:about="http://example.org/carSim/carSimulationOntology#relatedCar">
@ -85,25 +104,6 @@
<!-- http://example.org/carSim/carSimulationOntology#hasName -->
<owl:DatatypeProperty rdf:about="http://example.org/carSim/carSimulationOntology#hasName">
<rdfs:domain rdf:resource="http://example.org/carSim/carSimulationOntology#Car"/>
<rdfs:domain rdf:resource="http://example.org/carSim/carSimulationOntology#Driver"/>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
</owl:DatatypeProperty>
<!-- http://example.org/carSim/carSimulationOntology#hasPhoneNumber -->
<owl:DatatypeProperty rdf:about="http://example.org/carSim/carSimulationOntology#hasPhoneNumber">
<rdfs:domain rdf:resource="http://example.org/carSim/carSimulationOntology#Driver"/>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
</owl:DatatypeProperty>
<!-- http://example.org/carSim/carSimulationOntology#handbrakeEngaged --> <!-- http://example.org/carSim/carSimulationOntology#handbrakeEngaged -->
<owl:DatatypeProperty rdf:about="http://example.org/carSim/carSimulationOntology#handbrakeEngaged"> <owl:DatatypeProperty rdf:about="http://example.org/carSim/carSimulationOntology#handbrakeEngaged">
@ -123,6 +123,25 @@
<!-- http://example.org/carSim/carSimulationOntology#hasName -->
<owl:DatatypeProperty rdf:about="http://example.org/carSim/carSimulationOntology#hasName">
<rdfs:domain rdf:resource="http://example.org/carSim/carSimulationOntology#Car"/>
<rdfs:domain rdf:resource="http://example.org/carSim/carSimulationOntology#Driver"/>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
</owl:DatatypeProperty>
<!-- http://example.org/carSim/carSimulationOntology#hasPhoneNumber -->
<owl:DatatypeProperty rdf:about="http://example.org/carSim/carSimulationOntology#hasPhoneNumber">
<rdfs:domain rdf:resource="http://example.org/carSim/carSimulationOntology#Driver"/>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
</owl:DatatypeProperty>
<!-- http://example.org/carSim/carSimulationOntology#locked --> <!-- http://example.org/carSim/carSimulationOntology#locked -->
<owl:DatatypeProperty rdf:about="http://example.org/carSim/carSimulationOntology#locked"> <owl:DatatypeProperty rdf:about="http://example.org/carSim/carSimulationOntology#locked">
@ -260,6 +279,12 @@
<!-- http://example.org/carSim/carSimulationOntology#CarModel -->
<owl:Class rdf:about="http://example.org/carSim/carSimulationOntology#CarModel"/>
<!-- http://example.org/carSim/carSimulationOntology#CarReturnedEvent --> <!-- http://example.org/carSim/carSimulationOntology#CarReturnedEvent -->
<owl:Class rdf:about="http://example.org/carSim/carSimulationOntology#CarReturnedEvent"> <owl:Class rdf:about="http://example.org/carSim/carSimulationOntology#CarReturnedEvent">

View File

@ -2,65 +2,77 @@
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"> xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
<rdf:Description rdf:about="http://jpt.lu/carSimulationOntology#Car"> <rdf:Description rdf:about="http://example.org/carSim/carSimulationOntology#Car">
</rdf:Description> </rdf:Description>
<rdf:Description rdf:about="http://jpt.lu/carSimulationOntology#Driver"> <rdf:Description rdf:about="http://example.org/carSim/carSimulationOntology#CarModel">
</rdf:Description> </rdf:Description>
<rdf:Description rdf:about="http://jpt.lu/carSimulationOntology#Event"> <rdf:Description rdf:about="http://example.org/carSim/carSimulationOntology#Driver">
</rdf:Description> </rdf:Description>
<rdf:Description rdf:about="http://jpt.lu/carSimulationOntology#CarEvent"> <rdf:Description rdf:about="http://example.org/carSim/carSimulationOntology#Event">
<rdfs:subClassOf rdf:resource="http://jpt.lu/carSimulationOntology#Event"/>
</rdf:Description> </rdf:Description>
<rdf:Description rdf:about="http://jpt.lu/carSimulationOntology#CarAirbagEvent"> <rdf:Description rdf:about="http://example.org/carSim/carSimulationOntology#CarEvent">
<rdfs:subClassOf rdf:resource="http://jpt.lu/carSimulationOntology#CarEvent"/> <rdfs:subClassOf rdf:resource="http://example.org/carSim/carSimulationOntology#Event"/>
</rdf:Description> </rdf:Description>
<rdf:Description rdf:about="http://jpt.lu/carSimulationOntology#CarStatusEvent"> <rdf:Description rdf:about="http://example.org/carSim/carSimulationOntology#CarAirbagEvent">
<rdfs:subClassOf rdf:resource="http://jpt.lu/carSimulationOntology#CarEvent"/> <rdfs:subClassOf rdf:resource="http://example.org/carSim/carSimulationOntology#CarEvent"/>
</rdf:Description> </rdf:Description>
<rdf:Description rdf:about="http://jpt.lu/carSimulationOntology#CarUserEvent"> <rdf:Description rdf:about="http://example.org/carSim/carSimulationOntology#CarStatusEvent">
<rdfs:subClassOf rdf:resource="http://jpt.lu/carSimulationOntology#CarEvent"/> <rdfs:subClassOf rdf:resource="http://example.org/carSim/carSimulationOntology#CarEvent"/>
</rdf:Description> </rdf:Description>
<rdf:Description rdf:about="http://jpt.lu/carSimulationOntology#CarTakenEvent"> <rdf:Description rdf:about="http://example.org/carSim/carSimulationOntology#CarUserEvent">
<rdfs:subClassOf rdf:resource="http://jpt.lu/carSimulationOntology#CarUserEvent"/> <rdfs:subClassOf rdf:resource="http://example.org/carSim/carSimulationOntology#CarEvent"/>
</rdf:Description> </rdf:Description>
<rdf:Description rdf:about="http://jpt.lu/carSimulationOntology#CarReturnedEvent"> <rdf:Description rdf:about="http://example.org/carSim/carSimulationOntology#CarTakenEvent">
<rdfs:subClassOf rdf:resource="http://jpt.lu/carSimulationOntology#CarUserEvent"/> <rdfs:subClassOf rdf:resource="http://example.org/carSim/carSimulationOntology#CarUserEvent"/>
</rdf:Description>
<rdf:Description rdf:about="http://example.org/carSim/carSimulationOntology#CarReturnedEvent">
<rdfs:subClassOf rdf:resource="http://example.org/carSim/carSimulationOntology#CarUserEvent"/>
</rdf:Description> </rdf:Description>
<rdf:Description rdf:about="http://example.org/carSim/carSimulationOntology#isOfCarModel">
<rdf:Description rdf:about="http://jpt.lu/carSimulationOntology#drives"> <rdfs:domain rdf:resource="http://example.org/carSim/carSimulationOntology#Car"/>
<rdfs:domain rdf:resource="http://jpt.lu/carSimulationOntology#Driver"/> <rdfs:range rdf:resource="http://example.org/carSim/carSimulationOntology#CarModel"/>
<rdfs:range rdf:resource="http://jpt.lu/carSimulationOntology#Car"/>
</rdf:Description> </rdf:Description>
<rdf:Description rdf:about="http://jpt.lu/carSimulationOntology#isDrivenBy"> <rdf:Description rdf:about="http://example.org/carSim/carSimulationOntology#hasCarInstances">
<rdfs:domain rdf:resource="http://jpt.lu/carSimulationOntology#Car"/> <rdfs:domain rdf:resource="http://example.org/carSim/carSimulationOntology#CarModel"/>
<rdfs:range rdf:resource="http://jpt.lu/carSimulationOntology#Driver"/> <rdfs:range rdf:resource="http://example.org/carSim/carSimulationOntology#Car"/>
</rdf:Description> </rdf:Description>
<rdf:Description rdf:about="http://jpt.lu/carSimulationOntology#relatedCar"> <rdf:Description rdf:about="http://example.org/carSim/carSimulationOntology#drives">
<rdfs:domain rdf:resource="http://jpt.lu/carSimulationOntology#CarEvent"/> <rdfs:domain rdf:resource="http://example.org/carSim/carSimulationOntology#Driver"/>
<rdfs:range rdf:resource="http://jpt.lu/carSimulationOntology#Car"/> <rdfs:range rdf:resource="http://example.org/carSim/carSimulationOntology#Car"/>
</rdf:Description> </rdf:Description>
<rdf:Description rdf:about="http://jpt.lu/carSimulationOntology#relatedUser"> <rdf:Description rdf:about="http://example.org/carSim/carSimulationOntology#isDrivenBy">
<rdfs:domain rdf:resource="http://jpt.lu/carSimulationOntology#Event"/> <rdfs:domain rdf:resource="http://example.org/carSim/carSimulationOntology#Car"/>
<rdfs:range rdf:resource="http://jpt.lu/carSimulationOntology#Driver"/> <rdfs:range rdf:resource="http://example.org/carSim/carSimulationOntology#Driver"/>
</rdf:Description> </rdf:Description>
<rdf:Description rdf:about="http://jpt.lu/carSimulationOntology#relatedEvent"> <rdf:Description rdf:about="http://example.org/carSim/carSimulationOntology#relatedCar">
<rdfs:domain rdf:resource="http://jpt.lu/carSimulationOntology#Car"/> <rdfs:domain rdf:resource="http://example.org/carSim/carSimulationOntology#CarEvent"/>
<rdfs:domain rdf:resource="http://jpt.lu/carSimulationOntology#Driver"/> <rdfs:range rdf:resource="http://example.org/carSim/carSimulationOntology#Car"/>
<rdfs:range rdf:resource="http://jpt.lu/carSimulationOntology#Event"/> </rdf:Description>
<rdf:Description rdf:about="http://example.org/carSim/carSimulationOntology#relatedUser">
<rdfs:domain rdf:resource="http://example.org/carSim/carSimulationOntology#Event"/>
<rdfs:range rdf:resource="http://example.org/carSim/carSimulationOntology#Driver"/>
</rdf:Description>
<rdf:Description rdf:about="http://example.org/carSim/carSimulationOntology#relatedEvent">
<rdfs:domain rdf:resource="http://example.org/carSim/carSimulationOntology#Car"/>
<rdfs:domain rdf:resource="http://example.org/carSim/carSimulationOntology#Driver"/>
<rdfs:range rdf:resource="http://example.org/carSim/carSimulationOntology#Event"/>
</rdf:Description> </rdf:Description>

View File

@ -34,7 +34,7 @@ public class Main {
CsparqlEngine engine = new CsparqlEngineImpl(); CsparqlEngine engine = new CsparqlEngineImpl();
engine.initialize(true); engine.initialize(true);
// Add static knowledge into local graph from file // Add local background knowledge from file into graph
try { try {
engine.putStaticNamedModel("http://example.org/carSimKnowledgeGraph", CsparqlUtils.serializeRDFFile("data/carData.rdf")); engine.putStaticNamedModel("http://example.org/carSimKnowledgeGraph", CsparqlUtils.serializeRDFFile("data/carData.rdf"));
} catch (Exception e) { } catch (Exception e) {

View File

@ -13,7 +13,7 @@ public class Car {
// Fix knowledge about the available car types: // Fix knowledge about the available car types:
private static final String[] CAR_TYPENAME = {"A", "B", "C"}; private static final String[] CAR_TYPENAME = {"A", "B", "C"};
private static final String[] REQUIRED_DRIVER_LICENSE = {"B", "B", "C"}; private static final String[] REQUIRED_DRIVER_LICENSE = {"B", "B", "B"};
private static final int[] MIN_RPM = {2000, 800, 1400}; private static final int[] MIN_RPM = {2000, 800, 1400};
private static final int[] MAX_RPM = {4300, 1900, 2500}; private static final int[] MAX_RPM = {4300, 1900, 2500};
private static final double[] MIN_TIRE_PRESSURE = {2.9, 3.5, 2.6}; private static final double[] MIN_TIRE_PRESSURE = {2.9, 3.5, 2.6};