コード例 #1
0
ファイル: gocamgen.py プロジェクト: geneontology/gocamgen
 def declare_individual(self, entity_id):
     entity = genid(base=self.writer.writer.base + '/')
     # TODO: Make this add_to_graph
     self.writer.emit_type(entity, self.writer.uri(entity_id))
     self.writer.emit_type(entity, OWL.NamedIndividual)
     self.individuals[entity_id] = entity
     return entity
コード例 #2
0
ファイル: gocamgen.py プロジェクト: geneontology/gocamgen
 def find_or_create_evidence_id(self, evidence):
     for existing_evidence in self.evidences:
         if evidence.evidence_code == existing_evidence.evidence_code and set(evidence.references) == set(existing_evidence.references):
             if existing_evidence.id is None:
                 existing_evidence.id = genid(base=self.writer.base + '/')
                 self.ev_ids.append(existing_evidence.id)
             return existing_evidence.id
     return self.create_evidence(evidence)
コード例 #3
0
ファイル: gocamgen.py プロジェクト: geneontology/gocamgen
 def add_individual(self, individual_id, annoton):
     obj_uri = self.uri(individual_id)
     if individual_id not in annoton.individuals:
         tgt_id = genid(base=self.writer.base + '/')
         annoton.individuals[individual_id] = tgt_id
         self.emit_type(tgt_id, obj_uri)
         self.emit_type(tgt_id, OWL.NamedIndividual)
     else:
         tgt_id = annoton.individuals[individual_id]
コード例 #4
0
ファイル: gocamgen.py プロジェクト: geneontology/gocamgen
 def create_evidence(self, evidence):
     # Use/figure out standard for creating URIs
     # Find minerva code to generate URI, add to Noctua doc
     ev_id = genid(base=self.writer.base + '/')
     evidence.id = ev_id
     # ev_cls = self.eco_class(self.uri(evidence.evidence_code))
     # ev_cls = self.eco_class(evidence.evidence_code) # This is already ECO:##### due to a GPAD being used
     ev_cls = self.uri(evidence.evidence_code)
     self.emit_type(ev_id, OWL.NamedIndividual)
     self.emit_type(ev_id, ev_cls)
     self.emit(ev_id, DC.date, Literal(evidence.date))
     if evidence.with_from:
         self.emit(ev_id, URIRef("http://geneontology.org/lego/evidence-with"), Literal(evidence.with_from))
     for c in evidence.contributors:
         self.emit(ev_id, DC.contributor, Literal(c))
     ref_to_emit = ReferencePreference().pick(evidence.references)
     o = Literal(ref_to_emit)  # Needs to go into Noctua like 'PMID:####' rather than full URL
     self.emit(ev_id, HAS_SUPPORTING_REFERENCE, o)
     self.evidences.append(evidence)
     return evidence.id
コード例 #5
0
ファイル: gocamgen.py プロジェクト: geneontology/gocamgen
    def __init__(self, modeltitle, store=None):
        self.base = genid(base="http://model.geneontology.org")
        if store is not None:
            graph = rdflib.Graph(identifier=self.base, store=store)
        else:
            graph = rdflib.Graph(identifier=self.base)
        self.graph = graph
        self.graph.bind("owl", OWL)
        self.graph.bind("obo", "http://purl.obolibrary.org/obo/")
        self.graph.bind("dc", DC)
        self.graph.bind("rdfs", RDFS)

        self.graph.add((self.base, RDF.type, OWL.Ontology))

        # Model attributes TODO: Should move outside init
        self.graph.add((self.base, URIRef("http://purl.org/pav/providedBy"), Literal("http://geneontology.org")))
        self.graph.add((self.base, DC.date, Literal(str(now.year) + "-" + str(now.month) + "-" + str(now.day))))
        self.graph.add((self.base, DC.title, Literal(modeltitle)))
        self.graph.add((self.base, DC.contributor, Literal("http://orcid.org/0000-0002-6659-0416"))) #TODO
        self.graph.add((self.base, URIRef("http://geneontology.org/lego/modelstate"), Literal("development")))
        self.graph.add((self.base, OWL.versionIRI, self.base))