Skip to content

Commit 0163534

Browse files
useruser
user
authored and
user
committed
Dane nt. EP i z parlgov.org
1 parent f8ee561 commit 0163534

File tree

2 files changed

+55
-0
lines changed

2 files changed

+55
-0
lines changed

UseCase/EP/pargov.R

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
library(dplyr)
2+
library(lubridate)
3+
4+
read.csv("http://www.parlgov.org/static/stable/2015/view_party.csv") -> partie
5+
read.csv("http://www.parlgov.org/static/stable/2015/view_election.csv") -> wybory
6+
7+
wybory %>%
8+
filter(country_id == 74 & election_type == "ep") %>%
9+
count(rok = year(election_date), partia = party_name_short) %>%
10+
count(rok)
11+

UseCase/EP/queries.R

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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

Comments
 (0)