Search code examples
sparqldbpedia

Sparql for events in dbpedia


I am new to SPARQL, and trying to query event data on DBPedia whose source articles are in Dutch.

How could I query type of events, count numbers of each event type? Please advise. I am using http://dbpedia.org/sparql because http://events.dbpedia.org/sparql won't work.

Thanks in advance!

Edit: I'm adding my query as advised. Is the following the correct query to count MilitaryConflict events?

SELECT (count(distinct ?event) as ?cnt)
WHERE{?event a <http://dbpedia.org/ontology/MilitaryConflict> .
}

Solution

  • Yes, your query is correct to count entities of type dbo:MilitaryConflict.

    Here are a couple other queries, starting from yours, which should help you continue...

    query 1 (results)--

    PREFIX  dbo:  <http://dbpedia.org/ontology/>
    
    SELECT 
        ( COUNT (DISTINCT ?abs) AS ?cnt )
    WHERE
      { ?event  a             dbo:MilitaryConflict ;
                dbo:abstract  ?abs .
        FILTER ( LANGMATCHES ( LANG(?abs) , "nl" ) )
    }
    

    -- and query 2 (results)--

    PREFIX  dbo:  <http://dbpedia.org/ontology/>
    
    SELECT 
        DISTINCT ?event ?abs 
    WHERE
      { ?event  a             dbo:MilitaryConflict ;
                dbo:abstract  ?abs .
        FILTER ( LANGMATCHES ( LANG(?abs) , "nl" ) )
    }
    

    NOTE -- The "Default Graph" value in the SPARQL form (which becomes the default-graph-uri= query argument in the links you'll click above) must be left blank, to get results for all languages.