src/core/rdf_models.py
changeset 28 5918a9d353d0
parent 0 4095911a7830
child 334 169b7cfd1f58
equal deleted inserted replaced
27:d5f4dde387a9 28:5918a9d353d0
    31         connect_config = "%(engine)s://%(user)s:%(password)s@%(host)s:%(port)s/%(name)s"%sa_db_settings 
    31         connect_config = "%(engine)s://%(user)s:%(password)s@%(host)s:%(port)s/%(name)s"%sa_db_settings 
    32 
    32 
    33         return ConjunctiveGraph.open(self, connect_config, create=create)
    33         return ConjunctiveGraph.open(self, connect_config, create=create)
    34 
    34 
    35     def get_uri_for_term(self, term, context):
    35     def get_uri_for_term(self, term, context):
    36         c = URIRef(context)
    36         c = self.get_context(URIRef(context))
    37         tl = Literal(term)
    37         tl = Literal(term)
    38         
    38         
    39         for s,p,_ in self.triples((None, None, tl), context=c):
    39         for s,p,_ in self.triples((None, None, tl), context=c):
    40             if p in [URIRef("http://www.w3.org/2004/02/skos/core#prefLabel"), URIRef("http://www.w3.org/2004/02/skos/core#alternateLabel")]:
    40             if p in [URIRef("http://www.w3.org/2004/02/skos/core#prefLabel"), URIRef("http://www.w3.org/2004/02/skos/core#alternateLabel")]:
    41                 return unicode(s)
    41                 return unicode(s)