diff --git a/prez/reference_data/profiles/ogc_features.ttl b/prez/reference_data/profiles/ogc_features.ttl index 4ae80fd..7323229 100644 --- a/prez/reference_data/profiles/ogc_features.ttl +++ b/prez/reference_data/profiles/ogc_features.ttl @@ -9,7 +9,7 @@ @prefix shext: . @prefix xsd: . -prez:OGCFeaturesProfile a prof:Profile ; +prez:OGCFeaturesProfile a prof:Profile , prez:IndexProfile ; dcterms:description "A system profile for OGC Features conformant API" ; dcterms:identifier "ogcfeat"^^xsd:token ; dcterms:title "OGC Features Profile" ; diff --git a/prez/reference_data/profiles/ogc_records_profile.ttl b/prez/reference_data/profiles/ogc_records_profile.ttl index 61b1eee..15e9b56 100644 --- a/prez/reference_data/profiles/ogc_records_profile.ttl +++ b/prez/reference_data/profiles/ogc_records_profile.ttl @@ -16,7 +16,7 @@ PREFIX shext: prez:OGCRecordsProfile - a prof:Profile ; + a prof:Profile , prez:IndexProfile ; dcterms:identifier "ogc"^^xsd:token ; dcterms:description "A system profile for OGC Records conformant API" ; dcterms:title "OGC Profile" ; @@ -57,8 +57,7 @@ prez:OGCRecordsProfile sh:targetClass dcat:Catalog, dcat:Resource, - skos:Concept - , + skos:Concept , skos:Collection, rdf:Resource ; altr-ext:hasDefaultProfile prez:OGCItemProfile diff --git a/prez/reference_data/profiles/prez_default_profiles.ttl b/prez/reference_data/profiles/prez_default_profiles.ttl index 479bdca..d9c0529 100644 --- a/prez/reference_data/profiles/prez_default_profiles.ttl +++ b/prez/reference_data/profiles/prez_default_profiles.ttl @@ -16,7 +16,7 @@ PREFIX xsd: - a prof:Profile ; + a prof:Profile , prez:IndexProfile ; dcterms:identifier "prez"^^xsd:token ; dcterms:description "A profile for the Prez Linked Data API" ; dcterms:title "Prez profile" ; diff --git a/prez/services/annotations.py b/prez/services/annotations.py index 7ab4966..b59ddd8 100755 --- a/prez/services/annotations.py +++ b/prez/services/annotations.py @@ -100,7 +100,10 @@ async def process_uncached_terms( rdf_queries=[annotations_query], tabular_queries=[] ) - all_results = context_results[0] + repo_results[0] + system_results[0] + all_results = Graph() + all_results += context_results[0] + all_results += repo_results[0] + all_results += system_results[0] # Initialize subjects_map with each term having an empty set to start with subjects_map = {term: set() for term in terms} diff --git a/prez/services/generate_profiles.py b/prez/services/generate_profiles.py index 734122b..6fda42e 100755 --- a/prez/services/generate_profiles.py +++ b/prez/services/generate_profiles.py @@ -18,35 +18,12 @@ async def create_profiles_graph(repo) -> Graph: profiles_graph_cache.parse(f) log.info("Prez default profiles loaded") remote_profiles_query = """ - PREFIX dcat: - PREFIX geo: PREFIX prof: - PREFIX skos: - PREFIX rdfs: - - CONSTRUCT {?s ?p ?o . - ?o ?p2 ?o2 . - ?o2 ?p3 ?o3 . - ?class ?cp ?co} - WHERE {?s a prof:Profile ; - ?p ?o - OPTIONAL {?o ?p2 ?o2 - FILTER(ISBLANK(?o)) - OPTIONAL {?o2 ?p3 ?o3 - FILTER(ISBLANK(?o2))} - } - OPTIONAL { - ?class rdfs:subClassOf dcat:Resource ; - ?cp ?co . - } - OPTIONAL { - ?class rdfs:subClassOf geo:Feature ; - ?cp ?co . - } - OPTIONAL { - ?class rdfs:subClassOf skos:Concept ; - ?cp ?co . - } + PREFIX prez: + + DESCRIBE ?prof { + VALUES ?prof_class { prez:ListingProfile prez:ObjectProfile prez:IndexProfile } + ?prof a ?prof_class } """ g, _ = await repo.send_queries([remote_profiles_query], []) diff --git a/prez/services/query_generation/count.py b/prez/services/query_generation/count.py index e1e92d3..8573dde 100755 --- a/prez/services/query_generation/count.py +++ b/prez/services/query_generation/count.py @@ -48,9 +48,9 @@ class CountQuery(ConstructQuery): } WHERE { { - SELECT (COUNT(DISTINCT ?focus_node) AS ?count) + SELECT (COUNT(?focus_node) AS ?count) WHERE { - SELECT ?focus_node + SELECT DISTINCT ?focus_node WHERE { <<< original where clause >>> } LIMIT 101 @@ -64,7 +64,10 @@ def __init__(self, original_subselect: SubSelect): limit = settings.listing_count_limit limit_plus_one = limit + 1 inner_ss = SubSelect( - select_clause=SelectClause(variables_or_all=[Var(value="focus_node")]), + select_clause=SelectClause( + variables_or_all=[Var(value="focus_node")], + distinct=True, + ), where_clause=original_subselect.where_clause, solution_modifier=SolutionModifier( limit_offset=LimitOffsetClauses( @@ -78,7 +81,6 @@ def __init__(self, original_subselect: SubSelect): content=BuiltInCall( other_expressions=Aggregate( function_name="COUNT", - distinct=True, expression=Expression.from_primary_expression( PrimaryExpression(content=Var(value="focus_node")) ),