Skip to content

Commit

Permalink
Merge pull request #183 from InTaVia/ms/182-add-filter-to-retrieve-en…
Browse files Browse the repository at this point in the history
…tities-via-LOD-identifiers

feat: adds sameAs query parameter and filters in SPARQL query
  • Loading branch information
sennierer authored Jul 13, 2023
2 parents 465e2c9 + 74c3535 commit 678d894
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions intavia_backend/query_parameters_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ class Search_Base:
description="Searches across labels of all entity proxies. When not using quotes, the query will be wildcarded. When using quotes, \
the query will be exact. Keep in mind that the wildcards will be added right and left of the query (wildcards are not added per token).",
)
sameas: typing.List[HttpUrl] = Query(
default=None,
description="Searches for a specific entity proxy using sameAs URIs",)
occupation: str = Query(
default=None,
max_length=200,
Expand Down
6 changes: 6 additions & 0 deletions intavia_backend/sparql/query_entities_v2_1.sparql
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
?entityLabel bds:search "{{q}}" .
?entityLabel bds:rank ?score .
{%- endif -%}
{%- if sameas -%}
{%- for uri in sameas -%}
{?entity_proxy owl:sameAs <{{uri}}> }
{% if not loop.last %}UNION{% endif %}
{%- endfor -%}
{%- endif -%}
{%- if occupation -%}
?entity_proxy bioc:has_occupation ?occupation1 .
?occupation1 rdfs:label ?occupationLabel1 .
Expand Down

0 comments on commit 678d894

Please sign in to comment.