Sparql endpoint/Maintenance

From Openresearch
Jump to: navigation, search
Find all event series all/most of whose events have less than N properties?
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX smwont: <http://data.semanticweb.org/ns/swc/ontology#>
PREFIX property: <http://openresearch.org/Special:URIResolver/Property-3A>

SELECT ?series
  (COUNT(DISTINCT ?event) AS ?eventCount)
  (SUM(?propertyCount) as ?propertySum)
  ((?propertySum / ?eventCount) AS ?avgPropPerEvt)
WHERE
{
?event property:Event_in_series ?series .
{
SELECT ?event (COUNT(DISTINCT ?p) AS ?propertyCount) WHERE {
?event a smwont:ConferenceEvent .
?event ?p ?o .
} GROUP BY ?event ?series
}
} 
GROUP BY ?series
HAVING (?avgPropPerEvt < 25)
ORDER BY (?avgPropPerEvt)
LIMIT 10