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

Fix vocpub profile to display all properties for concepts #266

Merged
merged 2 commits into from
Sep 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion prez/reference_data/profiles/vocprez_default_profiles.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX schema: <https://schema.org/>
PREFIX sh: <http://www.w3.org/ns/shacl#>
PREFIX shext: <http://example.com/shacl-extension#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX reg: <http://purl.org/linked-data/registry#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
Expand Down Expand Up @@ -103,7 +104,7 @@ prez:VocPrezProfile
altr-ext:hasNodeShape [
a sh:NodeShape ;
sh:targetClass skos:ConceptScheme ;
altr-ext:relativeProperties skos:broader , skos:narrower ;
altr-ext:relativeProperties shext:allPredicateValues ;
] ;
altr-ext:hasNodeShape [
a sh:NodeShape ;
Expand Down
10 changes: 8 additions & 2 deletions prez/sparql/objects_listings.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,10 @@ def generate_relative_properties(
rel_string += """OPTIONAL { """
rel_string += f"""?{other_kvs[k]} ?rel_{k}_props ?rel_{k}_val .\n"""
if construct_select == "select":
rel_string += f"""VALUES ?rel_{k}_props {{ {" ".join('<' + str(pred) + '>' for pred in relative_properties)} }} }}\n"""
if relative_properties == [URIRef('http://example.com/shacl-extension#allPredicateValues')]:
rel_string += f"""VALUES ?rel_{k}_props {{ UNDEF }} }}\n"""
else:
rel_string += f"""VALUES ?rel_{k}_props {{ {" ".join('<' + pred + '>' for pred in relative_properties)} }} }}\n"""
return rel_string


Expand Down Expand Up @@ -272,7 +275,10 @@ def generate_include_predicates(include_predicates):
VALUES ?p { <http://example1.com> <http://example2.com> }
"""
if include_predicates:
return f"""VALUES ?p{{\n{chr(10).join([f"<{p}>" for p in include_predicates])}\n}}"""
if include_predicates == [URIRef('http://example.com/shacl-extension#allPredicateValues')]:
return ""
else:
return f"""VALUES ?p{{\n{chr(10).join([f"<{p}>" for p in include_predicates])}\n}}"""
return ""


Expand Down
Loading