Skip to content

Commit

Permalink
Dane nt. EP i z parlgov.org
Browse files Browse the repository at this point in the history
  • Loading branch information
user authored and user committed Jun 14, 2017
1 parent f8ee561 commit 0163534
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
11 changes: 11 additions & 0 deletions UseCase/EP/pargov.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
library(dplyr)
library(lubridate)

read.csv("http://www.parlgov.org/static/stable/2015/view_party.csv") -> partie
read.csv("http://www.parlgov.org/static/stable/2015/view_election.csv") -> wybory

wybory %>%
filter(country_id == 74 & election_type == "ep") %>%
count(rok = year(election_date), partia = party_name_short) %>%
count(rok)

44 changes: 44 additions & 0 deletions UseCase/EP/queries.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# install.packages("SPARQL")
library(SPARQL)

endpoint <- "http://linkedpolitics.ops.few.vu.nl/sparql/"

q <- "SELECT ?text ?date ?agendaitemnr ?speechnr
WHERE {
?sessionday rdf:type lpv_eu:SessionDay .
?sessionday dcterms:date ?date.
?sessionday dcterms:hasPart ?agendaitem.
?agendaitem dcterms:hasPart ?speech.
?agendaitem lpv:number ?agendaitemnr.
?speech lpv:number ?speechnr.
?speech lpv:spokenText ?text.
FILTER ( ?date >= '2009-05-06'^^xsd:date && ?date <= '2010-05-06'^^xsd:date )
FILTER(langMatches(lang(?text), 'en'))
} ORDER BY ?date ?agendaitemnr ?speechnr LIMIT 100"
res <- SPARQL(endpoint, q)$results
res$date <- as.Date(as.POSIXct(res$date, origin = "1970-01-01"))


q <- "SELECT ?partyname (COUNT(DISTINCT ?speech) AS ?speechno)
WHERE {
<http://purl.org/linkedpolitics/eu/plenary/2010-12-16_AgendaItem_4> dcterms:hasPart ?speech.
?speech lpv:spokenAs ?function.
?function lpv:institution ?party.
?party rdf:type lpv:EUParty.
?party lpv:acronym ?partyname.
} GROUP BY ?partyname"
res2 <- SPARQL(endpoint, q)$results



q <- "SELECT ?partyname (COUNT(DISTINCT ?speech) AS ?speechno)
WHERE {
?ai rdf:type <http://purl.org/linkedpolitics/vocabulary/eu/plenary/AgendaItem>.
?ai dcterms:hasPart ?speech.
?speech lpv:speaker ?speaker.
?speaker lpv:countryOfRepresentation ?country.
?country rdfs:label ?label.
filter(?label='Poland'@en)}"
res3 <- SPARQL(endpoint, q)$results

0 comments on commit 0163534

Please sign in to comment.