Project:QuickStatements: Difference between revisions
From MaRDI portal
Created page with "== Data Gift 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 [https://www.wikidata.org/wiki/Property:P11166 EuDML] prposed by [https://www.wikidata.org/wiki/User:Vladimir_Alexiev Vladimir Alexiev] in 2022, which has currently [https://doi.org/10.5281/zenodo.13894124 17] results. # Prepare query for the [https://query.portal.mardi4nfdi.de MaRDI SPARQL endpoint] #..." |
|||
Line 18: | Line 18: | ||
# Fid the properties in Wikidata, here only P11166 for eudml. | # Fid 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 ? | SELECT ?qid ?P11166 WHERE { | ||
?item wdt:P205 ?url ; | ?item wdt:P205 ?url ; | ||
wdt:P12 ? | wdt:P12 ?qid | ||
FILTER (STRSTARTS(str(?url) ,"https://eudml")) . | FILTER (STRSTARTS(str(?url) ,"https://eudml")) . | ||
BIND (substr(str(?url),23) as ?P11166) | BIND (substr(str(?url),23) as ?P11166) | ||
} | } | ||
LIMIT 3 | LIMIT 3 | ||
</syntaxhighlight> | </syntaxhighlight> | ||
# Download the CSV file and test with a few items on Wikidata | # Download the CSV file and test with a few items on Wikidata | ||
<!--# Optional add qualifier linking back to the source of the information (MaRDI) <syntaxhighlight lang=sparql> | |||
SELECT ?qid ?P11166 (str(?item) as ?qal854) WHERE { | |||
?item wdt:P205 ?url ; | |||
wdt:P12 ?qid | |||
FILTER (STRSTARTS(str(?url) ,"https://eudml")) . | |||
BIND (substr(str(?url),23) as ?P11166) | |||
} | |||
LIMIT 3 | |||
</syntaxhighlight> Note this step is not applicable as external identifiers should not have source information--> | |||
# Remove the limit and do the full import | # Remove the limit and do the full import |
Revision as of 20:56, 5 October 2024
Data Gift 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.
- Prepare query for the MaRDI SPARQL endpoint
- Find the qIDs P12 = WikidataQId
- The thing you want to export, here a part of the external url P205
- Write the query, example and investiage the result.
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
- Fid the properties in Wikidata, here only P11166 for eudml.
- Rewrite the query to match the Quickstatements CSV format
SELECT ?qid ?P11166 WHERE { ?item wdt:P205 ?url ; wdt:P12 ?qid FILTER (STRSTARTS(str(?url) ,"https://eudml")) . BIND (substr(str(?url),23) as ?P11166) } LIMIT 3
- Download the CSV file and test with a few items on Wikidata
- Remove the limit and do the full import