RDFLib / prez

Prez is a data-configurable Linked Data API framework that delivers profiles of Knowledge Graph data according to the Content Negotiation by Profile standard.
BSD 3-Clause "New" or "Revised" License
22 stars 8 forks source link

object endpoint to find internal links for resources #145

Closed recalcitrantsupplant closed 1 year ago

recalcitrantsupplant commented 1 year ago

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:

  6. Find any URIs in the initial response from the triplestore
  7. Find the classes for these URIs
  8. 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).
  9. Go back to the triplestore to populate the endpoint templates.
  10. 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 https://github.com/RDFLib/prez/issues/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.
edmondchuc commented 1 year ago

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

recalcitrantsupplant commented 1 year ago

I have a fix coming, should be tomorrow.

recalcitrantsupplant commented 1 year ago

Thanks Jamie I'll take a look.

On Mon, 28 Aug 2023, 17:41 Jamie Feiss, @.***> wrote:

@.**** requested changes on this pull request.

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 @. ; rdfs:isDefinedBy https://data.idnau.org/pid/vocab/aarr ; skos:broader aarr:member ; skos:definition "The presiding officer of an assembly, meeting, committee, or @. ; skos:inScheme https://data.idnau.org/pid/vocab/aarr ; skos:prefLabel @.*** ; 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:

https://github.com/RDFLib/prez/blob/4d5a0ba0bdcae67323d2373fed655c2aa05e6697/prez/services/generate_profiles.py#L90

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

VALUES ?class {}

— Reply to this email directly, view it on GitHub https://github.com/RDFLib/prez/pull/145#pullrequestreview-1597661411, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACQUSNXFSDPJY7PKTRKH4A3XXRDTVANCNFSM6AAAAAA3J63ICA . You are receiving this because you authored the thread.Message ID: @.***>

recalcitrantsupplant commented 1 year ago

@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._

recalcitrantsupplant commented 1 year ago

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

recalcitrantsupplant commented 1 year ago

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.