Skip to content

Commit

Permalink
OntTerm.source as a property to make it clear that it exists
Browse files Browse the repository at this point in the history
points to the deeper issues with how opaque the implementation is

source only appears as a keyword in the query result object and there
is a single line setattering those kwargs to OntTerm during
construction which makes it very hard to understand what is going on
  • Loading branch information
tgbugs committed Apr 23, 2019
1 parent 93defc9 commit e398eba
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions ontquery/terms.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,9 @@ def __real_init__(self, validated, results_gen, noId):

#print(keyword, value)
if keyword not in self.__firsts: # already managed by OntId
if keyword == 'source': # FIXME the things i do in the name of documentability >_<
keyword = '_source'

setattr(self, keyword, value) # TODO value lists...
self.validated = True

Expand Down Expand Up @@ -477,6 +480,15 @@ def debug(self):
if self._graph:
print(self._graph.serialize(format='nifttl').decode())

@property
def source(self):
""" The service that the term came from.
It is not obvious that source is being set from QueryResult.
I'm sure there are other issues like this due to the strange
interaction between OntTerm and QueryResult. """

return self._source

@classmethod
def search(cls, expression, prefix=None, filters=tuple(), limit=40):
""" Something that actually sort of works """
Expand Down

0 comments on commit e398eba

Please sign in to comment.