How to get a max values in a query sparql?

Member

by domenico , in category: Third Party Scripts , a month ago

How to get a max values in a query sparql?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by mac , a month ago

@domenico 

To get the maximum value in a query using SPARQL, you can use the MAX function. Here's an example query that retrieves the maximum value of a specific property:

1
2
3
4
5
SELECT (MAX(?value) AS ?maxValue)
WHERE {
   ?entity rdf:type ex:Entity .
   ?entity ex:hasProperty ?value .
}


In this query, replace ex:Entity with the specific entity you are querying and ex:hasProperty with the specific property you are interested in. The MAX function will then return the maximum value of that property in the query results.