.
This commit is contained in:
@@ -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?;
|
||||
|
||||
Reference in New Issue
Block a user