|
| 1 | +# install.packages("SPARQL") |
| 2 | +library(SPARQL) |
| 3 | + |
| 4 | +endpoint <- "http://linkedpolitics.ops.few.vu.nl/sparql/" |
| 5 | + |
| 6 | +q <- "SELECT ?text ?date ?agendaitemnr ?speechnr |
| 7 | +WHERE { |
| 8 | +?sessionday rdf:type lpv_eu:SessionDay . |
| 9 | +?sessionday dcterms:date ?date. |
| 10 | +?sessionday dcterms:hasPart ?agendaitem. |
| 11 | +?agendaitem dcterms:hasPart ?speech. |
| 12 | +
|
| 13 | +?agendaitem lpv:number ?agendaitemnr. |
| 14 | +?speech lpv:number ?speechnr. |
| 15 | +?speech lpv:spokenText ?text. |
| 16 | +FILTER ( ?date >= '2009-05-06'^^xsd:date && ?date <= '2010-05-06'^^xsd:date ) |
| 17 | +FILTER(langMatches(lang(?text), 'en')) |
| 18 | +
|
| 19 | +} ORDER BY ?date ?agendaitemnr ?speechnr LIMIT 100" |
| 20 | +res <- SPARQL(endpoint, q)$results |
| 21 | +res$date <- as.Date(as.POSIXct(res$date, origin = "1970-01-01")) |
| 22 | + |
| 23 | + |
| 24 | +q <- "SELECT ?partyname (COUNT(DISTINCT ?speech) AS ?speechno) |
| 25 | +WHERE { |
| 26 | +<http://purl.org/linkedpolitics/eu/plenary/2010-12-16_AgendaItem_4> dcterms:hasPart ?speech. |
| 27 | +?speech lpv:spokenAs ?function. |
| 28 | +?function lpv:institution ?party. |
| 29 | +?party rdf:type lpv:EUParty. |
| 30 | +?party lpv:acronym ?partyname. |
| 31 | +} GROUP BY ?partyname" |
| 32 | +res2 <- SPARQL(endpoint, q)$results |
| 33 | + |
| 34 | + |
| 35 | + |
| 36 | +q <- "SELECT ?partyname (COUNT(DISTINCT ?speech) AS ?speechno) |
| 37 | +WHERE { |
| 38 | +?ai rdf:type <http://purl.org/linkedpolitics/vocabulary/eu/plenary/AgendaItem>. |
| 39 | +?ai dcterms:hasPart ?speech. |
| 40 | +?speech lpv:speaker ?speaker. |
| 41 | +?speaker lpv:countryOfRepresentation ?country. |
| 42 | +?country rdfs:label ?label. |
| 43 | +filter(?label='Poland'@en)}" |
| 44 | +res3 <- SPARQL(endpoint, q)$results |
0 commit comments