Project:QuickStatements: Difference between revisions

From MaRDI portal
Line 1: Line 1:
== Data Gift to Wikidata ==
== Data transfer to Wikidata ==
This section describes how to export data from the MaRDI portal to Wikidata to make the data better findable for the general public.
This section describes how to export data from the MaRDI portal to Wikidata to make the data better findable for the general public.


Line 16: Line 16:
LIMIT 10
LIMIT 10
</syntaxhighlight> and investiage the result.  
</syntaxhighlight> and investiage the result.  
# Fid the properties in Wikidata, here only P11166 for eudml.
# Find the properties in Wikidata, here only P11166 for eudml.
# Rewrite the query to match the [https://www.wikidata.org/wiki/Help:QuickStatements Quickstatements CSV format] <syntaxhighlight lang=sparql>
# Rewrite the query to match the [https://www.wikidata.org/wiki/Help:QuickStatements Quickstatements CSV format] <syntaxhighlight lang=sparql>
SELECT ?qid ?P11166 WHERE {
SELECT ?qid ?P11166 WHERE {

Revision as of 09:56, 7 October 2024

Data transfer to Wikidata

This section describes how to export data from the MaRDI portal to Wikidata to make the data better findable for the general public.

Example EuDML prposed by Vladimir Alexiev in 2022, which has currently 17 results.

  1. Prepare query for the MaRDI SPARQL endpoint
    1. Find the qIDs P12 = WikidataQId
    2. The thing you want to export, here a part of the external url P205
  2. Write the query, example
    SELECT ?qID ?item ?eudmlid WHERE {
      ?item wdt:P205 ?url ;
            wdt:P12 ?qID
      FILTER (STRSTARTS(str(?url) ,"https://eudml")) .
      BIND (substr(str(?url),23) as ?eudmlid)
    }
    LIMIT 10
    
    and investiage the result.
  3. Find the properties in Wikidata, here only P11166 for eudml.
  4. Rewrite the query to match the Quickstatements CSV format
    SELECT ?qid ?P11166 WHERE {
      ?qal854 wdt:P205 ?url ;
            wdt:P12 ?qid
      FILTER (STRSTARTS(str(?url) ,"https://eudml")) .
      BIND (Concat( 
        "\"", ## Required for external identifiers by quickstatements
        SUBSTR(STR(?url),23), ## 23 = Length of the prefix
        "\"") as ?P11166)
      }
    LIMIT 3
    
  5. Download the CSV file and test with a few items on Wikidata
  6. Optional add source linking back to the source of the information (MaRDI)
    SELECT ?qid ?P11166 ?S854 WHERE {
      ?item wdt:P205 ?url ;
            wdt:P12 ?qid
      FILTER (STRSTARTS(str(?url) ,"https://eudml")) .
      BIND (Concat( 
        "\"", ## Required for external identifiers by quickstatements
        SUBSTR(STR(?url),23), ## 23 = Length of the prefix
        "\"") as ?P11166).
        BIND (Concat( 
        "\"", ## Required for external identifiers by quickstatements
        STR(?item), 
        "\"") as ?S854)
      }
    LIMIT 3
    
  7. Remove the limit and do the full import