[TASK] Make code and ontology match more.

This commit is contained in:
Jan Philipp Timme 2016-08-11 20:42:24 +02:00
parent a4444da92e
commit f49110eaef
4 changed files with 276 additions and 87 deletions

View File

@ -1,18 +1,42 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<rdf:RDF xmlns="http://myexample.org/" <rdf:RDF xmlns="http://simontology.org/#"
xml:base="http://myexample.org/" xml:base="http://simontology.org"
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:owl="http://www.w3.org/2002/07/owl#" xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:xml="http://www.w3.org/XML/1998/namespace"
xmlns:myexample="http://myexample.org/#" xmlns:myexample="http://myexample.org/#"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#" xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xmlns:simontology="http://simontology.org/#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"> xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
<owl:Ontology rdf:about="http://myexample.org/"> <owl:Ontology rdf:about="http://simontology.org">
<rdfs:comment xml:lang="de">Beispielhafte Ontologie für die Autosimulation</rdfs:comment> <rdfs:comment xml:lang="de">Beispielhafte Ontologie für die Autosimulation</rdfs:comment>
</owl:Ontology> </owl:Ontology>
<!--
///////////////////////////////////////////////////////////////////////////////////////
//
// Annotation properties
//
///////////////////////////////////////////////////////////////////////////////////////
-->
<!-- http://simontology.org/#maximumMotorRPM -->
<owl:AnnotationProperty rdf:about="http://simontology.org/#maximumMotorRPM"/>
<!-- http://simontology.org/#maximumTirePressure -->
<owl:AnnotationProperty rdf:about="http://simontology.org/#maximumTirePressure"/>
<!-- <!--
/////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////
// //
@ -24,21 +48,51 @@
<!-- http://myexample.org/#drives --> <!-- http://simontology.org/#drives -->
<owl:ObjectProperty rdf:about="http://myexample.org/#drives"> <owl:ObjectProperty rdf:about="http://simontology.org/#drives">
<owl:inverseOf rdf:resource="http://myexample.org/#isDrivenBy"/> <owl:inverseOf rdf:resource="http://simontology.org/#isDrivenBy"/>
<rdfs:domain rdf:resource="http://myexample.org/#Driver"/> <rdfs:domain rdf:resource="http://simontology.org/Driver"/>
<rdfs:range rdf:resource="http://myexample.org/#Car"/> <rdfs:range rdf:resource="http://simontology.org/Car"/>
</owl:ObjectProperty> </owl:ObjectProperty>
<!-- http://myexample.org/#isDrivenBy --> <!-- http://simontology.org/#isDrivenBy -->
<owl:ObjectProperty rdf:about="http://myexample.org/#isDrivenBy"> <owl:ObjectProperty rdf:about="http://simontology.org/#isDrivenBy">
<rdfs:domain rdf:resource="http://myexample.org/#Car"/> <rdfs:domain rdf:resource="http://simontology.org/Car"/>
<rdfs:range rdf:resource="http://myexample.org/#Driver"/> <rdfs:range rdf:resource="http://simontology.org/Driver"/>
</owl:ObjectProperty>
<!-- http://simontology.org/#relatedCar -->
<owl:ObjectProperty rdf:about="http://simontology.org/#relatedCar">
<owl:inverseOf rdf:resource="http://simontology.org/#relatedEvent"/>
<rdfs:domain rdf:resource="http://simontology.org/CarEvent"/>
<rdfs:range rdf:resource="http://simontology.org/Car"/>
</owl:ObjectProperty>
<!-- http://simontology.org/#relatedEvent -->
<owl:ObjectProperty rdf:about="http://simontology.org/#relatedEvent">
<owl:inverseOf rdf:resource="http://simontology.org/#relatedUser"/>
<rdfs:domain rdf:resource="http://simontology.org/Car"/>
<rdfs:domain rdf:resource="http://simontology.org/Driver"/>
<rdfs:range rdf:resource="http://simontology.org/Event"/>
</owl:ObjectProperty>
<!-- http://simontology.org/#relatedUser -->
<owl:ObjectProperty rdf:about="http://simontology.org/#relatedUser">
<rdfs:domain rdf:resource="http://simontology.org/Event"/>
<rdfs:range rdf:resource="http://simontology.org/Driver"/>
</owl:ObjectProperty> </owl:ObjectProperty>
@ -54,60 +108,129 @@
<!-- http://myexample.org/hasDriverLicense --> <!-- http://simobjects.org/maximumMotorRPM -->
<owl:DatatypeProperty rdf:about="http://myexample.org/hasDriverLicense"> <owl:DatatypeProperty rdf:about="http://simobjects.org/maximumMotorRPM">
<rdfs:domain rdf:resource="http://myexample.org/#Driver"/> <rdfs:domain rdf:resource="http://simontology.org/Car"/>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/> <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#integer"/>
</owl:DatatypeProperty> </owl:DatatypeProperty>
<!-- http://myexample.org/requiresDriverLicense --> <!-- http://simobjects.org/maximumTirePressure -->
<owl:DatatypeProperty rdf:about="http://myexample.org/requiresDriverLicense"> <owl:DatatypeProperty rdf:about="http://simobjects.org/maximumTirePressure">
<rdfs:domain rdf:resource="http://myexample.org/#Car"/> <rdfs:domain rdf:resource="http://simontology.org/Car"/>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
</owl:DatatypeProperty>
<!-- http://myexample.org/#maximumMotorRPM -->
<owl:DatatypeProperty rdf:about="http://myexample.org/#maximumMotorRPM">
<rdfs:domain rdf:resource="http://myexample.org/#Car"/>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#positiveInteger"/>
</owl:DatatypeProperty>
<!-- http://myexample.org/#maximumTirePressure -->
<owl:DatatypeProperty rdf:about="http://myexample.org/#maximumTirePressure">
<rdfs:domain rdf:resource="http://myexample.org/#Car"/>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#double"/> <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#double"/>
</owl:DatatypeProperty> </owl:DatatypeProperty>
<!-- http://myexample.org/#minimumMotorRPM --> <!-- http://simontology.org/#handbrakeEngaged -->
<owl:DatatypeProperty rdf:about="http://myexample.org/#minimumMotorRPM"> <owl:DatatypeProperty rdf:about="http://simontology.org/#handbrakeEngaged">
<rdfs:domain rdf:resource="http://myexample.org/#Car"/> <rdfs:domain rdf:resource="http://simontology.org/Car"/>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#positiveInteger"/> <rdfs:domain rdf:resource="http://simontology.org/CarStatusEvent"/>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#boolean"/>
</owl:DatatypeProperty> </owl:DatatypeProperty>
<!-- http://myexample.org/#minimumTirePressure --> <!-- http://simontology.org/#hasDriverLicense -->
<owl:DatatypeProperty rdf:about="http://myexample.org/#minimumTirePressure"> <owl:DatatypeProperty rdf:about="http://simontology.org/#hasDriverLicense">
<rdfs:domain rdf:resource="http://myexample.org/#Car"/> <rdfs:domain rdf:resource="http://simontology.org/Driver"/>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
</owl:DatatypeProperty>
<!-- http://simontology.org/#locked -->
<owl:DatatypeProperty rdf:about="http://simontology.org/#locked">
<rdfs:domain rdf:resource="http://simontology.org/Car"/>
<rdfs:domain rdf:resource="http://simontology.org/CarStatusEvent"/>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#boolean"/>
</owl:DatatypeProperty>
<!-- http://simontology.org/#minimumMotorRPM -->
<owl:DatatypeProperty rdf:about="http://simontology.org/#minimumMotorRPM">
<rdfs:domain rdf:resource="http://simontology.org/Car"/>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#integer"/>
</owl:DatatypeProperty>
<!-- http://simontology.org/#minimumTirePressure -->
<owl:DatatypeProperty rdf:about="http://simontology.org/#minimumTirePressure">
<rdfs:domain rdf:resource="http://simontology.org/Car"/>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#double"/> <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#double"/>
</owl:DatatypeProperty> </owl:DatatypeProperty>
<!-- http://simontology.org/#motorOn -->
<owl:DatatypeProperty rdf:about="http://simontology.org/#motorOn">
<rdfs:domain rdf:resource="http://simontology.org/Car"/>
<rdfs:domain rdf:resource="http://simontology.org/CarStatusEvent"/>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#boolean"/>
</owl:DatatypeProperty>
<!-- http://simontology.org/#motorRPM -->
<owl:DatatypeProperty rdf:about="http://simontology.org/#motorRPM">
<rdfs:domain rdf:resource="http://simontology.org/Car"/>
<rdfs:domain rdf:resource="http://simontology.org/CarStatusEvent"/>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#integer"/>
</owl:DatatypeProperty>
<!-- http://simontology.org/#requiresDriverLicense -->
<owl:DatatypeProperty rdf:about="http://simontology.org/#requiresDriverLicense">
<rdfs:domain rdf:resource="http://simontology.org/Car"/>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
</owl:DatatypeProperty>
<!-- http://simontology.org/#speed -->
<owl:DatatypeProperty rdf:about="http://simontology.org/#speed">
<rdfs:domain rdf:resource="http://simontology.org/Car"/>
<rdfs:domain rdf:resource="http://simontology.org/CarStatusEvent"/>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#integer"/>
</owl:DatatypeProperty>
<!-- http://simontology.org/#tirePressure -->
<owl:DatatypeProperty rdf:about="http://simontology.org/#tirePressure">
<rdfs:domain rdf:resource="http://simontology.org/Car"/>
<rdfs:domain rdf:resource="http://simontology.org/CarStatusEvent"/>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#double"/>
</owl:DatatypeProperty>
<!-- http://simontology.org/#usagePeriod -->
<owl:DatatypeProperty rdf:about="http://simontology.org/#usagePeriod">
<rdfs:domain rdf:resource="http://simontology.org/CarTakenEvent"/>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#integer"/>
</owl:DatatypeProperty>
<!-- <!--
/////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////
// //
@ -119,15 +242,69 @@
<!-- http://myexample.org/#Car --> <!-- http://simontology.org/Car -->
<owl:Class rdf:about="http://myexample.org/#Car"/> <owl:Class rdf:about="http://simontology.org/Car"/>
<!-- http://myexample.org/#Driver --> <!-- http://simontology.org/CarAirbagEvent -->
<owl:Class rdf:about="http://myexample.org/#Driver"/> <owl:Class rdf:about="http://simontology.org/CarAirbagEvent">
<rdfs:subClassOf rdf:resource="http://simontology.org/CarEvent"/>
</owl:Class>
<!-- http://simontology.org/CarEvent -->
<owl:Class rdf:about="http://simontology.org/CarEvent">
<rdfs:subClassOf rdf:resource="http://simontology.org/Event"/>
</owl:Class>
<!-- http://simontology.org/CarReturnedEvent -->
<owl:Class rdf:about="http://simontology.org/CarReturnedEvent">
<rdfs:subClassOf rdf:resource="http://simontology.org/CarUserEvent"/>
</owl:Class>
<!-- http://simontology.org/CarStatusEvent -->
<owl:Class rdf:about="http://simontology.org/CarStatusEvent">
<rdfs:subClassOf rdf:resource="http://simontology.org/CarEvent"/>
</owl:Class>
<!-- http://simontology.org/CarTakenEvent -->
<owl:Class rdf:about="http://simontology.org/CarTakenEvent">
<rdfs:subClassOf rdf:resource="http://simontology.org/CarUserEvent"/>
</owl:Class>
<!-- http://simontology.org/CarUserEvent -->
<owl:Class rdf:about="http://simontology.org/CarUserEvent">
<rdfs:subClassOf rdf:resource="http://simontology.org/CarEvent"/>
</owl:Class>
<!-- http://simontology.org/Driver -->
<owl:Class rdf:about="http://simontology.org/Driver"/>
<!-- http://simontology.org/Event -->
<owl:Class rdf:about="http://simontology.org/Event"/>
@ -142,25 +319,25 @@
<!-- http://myexample.org/#Max --> <!-- http://simobjects.org/Max -->
<owl:NamedIndividual rdf:about="http://myexample.org/#Max"> <owl:NamedIndividual rdf:about="http://simobjects.org/Max">
<rdf:type rdf:resource="http://myexample.org/#Driver"/> <rdf:type rdf:resource="http://simontology.org/Driver"/>
<hasDriverLicense rdf:datatype="http://www.w3.org/2001/XMLSchema#string">B</hasDriverLicense> <simontology:hasDriverLicense rdf:datatype="http://www.w3.org/2001/XMLSchema#string">B</simontology:hasDriverLicense>
</owl:NamedIndividual> </owl:NamedIndividual>
<!-- http://myexample.org/#Volvo --> <!-- http://simobjects.org/Volvo -->
<owl:NamedIndividual rdf:about="http://myexample.org/#Volvo"> <owl:NamedIndividual rdf:about="http://simobjects.org/Volvo">
<rdf:type rdf:resource="http://myexample.org/#Car"/> <rdf:type rdf:resource="http://simontology.org/Car"/>
<myexample:isDrivenBy rdf:resource="http://myexample.org/#Max"/> <simontology:isDrivenBy rdf:resource="http://simobjects.org/Max"/>
<requiresDriverLicense rdf:datatype="http://www.w3.org/2001/XMLSchema#string">B</requiresDriverLicense> <simontology:minimumMotorRPM rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">800</simontology:minimumMotorRPM>
<myexample:maximumMotorRPM rdf:datatype="http://www.w3.org/2001/XMLSchema#positiveInteger">4500</myexample:maximumMotorRPM> <simontology:minimumTirePressure rdf:datatype="http://www.w3.org/2001/XMLSchema#double">2.9</simontology:minimumTirePressure>
<myexample:maximumTirePressure rdf:datatype="http://www.w3.org/2001/XMLSchema#double">3.5</myexample:maximumTirePressure> <simontology:requiresDriverLicense rdf:datatype="http://www.w3.org/2001/XMLSchema#string">B</simontology:requiresDriverLicense>
<myexample:minimumMotorRPM rdf:datatype="http://www.w3.org/2001/XMLSchema#positiveInteger">800</myexample:minimumMotorRPM> <simontology:maximumMotorRPM rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">4500</simontology:maximumMotorRPM>
<myexample:minimumTirePressure rdf:datatype="http://www.w3.org/2001/XMLSchema#double">2.9</myexample:minimumTirePressure> <simontology:maximumTirePressure rdf:datatype="http://www.w3.org/2001/XMLSchema#double">3.5</simontology:maximumTirePressure>
</owl:NamedIndividual> </owl:NamedIndividual>
</rdf:RDF> </rdf:RDF>

