def update_store(self):
        self.create_results()
        if not self._dataset:
            return

        self._client.modify(insert_construct=h.rdf_to_string(self.results),
                            delete_construct='?dataset ?predicate ?object.\n?object ?object_predicate ?object_object.',
                            delete_where='?dataset ?predicate ?object.\nfilter(?dataset=<' + self._dataset.uri + '>)')
        print "store update at %s" % datetime.datetime.now().isoformat()
Exemplo n.º 2
0
    def _commit(self, similar_entity_uri, similarity_weight=None, similarity_distance=None):
        similarity_node = RDF.Node()
        self.rdf.append(RDF.Statement(similarity_node, prefix.rdf.type, prefix.sim.Similarity))
        self.rdf.append(RDF.Statement(similarity_node, prefix.dct.created, RDF.Node(literal=datetime.datetime.now().isoformat(), datatype=prefix.xs.dateTime.uri)))
        self.rdf.append(RDF.Statement(similarity_node, prefix.sim.method, RDF.Uri(self._similarity_method.uri)))

        self.rdf.append(RDF.Statement(similarity_node, prefix.sim.element, RDF.Uri(self._entity_uri)))
        self.rdf.append(RDF.Statement(similarity_node, prefix.sim.element, RDF.Uri(similar_entity_uri)))

        if similarity_weight is not None:
            self.rdf.append(RDF.Statement(similarity_node, prefix.sim.weight, RDF.Node(literal=str(similarity_weight), datatype=prefix.xs.decimal.uri)))
        if similarity_distance is not None:
            self.rdf.append(RDF.Statement(similarity_node, prefix.sim.distance, RDF.Node(literal=str(similarity_distance), datatype=prefix.xs.decimal.uri)))

        self._client.modify(insert_construct=h.rdf_to_string(self.rdf),
                          delete_construct='?similarity ?predicate ?object.',
                          delete_where='''
                          ?similarity <http://purl.org/ontology/similarity/element> <''' + self._entity_uri + '''>.
                          ?similarity <http://purl.org/ontology/similarity/element> <''' + similar_entity_uri + '''>.
                          ?similarity <http://purl.org/ontology/similarity/method> <''' + self._similarity_method.uri + '''>.
                          ?similarity ?predicate ?object.
                          ''')
        
        self._clear_rdf()
 def update_store(self):
     self.create_results()
     self._client.clear_graph()
     self._client.modify(insert_construct=h.rdf_to_string(self.results))
Exemplo n.º 4
0
 def update_store(self):
     self.create_results()
     self._client.clear_graph()
     self._client.modify(insert_construct=h.rdf_to_string(self.results))