Skip to content

Commit

Permalink
Add prez:endpointComponentURI for parents in endpoints such that the …
Browse files Browse the repository at this point in the history
…URIs of parents are included in the response, and get annotated, such that labels are available for breadcrumbs. Update spaceprez profile to include dcterms:title for the OAS profile.
  • Loading branch information
recalcitrantsupplant committed Aug 18, 2023
1 parent 31383e9 commit d01e9df
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ prez:SpacePrezProfile
dcterms:description "The OGC API Features specifies the behavior of Web APIs that provide access to features in a dataset in a manner independent of the underlying data store." ;
dcterms:identifier "oai"^^xsd:token ;
dcterms:title "OGC API Features" ;
altr-ext:hasLabelPredicate dcterms:title ;
altr-ext:constrainsClass
dcat:Dataset ,
geo:FeatureCollection ,
Expand Down
11 changes: 11 additions & 0 deletions prez/routers/object.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,17 @@ def generate_system_links_object(
Literal(endpoint),
)
)
# TODO include the actual relationships between the object and the parent objects in the graph
for ep_result in relationship_results:
for k, v in ep_result.items():
if k != "endpoint":
internal_links_graph.add(
(
URIRef(object_uri),
PREZ["endpointComponentURI"],
URIRef(v["value"]),
)
)


# def generate_system_links_non_object(
Expand Down
8 changes: 4 additions & 4 deletions prez/sparql/objects_listings.py
Original file line number Diff line number Diff line change
Expand Up @@ -888,16 +888,16 @@ def generate_relationship_query(
for endpoint, relations in endpoint_to_relations.items():
subquery = f"""{{ SELECT ?endpoint {" ".join(["?parent_" + str(i+1) for i, _ in enumerate(relations)])}
WHERE {{\n BIND("{endpoint}" as ?endpoint)\n"""
previous_uri = f"<{uri}>"
uri_str = f"<{uri}>"
for i, relation in enumerate(relations):
predicate, direction = relation
parent = "?parent_" + str(i + 1)
if predicate:
if direction == Literal("parent_to_focus"):
subquery += f"{parent} <{predicate}> {previous_uri} .\n"
subquery += f"{parent} <{predicate}> {uri_str} .\n"
else: # assuming the direction is "focus_to_parent"
subquery += f"{previous_uri} <{predicate}> {parent} .\n"
previous_uri = parent
subquery += f"{uri_str} <{predicate}> {parent} .\n"
uri_str = parent
subquery += "}}"
subqueries.append(subquery)

Expand Down

0 comments on commit d01e9df

Please sign in to comment.