Platform Release 29 Notes

From n² wiki

Jump to: navigation, search

[edit] The Sparql services now supports Aggregates

The Sparql services now supports the following Aggregates:

  • count(), sum()
  • variants of count, including count(distinct ?var)
  • select expressions to allow assignment in select clause, e.g. (count(?x) AS ?count)
  • A HAVING and GROUP BY solution modifier

Examples of queries using the above are shown below.

 #Count how many people have ages.
 PREFIX foaf: <http://xmlns.com/foaf/0.1/>
 SELECT count(*) WHERE {
   ?x a foaf:Person;
     foaf:age ?age.
 }
 #Count how many people have ages. Using select expression
 PREFIX foaf: <http://xmlns.com/foaf/0.1/>
 SELECT ( count(*) AS ?count ) WHERE {
   ?x a foaf:Person;
     foaf:age ?age.
 }
 #Sum up ages
 PREFIX foaf: <http://xmlns.com/foaf/0.1/>
 SELECT ( sum(?age) AS ?ages ) WHERE {
   ?x a foaf:Person;
      foaf:age ?age.
 }
 #How many people does Buzz know?
 PREFIX foaf: <http://xmlns.com/foaf/0.1/>
 PREFIX data: <http://www.example.org/schema/>
 PREFIX ex: <http://www.example.org/schema/>
 SELECT ( count(distinct ?friend) as ?count ) WHERE {
   ex:Buzz foaf:knows ?friend.
 }
 #Summarize ages using group by and order by
 PREFIX foaf: <http://xmlns.com/foaf/0.1/>
 SELECT ?age ( count(?age) AS ?count ) WHERE {
   ?x a foaf:Person;
     foaf:age ?age.
 }
 GROUP BY ?age
 ORDER BY DESC(?count)
 #Which ages have more than one person with that age?
 PREFIX foaf: <http://xmlns.com/foaf/0.1/>
 SELECT ?age ( count(?age) as ?count ) WHERE {
   ?x a foaf:Person;
     foaf:age ?age.
 }
 GROUP BY ?age
 HAVING (?count > 1)

[edit] The Metabox and Sparql services now support text/turtle media type for Turtle

Previous releases of the Platform have only accepted the "pre-registration" mime type for Turtle of "application/x-turtle". According to the W3C Turtle Team Submission [1], the correct mime type for Turtle is "text/turtle". This is now accepted by both the Metabox and Sparql services. The submission also notes that "pre-registration application/x-turtle should be accepted" and so the Platform also continues to accept this mime type for Turtle.

[edit] API Issues

The following API issues have been resolved in this release.



[1] http://www.w3.org/TeamSubmission/turtle/#sec-mime

Personal tools