Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

object endpoint to find internal links for resources #145

Merged
merged 19 commits into from
Aug 31, 2023

Conversation

recalcitrantsupplant
Copy link
Collaborator

@recalcitrantsupplant recalcitrantsupplant commented Aug 9, 2023

From dev readme:
High Level Sequence /object endpoint

Prez provides a /object endpoint as an endpoint that supplies any information known about a given URI. If an annotated
mediatype is requested, prez will additionally provide all system links for endpoints which can render the object. The
high level sequence for this endpoint is as follows:

  1. Get the URI for the object from the query string
  2. Get the class(es) of the object from the triplestore
  3. Use prez's reference data for endpoints to determine which endpoints can render this object, and, a template for
    these endpoints, specifying any variables that need to be substituted (such as parent URIs).
  4. Get the object information from the triplestore, using an open profile, and in parallel any system information needed
    to construct the system links.
  5. Return the response

The same functions that are used to do the above have been generally applied to annotated responses. Any annotated response from prez will now:

  1. Find any URIs in the initial response from the triplestore
  2. Find the classes for these URIs
  3. Use the (new) prez endpoints graph (reference_data/endpoints/) to find endpoints that can deliver the class(es), and, get a template for these endpoints, specifying any variables that need to be substituted (such as parent URIs).
  4. Go back to the triplestore to populate the endpoint templates.
  5. Return the original response + prez:links

Other minor changes:

  • Add endpoint reference data to support system link generation (reference_data/endpoints)
  • Rename inbound/outbound children/parents to focus to/from child/parent terminology to align with SHACL. Rename general_class to base_class. Resolves Rename general_class to item_class #101
  • Add a triple: of the form: <focus_uri> prez:endpointComponentURI <uri_used_in_endpoint> <endpoint_component_uri> dcterms:identifier "{curie_id}"^^prez:identifier for parent CURIEs in endpoints such that the URIs of parents are included in the response, and get annotated, such that labels are available for breadcrumbs.

Add endpoint reference data to support system link generation.
Rename inbound/outbound children/parents to focus to/from child/parent terminology to align with SHACL. Rename general_class to base_class. Resolves #101
Remove commented code.
Remove commented code.
Fix object tests.
Add endpoint reference data to support system link generation.
Rename inbound/outbound children/parents to focus to/from child/parent terminology to align with SHACL. Rename general_class to base_class. Resolves #101
Remove commented code.
Remove commented code.
Fix object tests.
…eterministic way on startup and we shouldn't rely on them being deterministic in tests. Both ns1 & ns2 come back in responses for the same link (for a given URI) if the test is run multiple times. Workaround implemented. The test is not intended to test link generation or prefix generation.
…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.
Add setting to make ordering optional via ORDER_LISTS_BY_LABEL environment variable, which is on by default.
@recalcitrantsupplant recalcitrantsupplant marked this pull request as ready for review August 22, 2023 11:42
Copy link
Collaborator

@jamiefeiss jamiefeiss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally, the /profiles endpoint doesn't return prez:links

@edmondchuc
Copy link
Collaborator

Can confirm. I have the same issue as @jamiefeiss.

@recalcitrantsupplant
Copy link
Collaborator Author

I have a fix coming, should be tomorrow.

Copy link
Collaborator

@jamiefeiss jamiefeiss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After some local testing, I've found two issues:

  1. For a skos:Concept page, the prez:endpointComponentURI triple seems to be missing:
aarr:chair a skos:Concept ;
    dcterms:identifier "aarr:chair"^^prez1:identifier ;
    dcterms:provenance "Developed for this Agent to Agent Roles vocabulary"@en ;
    rdfs:isDefinedBy <https://data.idnau.org/pid/vocab/aarr> ;
    skos:broader aarr:member ;
    skos:definition "The presiding officer of an assembly, meeting, committee, or board"@en ;
    skos:inScheme <https://data.idnau.org/pid/vocab/aarr> ;
    skos:prefLabel "Chair"@en ;
    skos:scopeNote "Organisation to Person relations" ;
    prez1:link "/v/vocab/vcb:aarr/aarr:chair" .
  1. For a skos:Collection page, a server error occurs: AttributeError: 'list' object has no attribute 'name', which points to this line:

response = profiles_graph_cache.query(query)

where the problem seems to be a missing class in the SPARQL query:

VALUES ?class {}

@recalcitrantsupplant
Copy link
Collaborator Author

recalcitrantsupplant commented Aug 28, 2023 via email

…prez:identifier for providing parent information that can be used in breadcrumbs. Update tests accordingly.

Bugfix: Add endpoint name so vocprez endpoint functions correctly.
@recalcitrantsupplant
Copy link
Collaborator Author

@jamiefeiss both fixed now - note I've switched to the dcterms:identifier to include parent URL components / their labels. From the updated notes:

Add a triple: of the form: <endpoint_component_uri> dcterms:identifier "{curie_id}"^^prez:identifier for parent CURIEs in endpoints such that the URIs of parents are included in the response, and get annotated, such that labels are available for breadcrumbs.

prez/cache.py Outdated Show resolved Hide resolved
cheers

Co-authored-by: Edmond Chuc <37032744+edmondchuc@users.noreply.github.com>
@jamiefeiss jamiefeiss self-requested a review August 30, 2023 07:15
Copy link
Collaborator

@jamiefeiss jamiefeiss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The frontend has everything it needs now after local testing. Thanks David

@recalcitrantsupplant
Copy link
Collaborator Author

@edmondchuc I think I've addressed the feedback (just the single suggested change) let me know if I've missed something otherwise will merge

Copy link
Collaborator

@jamiefeiss jamiefeiss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found another issue I must've overlooked before: search results are missing labels and geometries. See the screenshot below, the map with geometries should be displaying on the right:

image

@recalcitrantsupplant
Copy link
Collaborator Author

thanks Jamie, not sure if these changes caused that issue, in any case I'd like to merge this in before this PR gets any larger. Could you raise an issue separately? I'll address it when making the filter addition to search.

@recalcitrantsupplant recalcitrantsupplant merged commit df00e01 into main Aug 31, 2023
1 check passed
@recalcitrantsupplant recalcitrantsupplant deleted the david/object-endpoint branch June 6, 2024 11:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rename general_class to item_class
3 participants