def add_map(self, model, subject): m = Map(subject.uri) statement = RDF.Statement(subject, RDF.Uri("http://www.w3.org/2000/01/rdf-schema#domain"), None) for s in model.find_statements(statement): if s.object.is_resource(): m.domain = str(s.object.uri) statement = RDF.Statement(subject, RDF.Uri("http://www.w3.org/2000/01/rdf-schema#range"), None) for s in model.find_statements(statement): if s.object.is_resource(): m.range = str(s.object.uri) statement = RDF.Statement(subject, RDF.Uri("http://okfnpad.org/flow/0.1/sparql"), None) for s in model.find_statements(statement): if s.object.is_literal(): m.sparql = s.object.literal_value['string'] statement = RDF.Statement(subject, RDF.Uri("http://okfnpad.org/flow/0.1/sparql-not"), None) for s in model.find_statements(statement): if s.object.is_literal(): m.sparql = s.object.literal_value['string'] m.sparql_negate = 1 statement = RDF.Statement(subject, RDF.Uri("http://okfnpad.org/flow/0.1/assumption"), None) for s in model.find_statements(statement): if s.object.is_literal(): m.assumption = s.object.literal_value['string'] # Add it in the list only if completed if m.is_completed(): self.maps.append(m)
def add_map(self, model, subject): m = Map(subject.uri) statement = RDF.Statement( subject, RDF.Uri("http://www.w3.org/2000/01/rdf-schema#domain"), None) for s in model.find_statements(statement): if s.object.is_resource(): m.domain = str(s.object.uri) statement = RDF.Statement( subject, RDF.Uri("http://www.w3.org/2000/01/rdf-schema#range"), None) for s in model.find_statements(statement): if s.object.is_resource(): m.range = str(s.object.uri) statement = RDF.Statement( subject, RDF.Uri("http://okfnpad.org/flow/0.1/sparql"), None) for s in model.find_statements(statement): if s.object.is_literal(): m.sparql = s.object.literal_value['string'] statement = RDF.Statement( subject, RDF.Uri("http://okfnpad.org/flow/0.1/sparql-not"), None) for s in model.find_statements(statement): if s.object.is_literal(): m.sparql = s.object.literal_value['string'] m.sparql_negate = 1 statement = RDF.Statement( subject, RDF.Uri("http://okfnpad.org/flow/0.1/assumption"), None) for s in model.find_statements(statement): if s.object.is_literal(): m.assumption = s.object.literal_value['string'] # Add it in the list only if completed if m.is_completed(): self.maps.append(m)