-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
object endpoint to find internal links for resources (#145)
* Object endpoint returns system links. 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 * Update documentation. Remove commented code. * Update documentation. Remove commented code. Fix object tests. * Object endpoint returns system links. 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 * Update documentation. Remove commented code. * Update documentation. Remove commented code. Fix object tests. * Roll out link generation across catprez / vocprez / spaceprez * Test bugfix: best guess the prefixes are not actualy generated in a deterministic 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. * Bugfix for profiles test * Add prez:endpointComponentURI for parents in endpoints such that the 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 TODOs. Add setting to make ordering optional via ORDER_LISTS_BY_LABEL environment variable, which is on by default. * Update tests to include endpointComponentURIs * Update profiles endpoints to include prez links Add vann prefixes; correct prefix format * Remove inadvertently added OGC content * Change use of prez:endpointComponentURI -> dcterms:identifier "abc"^^prez:identifier for providing parent information that can be used in breadcrumbs. Update tests accordingly. Bugfix: Add endpoint name so vocprez endpoint functions correctly. * Fix bug with identifiers not being included for concepts * Update test responses, comment one test. One bugfix to get_classes * Update prez/cache.py cheers Co-authored-by: Edmond Chuc <37032744+edmondchuc@users.noreply.github.com> --------- Co-authored-by: Edmond Chuc <37032744+edmondchuc@users.noreply.github.com>
- Loading branch information
1 parent
a56cb9a
commit df00e01
Showing
69 changed files
with
10,657 additions
and
1,871 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1 @@ | ||
from prez.models.catprez_item import CatalogItem | ||
from prez.models.catprez_listings import CatalogMembers | ||
from prez.models.vocprez_item import VocabItem | ||
from prez.models.vocprez_listings import VocabMembers | ||
from prez.models.spaceprez_item import SpatialItem | ||
from prez.models.spaceprez_listings import SpatialMembers | ||
from prez.models.search_method import SearchMethod |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
from typing import Optional, FrozenSet | ||
|
||
from pydantic import BaseModel, root_validator | ||
from rdflib import URIRef, Literal, XSD | ||
|
||
from prez.cache import endpoints_graph_cache | ||
from prez.reference_data.prez_ns import ONT | ||
|
||
|
||
class ListingModel(BaseModel): | ||
uri: Optional[ | ||
URIRef | ||
] = None # this is the URI of the focus object (if listing by membership) | ||
classes: Optional[FrozenSet[URIRef]] = None | ||
endpoint_uri: Optional[URIRef] = None | ||
selected_class: Optional[FrozenSet[URIRef]] = None | ||
profile: Optional[URIRef] = None | ||
top_level_listing: Optional[bool] = False | ||
|
||
def __hash__(self): | ||
return hash(self.uri) | ||
|
||
@root_validator | ||
def populate(cls, values): | ||
endpoint_uri_str = values.get("endpoint_uri") | ||
if endpoint_uri_str: | ||
endpoint_uri = URIRef(endpoint_uri_str) | ||
values["classes"] = frozenset( | ||
[ | ||
klass | ||
for klass in endpoints_graph_cache.objects( | ||
endpoint_uri, ONT.deliversClasses, None | ||
) | ||
] | ||
) | ||
values["base_class"] = endpoints_graph_cache.value( | ||
endpoint_uri, ONT.baseClass | ||
) | ||
tll_text = endpoints_graph_cache.value(endpoint_uri, ONT.isTopLevelEndpoint) | ||
if tll_text == Literal("true", datatype=XSD.boolean): | ||
values["top_level_listing"] = True | ||
else: | ||
values["top_level_listing"] = False | ||
return values |
Oops, something went wrong.