Project:Import Wikidata Entities: Difference between revisions
From MaRDI portal
EloiFerrer (talk | contribs) No edit summary Tag: Reverted |
EloiFerrer (talk | contribs) No edit summary Tag: Manual revert |
||
Line 18: | Line 18: | ||
</syntaxhighlight>The <code>import_entities</code> 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. | </syntaxhighlight>The <code>import_entities</code> 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: <code>python3 sandbox.py</code> | # Execute the script: <code>python3 sandbox.py</code> | ||
Latest revision as of 13:17, 16 April 2024
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