welfare-state-analytics / riksdagen-corpus

Swedish parliamentary proceedings - Riksdagens protokoll 1867-today
Other
26 stars 5 forks source link

Formalize iort/i riksdagen kallad #287

Open MansMeg opened 1 year ago

MansMeg commented 1 year ago

Now we are fetching iort from wikidatas alias (where iort has also been updated manually in the project). @salgo60 has created a more formal object called "i riksdagen kallad" that contain the information more specifically. We should transition to using this, more specific, object instead. Although this is not as updated as the alias. Hence, I see that we need to do the following:

salgo60 commented 1 year ago

OT One thing I have missed is to match "Johansson i Rimforsa" to Rimforsa (Q1019412)

For pictures we have a construction with depicts P180

image

image

MansMeg commented 1 year ago

@salgo60 Two questions.

  1. I cant find your object i riksdagen kallad? In the above example it is just name (X i Rimforsa)?
  2. We might need to detail ”i riksdagen kallad” further by date (since some mps change their iort over time).
salgo60 commented 1 year ago

@salgo60 Two questions.

  1. I cant find your object i riksdagen kallad? In the above example it is just name (X i Rimforsa)?
  2. We might need to detail ”i riksdagen kallad” further by date (since some mps change their iort over time).

@MansMeg

  1. "i riksdagen kallad" = Q110382440
  2. P3831 objekt har rollen is a qualifier on property name P2561

==> SPARQL / query retrieve the Node P2561 and then the reference ( still work in progress)

image

image
  1. we dont have any source for when --> we just add serial number/ordningsnummer, in the bible they say just "later/senare" maybe we can use your data when you get it....

To see Q number/ P numbers as in the picture add the gadgets I have in my common.js to your Special:MyPage/common.js (you need an account) see also #123


did a cool example of Digital humaniora yesterday

see #139

  1. we have parties from the books added to Wikidata --> we can filter on "parties" with vilde in the name
  2. we have books scanned from 1894 1897 1900 1903 1906... what was stated at that time about a Swedish PM
    1. those scans has depict WD Q number
    2. we can find people with dates when they were called vilde and find pictures from that period --> we get a less biased opinion

image

salgo60 commented 1 year ago

@MansMeg if you in the query editor click code you will get the code to use to retrieve the data from a program - video

# pip install sparqlwrapper
# https://rdflib.github.io/sparqlwrapper/

import sys
from SPARQLWrapper import SPARQLWrapper, JSON

endpoint_url = "https://query.wikidata.org/sparql"

query = """#title: object i riksdagen kallad i Wikidata for 1st and 2nd
SELECT ?person ?personLabel  ?oit ?serial ?sourcevolume ?sourcepage ?SPA  {
  values ?befattning  {wd:Q110346241 wd:Q81531912} # 1st 2nd

  ?person wdt:P39 ?befattning.

  ?person p:P2561 ?nodeOIT.
  ?nodeOIT ps:P2561 ?oit.
  ?nodeOIT pq:P3831 wd:Q110382440 # I riksdagen kallad 

  OPTIONAL {?nodeOIT pq:P1545 ?serial}

  OPTIONAL{?nodeOIT prov:wasDerivedFrom [ pr:P4819 ?SPAid ] }
  OPTIONAL{?nodeOIT prov:wasDerivedFrom [ pr:P304 ?sourcepage ] }
  OPTIONAL{?nodeOIT prov:wasDerivedFrom [ pr:P478 ?sourcevolume ] }
  OPTIONAL{?nodeOIT prov:wasDerivedFrom [ pr:P1810 ?sourcenameas ] }
  BIND(URI(CONCAT("https://portrattarkiv.se/details/",?SPAid)) AS ?SPA)
    SERVICE wikibase:label { bd:serviceParam wikibase:language "sv,en". }
} order by ?personLabel"""

def get_results(endpoint_url, query):
    user_agent = "WDQS-example Python/%s.%s" % (sys.version_info[0], sys.version_info[1])
    # TODO adjust user agent; see https://w.wiki/CX6
    sparql = SPARQLWrapper(endpoint_url, agent=user_agent)
    sparql.setQuery(query)
    sparql.setReturnFormat(JSON)
    return sparql.query().convert()

results = get_results(endpoint_url, query)

for result in results["results"]["bindings"]:
    print(result)
MansMeg commented 1 year ago

Great!

Yes. We don't have a source for that per se. But I guess that could be arranged when we look into this. @Lottabrorsson , do you know if the i-orts are set/defined somewhere in the protocols? Maybe the first day of parliament or so? I.e. is there somewhere we could look up and reference when it comes to changes in iort?

If we find a good reference, is it possible to add a start and end date for the iort object in wikidata, @salgo60 ?

salgo60 commented 1 year ago

If we find a good reference, is it possible to add a start and end date for the iort object in wikidata, @salgo60 ?

YES that would be great but give us a persistent identifier to the source so we can quote it and other people can understand why we have a date #148 #208

The problem is not updating Wikidata ´the problem is that everyone can update Wikidata and 12 000 people are doing it every month... 😨 - listen to the changes

I would like to see usage of P1214 "time of earliest written record"

image

My hope

Right now I see that Wikidata is your friend but I hope that we in the future will get the persistent identifiers from you and you are the most trusted source in this equation.....

cc: @dpriskorn has added a lot of word usage to Wikidata from Riksdagen

image
BobBorges commented 1 year ago

I would like to see usage of P1214 "time of earliest written record"

Just curious -- why this and not P580 & P582 (start time and end time)?

salgo60 commented 1 year ago

I would like to see usage of P1214 "time of earliest written record"

Just curious -- why this and not P580 & P582 (start time and end time)?

Maybe both ;-) Feels more academic 😅 looks like in WD its used mostly for cities...

I think Riksarkivet used a term like that for Tora but I am not sure...

I feel step 1 is to start define your data and then use SKOS/Simple Knowledge Organization System and make it 5 star data see my test #129

image