def make_graph(self): """ Specialises RdfClass.make_graph() :return: an rdflib Graph object """ OwlClass.make_graph(self) PROV = Namespace('http://www.w3.org/ns/prov#') self.g.bind('prov', PROV) self.g.remove(( URIRef(self.uri), RDF.type, OWL.Class)) self.g.add(( URIRef(self.uri), RDF.type, PROV.Agent)) if self.actedOnBehalfOf: self.g = self.g + self.actedOnBehalfOf.get_graph() self.g.add((URIRef(self.uri), PROV.actedOnBehalfOf, URIRef(self.actedOnBehalfOf.uri)))
def make_graph(self): """ Specialises RdfClass.make_graph() :return: an rdflib Graph object """ OwlClass.make_graph(self) PROV = Namespace('http://www.w3.org/ns/prov#') XSD = Namespace('http://www.w3.org/2001/XMLSchema#') self.g.remove((URIRef(self.uri), RDF.type, OWL.Class)) self.g.add((URIRef(self.uri), RDF.type, PROV.Entity)) if self.wasAttributedTo: self.g = self.g + self.wasAttributedTo.get_graph() self.g.add((URIRef(self.uri), PROV.wasAttributedTo, URIRef(self.wasAttributedTo.uri))) if self.value: if type(self.value) is datetime.datetime: self.g.add((URIRef(self.uri), PROV.value, Literal(self.value, datatype=XSD.dateTime))) elif type(self.value) is int: self.g.add((URIRef(self.uri), PROV.value, Literal(self.value, datatype=XSD.integer))) elif type(self.value) is float: self.g.add((URIRef(self.uri), PROV.value, Literal(self.value, datatype=XSD.float))) else: # string self.g.add((URIRef(self.uri), PROV.value, Literal(self.value, datatype=XSD.string)))
def make_graph(self): OwlClass.make_graph(self) PROV = Namespace('http://www.w3.org/ns/prov#') XSD = Namespace('http://www.w3.org/2001/XMLSchema#') LSUTECH = Namespace("http://www.lsutech.com#") self.g.remove((URIRef(self.uri), RDF.type, OWL.Class)) self.g.add((URIRef(self.uri), RDF.type, PROV.Entity)) if self.wasAttributedTo: self.g = self.g + self.wasAttributedTo.get_graph() self.g.add((URIRef(self.uri), PROV.wasAttributedTo, URIRef(self.wasAttributedTo.uri))) if self.value: if type(self.value) is datetime.datetime: self.g.add((URIRef(self.uri), PROV.value, Literal(self.value, datatype=XSD.dateTime))) elif type(self.value) is int: self.g.add((URIRef(self.uri), PROV.value, Literal(self.value, datatype=XSD.integer))) elif type(self.value) is float: self.g.add((URIRef(self.uri), PROV.value, Literal(self.value, datatype=XSD.float))) else: # string self.g.add((URIRef(self.uri), PROV.value, Literal(self.value, datatype=XSD.string))) if self.scanTime: self.g.add((URIRef(self.uri), PROV.scanTime, Literal(self.scanTime.strftime("%Y-%m-%dT%H:%M:%S"), datatype=XSD.dateTime))) if self.blockchainuri: self.g.add((URIRef(self.uri), LSUTECH.blockchainuri, URIRef(self.blockchainuri)))
def make_graph(self): """ Specialises RdfClass.make_graph() :return: an rdflib Graph object """ OwlClass.make_graph(self) XSD = Namespace('http://www.w3.org/2001/XMLSchema#') PROV = Namespace('http://www.w3.org/ns/prov#') self.g.bind('prov', PROV) self.g.remove((URIRef(self.uri), RDF.type, OWL.Class)) self.g.add((URIRef(self.uri), RDF.type, PROV.Activity)) if self.wasAssociatedWith: self.g = self.g + self.wasAssociatedWith.get_graph() self.g.add((URIRef(self.uri), PROV.wasAssociatedWith, URIRef(self.wasAssociatedWith.uri))) if self.startedAtTime: self.g.add( (URIRef(self.uri), PROV.startedAtTime, Literal(self.startedAtTime.strftime("%Y-%m-%dT%H:%M:%S::%f"), datatype=XSD.dateTime))) if self.endedAtTime: self.g.add((URIRef(self.uri), PROV.endedAtTime, Literal(self.endedAtTime.strftime("%Y-%m-%dT%H:%M:%S"), datatype=XSD.dateTime))) if self.used_entities: for used_entity in self.used_entities: # add the Entity to the graph self.g = self.g + used_entity.get_graph() # associate the Entity with the Activity self.g.add( (URIRef(self.uri), PROV.used, URIRef(used_entity.uri))) if self.generated_entities: for generated_entity in self.generated_entities: # add the Entity to the graph self.g = self.g + generated_entity.get_graph() # associate the Entity with the Activity self.g.add((URIRef(self.uri), PROV.generated, URIRef(generated_entity.uri))) if self.wasInformedBy: self.g = self.g + self.wasInformedBy.get_graph() self.g.add((URIRef(self.uri), PROV.wasInformedBy, URIRef(self.wasInformedBy.uri)))
def make_graph(self): """ Specialises RdfClass.make_graph() :return: an rdflib Graph object """ OwlClass.make_graph(self) XSD = Namespace('http://www.w3.org/2001/XMLSchema#') PROV = Namespace('http://www.w3.org/ns/prov#') self.g.bind('prov', PROV) PROMS = Namespace('http://promsns.org/def/proms#') self.g.bind('proms', PROMS) self.g.remove((URIRef(self.uri), RDF.type, OWL.Class)) self.g.add((URIRef(self.uri), RDF.type, PROMS.Report)) self.g = self.g + self.wasReportedBy.get_graph() self.g.add((URIRef(self.uri), PROMS.wasReportedBy, URIRef(self.wasReportedBy.uri))) self.g.add((URIRef(self.uri), PROMS.nativeId, Literal(self.nativeId, datatype=XSD.string))) self.g = self.g + self.reportActivity.get_graph() self.g.add((URIRef(self.uri), PROMS.startingActivity, URIRef(self.reportActivity.uri))) self.g.add((URIRef(self.uri), PROMS.endingActivity, URIRef(self.reportActivity.uri))) self.g.add((URIRef(self.uri), PROV.generatedAtTime, Literal(self.generatedAtTime.isoformat(), datatype=XSD.dateTime)))