In the following code block
|
def triples( # type:ignore |
|
self, triple: tuple[URIRef, URIRef, URIRef] |
|
) -> Iterable[tuple[URIRef, URIRef, URIRef]]: |
|
"""Generate triples, overriden to dynamically generate mappings based on this graph's converter.""" |
|
subj_query, pred_query, obj_query = triple |
|
if pred_query in self.query_predicates: |
|
if subj_query is None and obj_query is not None: |
|
subjects = self._expand_pair_all(obj_query) |
|
for subj, pred in itt.product(subjects, self.query_predicates): |
|
yield subj, pred, obj_query |
|
elif subj_query is not None and obj_query is None: |
|
objects = self._expand_pair_all(subj_query) |
|
for obj, pred in itt.product(objects, self.query_predicates): |
|
yield subj_query, pred, obj |
Add the following else clause:
elif subj_query is not None and obj_query is not None:
if obj_query in self._expand_pair_all(subj_query):
yield subj_query, pred_query, obj_query
In the following code block
curies/src/curies/mapping_service/api.py
Lines 106 to 119 in 5f20618
Add the following
elseclause: