Project:Import Wikidata Entities
From MaRDI portal
This page documents how to copy over entities existing in Wikidata into the portal.
- Access the mardi-importer container. Follow the steps in Project:Access_Docker_container if necessary.
- Navigate into
/mardi_importer/mardi_importer/scripts
- Create a new python file or directly edit
sandbox.py
- Use the
import_entities
method from MardiIntegrator to import Wikidata entities. You just have to pass the identifier from Wikidata that you want to import.Thefrom mardi_importer.integrator import MardiIntegrator mc = MardiIntegrator() mc.import_entities('Q5')
import_entities
method can also accept a list of identifiers.Thefrom mardi_importer.integrator import MardiIntegrator mc = MardiIntegrator() mc.import_entities(['Q5', 'Q6', 'Q7'])
import_entities
method returns a list of the local IDs that are assigned when creating the item in the portal. If necessary, you can save or print those directly from your script. - Execute the script:
python3 sandbox.py