Beispiel #1
0
 def get_format(
         entity: Entity,
         parser: Dict[str, Any]) \
         -> Union[List[Dict[str, Any]], Dict[str, Any]]:
     if parser['format'] == 'geojson':
         return Geojson.return_output(Geojson.get_geojson([entity]))
     return LinkedPlaces.get_entity(entity, get_all_links(entity.id),
                                    get_all_links_inverse(entity.id),
                                    parser)
Beispiel #2
0
 def link_builder(new_entities: list[Entity],
                  parser: dict[str, Any],
                  inverse: bool = False) -> list[Link]:
     if any(i in ['relations', 'types', 'depictions', 'links', 'geometry']
            for i in parser['show']):
         entities = [e.id for e in new_entities[:int(parser['limit'])]]
         return get_all_links_inverse(entities) \
             if inverse else get_all_links(entities)
     return []
Beispiel #3
0
 def get_linked_entities(id_: int) -> List[Entity]:
     domain_ids = [link_.range for link_ in get_all_links(id_)]
     range_ids = [link_.domain for link_ in get_all_links_inverse(id_)]
     return range_ids + domain_ids