示例#1
0
 def add_sampler(self, Sampler):
     if isinstance(self, Sampler):
         sampler_uri = Sampler.get_uri()
         self.samplers.append(sampler_uri)
         obsgraph.add((self.platform_id, sosa.hosts, sampler_uri))
         Sampler.add_platform_id(self.platform_id)
     else:
         raise Exception('Object is not of type Sampler')
示例#2
0
 def add_actuator(self, Actuator):
     if isinstance(self, Actuator):
         a_uri = Actuator.get_uri()
         self.actuators.append(a_uri)
         obsgraph.add((self.platform_id, sosa.hosts, a_uri))
         Actuator.add_platform_id(self.platform_id)
     else:
         raise Exception('Object is not of type Actuator')
示例#3
0
 def add_sensor(self, Sensor):
     if isinstance(self, Sensor):
         sensor_uri = Sensor.get_uri()
         self.sensors.append(sensor_uri)
         obsgraph.add((self.platform_id, sosa.hosts, sensor_uri))
         Sensor.add_platform_id(self.platform_id)
     else:
         raise Exception('Object is not of type Sensor')
示例#4
0
 def addObservation(self, sensorURI, FeatureURI, result):
     obsid = BNode()
     resultTime = datetime.now(tz=None)
     resultTimeLiteral = Literal(resultTime)
     resultLiteral = Literal(result)
     obsgraph.add((obsid, RDF.type, sosa.Observation))
     obsgraph.add((obsid, sosa.madeBySensor, sensorURI))
     obsgraph.add((self.obscollid, ssnext.hasMember, obsid))
     obsgraph.add((obsid, sosa.resultTime, resultTimeLiteral))
     obsgraph.add((obsid, sosa.hasSimpleResult, resultLiteral))
示例#5
0
 def __init__(self, comment, label):
     self.platform_id = BNode()
     self.label = Literal(label)
     self.comment = Literal(comment)
     obsgraph.add((self.platform_id, RDF.type, sosa.Platform))
     obsgraph.add((self.platform_id, RDFS.comment, self.comment))
     obsgraph.add((self.platform_id, RDFS.label, self.label))
示例#6
0
 def __init__(self, sensor_description, observable_property, observable_property_uri, detects):
     x = Literal
     y = Literal
     z = Literal
     self.sensor_id = BNode()
     self.platform_id = BNode()
     self.observable_property = x
     self.detects = y
     self.implements_procedure = z
     # self.observable_property = Literal(x)
     self.sensor_description = Literal(sensor_description)
     obsgraph.add((self.sensorid, RDF.type, sosa.Sensor))
     obsgraph.add((self.sensorid, sosa.Observes, observable_property_uri))
     obsgraph.add((self.sensorid, RDFS.comment, self.sensor_description))
示例#7
0
 def remove_sampler(self, sensorURI, FeatureURI, result):
     a_uri = Sensor.get_uri()
     self.actuators.remove(a_uri)
     obsgraph.add((self.platform_id, sosa.hosts, a_uri))
     Sensor.add_platform_id(self.platform_id)
示例#8
0
 def remove_actuator(self, sensorURI, sensor):
     a_uri = Sensor.get_uri()
     self.actuators.remove(a_uri)
     obsgraph.add((self.platform_id, sosa.hosts, a_uri))
     Sensor.add_platform_id(self.platform_id)
示例#9
0
 def __init__(self, property_uri):
     if property_uri:
         self.observable_property_uri = property_uri
     else:
         self.observable_property_uri = BNode()
     obsgraph.add((self.observable_property_uri, RDF.type, sosa.Observable_property))
示例#10
0
 def set_platform_id(self, platform_id):
     self.platform_id = platform_id
     obsgraph.add((self.platform_id, RDF.type, sosa.platform))
示例#11
0
 def set_sensor_id(self, sensor_id):
     self.sensor_id = sensor_id
     obsgraph.add(self.sensor_id, RDF.type, sosa.sensor)