This commit is contained in:
2026-08-20 21:27:38 -04:00
parent fcb1da7e0d
commit 631bb539f1
3 changed files with 30 additions and 39 deletions
+5 -4
View File
@@ -123,8 +123,10 @@ impl<'a> Indexer<'a> {
}
pub async fn ontology(&self, client: &mut OntologyClient<Channel>) -> crate::Result<Vec<HashMap<Field, OwnedValue>>> {
let label_filter = self.language.to_filter_expression("label");
let description_filter = self.language.to_filter_expression("description");
let filter = LanguageCondition::filter([
(String::from("label"), self.language.clone()),
(String::from("description"), self.language.clone()),
]);
let mut request = OntologyQueryRequest::default();
request.sparql_query = Some(format!(r#"PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
@@ -135,12 +137,11 @@ SELECT ?class ?subject ?label ?description WHERE {{
VALUES ?class {{ rdf:Property rdfs:Class skos:Concept }}
?subject a ?class ;
rdfs:label ?label .
{label_filter}
OPTIONAL {{ ?subject rdfs:comment ?comment }}
OPTIONAL {{ ?subject skos:definition ?definition }}
BIND(COALESCE(?definition, ?comment) AS ?description)
{description_filter}
{filter}
}}"#));
let response = client.query(request).await?;