View File

@ -45,7 +45,7 @@ public class Car {
public Car(int id) { public Car(int id) {
this.id = id; this.id = id;
this.IRI = RentACarSimulation.CAR_IRI; this.IRI = RentACarSimulation.BASE_OBJECT_IRI + "/car";
this.quads = new ArrayList<RdfQuadruple>(); this.quads = new ArrayList<RdfQuadruple>();
this.CAR_TYPE = RandomHelper.nextInt(2); this.CAR_TYPE = RandomHelper.nextInt(2);
this.initializeCarType(this.CAR_TYPE); this.initializeCarType(this.CAR_TYPE);
@ -197,23 +197,26 @@ public class Car {
private void fireAirbagEvent() { private void fireAirbagEvent() {
long time = System.currentTimeMillis(); long time = System.currentTimeMillis();
String baseIri = RentACarSimulation.BASE_IRI; String baseIri = RentACarSimulation.BASE_OBJECT_IRI;
String baseOnt = RentACarSimulation.BASE_ONTOLOGY_IRI;
String eventIri = baseIri + "/event#" + time; String eventIri = baseIri + "/event#" + time;
this.quads.add(new RdfQuadruple(eventIri, "http://myexample.org/car#subject", this.getIri(), time)); this.quads.add(new RdfQuadruple(eventIri, "a", baseOnt+"/CarAirbagEvent", time));
this.quads.add(new RdfQuadruple(eventIri, "http://myexample.org/car#airbagTriggered", ""+true+"^^http://www.w3.org/2001/XMLSchema#boolean", time)); this.quads.add(new RdfQuadruple(eventIri, baseOnt+"#relatedCar", this.getIri(), time));
} }
private void generateContinousReportQuads() { private void generateContinousReportQuads() {
long time = System.currentTimeMillis(); long time = System.currentTimeMillis();
String baseIri = RentACarSimulation.BASE_IRI; String baseIri = RentACarSimulation.BASE_OBJECT_IRI;
String baseOnt = RentACarSimulation.BASE_ONTOLOGY_IRI;
String eventIri = baseIri + "/event#" + time; String eventIri = baseIri + "/event#" + time;
this.quads.add(new RdfQuadruple(eventIri, "http://myexample.org/car#subject", this.getIri(), time)); this.quads.add(new RdfQuadruple(eventIri, "a", baseOnt+"/CarStatusEvent", time));
this.quads.add(new RdfQuadruple(eventIri, "http://myexample.org/car#motorOn", ""+this.motorOn+"^^http://www.w3.org/2001/XMLSchema#boolean", time)); this.quads.add(new RdfQuadruple(eventIri, baseOnt+"#relatedCar", this.getIri(), time));
this.quads.add(new RdfQuadruple(eventIri, "http://myexample.org/car#motorRPM", ""+this.motorRpm+"^^http://www.w3.org/2001/XMLSchema#integer", time)); this.quads.add(new RdfQuadruple(eventIri, baseOnt+"#motorOn", ""+this.motorOn+"^^http://www.w3.org/2001/XMLSchema#boolean", time));
this.quads.add(new RdfQuadruple(eventIri, "http://myexample.org/car#speed", ""+this.speed+"^^http://www.w3.org/2001/XMLSchema#integer", time)); this.quads.add(new RdfQuadruple(eventIri, baseOnt+"#motorRPM", ""+this.motorRpm+"^^http://www.w3.org/2001/XMLSchema#integer", time));
this.quads.add(new RdfQuadruple(eventIri, "http://myexample.org/car#handbrakeEngaged", ""+this.handbrakeEngaged+"^^http://www.w3.org/2001/XMLSchema#boolean", time)); this.quads.add(new RdfQuadruple(eventIri, baseOnt+"#speed", ""+this.speed+"^^http://www.w3.org/2001/XMLSchema#integer", time));
this.quads.add(new RdfQuadruple(eventIri, "http://myexample.org/car#tirePressure", ""+this.tirePressure+"^^http://www.w3.org/2001/XMLSchema#double", time)); this.quads.add(new RdfQuadruple(eventIri, baseOnt+"#handbrakeEngaged", ""+this.handbrakeEngaged+"^^http://www.w3.org/2001/XMLSchema#boolean", time));
this.quads.add(new RdfQuadruple(eventIri, "http://myexample.org/car#locked", ""+this.isLocked+"^^http://www.w3.org/2001/XMLSchema#boolean", time)); this.quads.add(new RdfQuadruple(eventIri, baseOnt+"#tirePressure", ""+this.tirePressure+"^^http://www.w3.org/2001/XMLSchema#double", time));
this.quads.add(new RdfQuadruple(eventIri, baseOnt+"#locked", ""+this.isLocked+"^^http://www.w3.org/2001/XMLSchema#boolean", time));
} }
public CarState getState() { public CarState getState() {
@ -237,7 +240,7 @@ public class Car {
} }
public String getIri() { public String getIri() {
return RentACarSimulation.CAR_IRI + "#" + this.id; return this.IRI + "#" + this.id;
} }
public List<RdfQuadruple> getQuadruples() { public List<RdfQuadruple> getQuadruples() {

View File

@ -27,9 +27,12 @@ public class Driver {
private List<RdfQuadruple> quads; private List<RdfQuadruple> quads;
private final String IRI;
public Driver(int id, CarPool carPool) { public Driver(int id, CarPool carPool) {
this.id = id; this.id = id;
this.IRI = RentACarSimulation.BASE_OBJECT_IRI + "/driver";
this.carPool = carPool; this.carPool = carPool;
this.car = null; this.car = null;
this.quads = new ArrayList<RdfQuadruple>(); this.quads = new ArrayList<RdfQuadruple>();
@ -42,7 +45,7 @@ public class Driver {
} }
public String getIri() { public String getIri() {
return RentACarSimulation.DRIVER_IRI + "#" + this.id; return this.IRI + "#" + this.id;
} }
/** /**
@ -145,19 +148,23 @@ public class Driver {
this.car = this.carPool.takeRandomCar(); this.car = this.carPool.takeRandomCar();
this.carUseCycles = useCycles; this.carUseCycles = useCycles;
long time = System.currentTimeMillis(); long time = System.currentTimeMillis();
String baseIri = RentACarSimulation.BASE_IRI; String baseIri = RentACarSimulation.BASE_OBJECT_IRI;
String baseOnt = RentACarSimulation.BASE_ONTOLOGY_IRI;
String eventIri = baseIri + "/event#" + time; String eventIri = baseIri + "/event#" + time;
this.quads.add(new RdfQuadruple(eventIri, baseIri+"#user", this.getIri(), time)); this.quads.add(new RdfQuadruple(eventIri, "a", baseOnt+"/CarTakenEvent", time));
this.quads.add(new RdfQuadruple(eventIri, baseIri+"#took", this.car.getIri(), System.currentTimeMillis())); this.quads.add(new RdfQuadruple(eventIri, baseOnt+"#relatedUser", this.getIri(), time));
this.quads.add(new RdfQuadruple(eventIri, baseIri+"#usagePeriod", ""+useCycles+"^^http://www.w3.org/2001/XMLSchema#integer", System.currentTimeMillis())); this.quads.add(new RdfQuadruple(eventIri, baseOnt+"#relatedCar", this.car.getIri(), System.currentTimeMillis()));
this.quads.add(new RdfQuadruple(eventIri, baseOnt+"#usagePeriod", ""+useCycles+"^^http://www.w3.org/2001/XMLSchema#integer", System.currentTimeMillis()));
} }
private void returnCar() { private void returnCar() {
long time = System.currentTimeMillis(); long time = System.currentTimeMillis();
String baseIri = RentACarSimulation.BASE_IRI; String baseIri = RentACarSimulation.BASE_OBJECT_IRI;
String baseOnt = RentACarSimulation.BASE_ONTOLOGY_IRI;
String eventIri = baseIri + "/event#" + time; String eventIri = baseIri + "/event#" + time;
this.quads.add(new RdfQuadruple(eventIri, baseIri+"#user", this.getIri(), time)); this.quads.add(new RdfQuadruple(eventIri, "a", baseOnt+"/CarReturnedEvent", time));
this.quads.add(new RdfQuadruple(eventIri, baseIri+"#returned", this.car.getIri(), time)); this.quads.add(new RdfQuadruple(eventIri, baseOnt+"#relatedUser", this.getIri(), time));
this.quads.add(new RdfQuadruple(eventIri, baseOnt+"#relatedCar", this.car.getIri(), time));
this.carPool.returnCar(this.car); this.carPool.returnCar(this.car);
this.car = null; this.car = null;
} }

View File

@ -8,9 +8,11 @@ import eu.larkc.csparql.cep.api.RdfStream;
public class RentACarSimulation implements Runnable { public class RentACarSimulation implements Runnable {
public static final String BASE_IRI = "http://myexample.org"; public static final String BASE_ONTOLOGY_IRI = "http://simontology.org";
public static final String CAR_IRI = BASE_IRI + "/car"; public static final String BASE_STREAM_IRI = "http://simstream.org";
public static final String DRIVER_IRI = BASE_IRI + "/driver"; public static final String BASE_OBJECT_IRI = "http://simobject.org";
public static final String CAR_STREAM_IRI = BASE_STREAM_IRI + "/carStream";
public static final String DRIVER_STREAM_IRI = BASE_STREAM_IRI + "/driverStream";
private CarPool carPool; private CarPool carPool;
private List<Driver> drivers; private List<Driver> drivers;
@ -33,8 +35,8 @@ public class RentACarSimulation implements Runnable {
this.drivers.add(driver); this.drivers.add(driver);
} }
// Create streams // Create streams
this.carStream = new RdfStream(CAR_IRI); this.carStream = new RdfStream(CAR_STREAM_IRI);
this.driverStream = new RdfStream(DRIVER_IRI); this.driverStream = new RdfStream(DRIVER_STREAM_IRI);
// Green light for simulation // Green light for simulation
this.runSimulation = true; this.runSimulation = true;
} }