Project:BotBased imports: Difference between revisions

From MaRDI portal
Created page with "== Synopsis == If you want to use a script to import / update items in the MaRDI Knowledge Graph, you might want to to that by using a Python script and the MardiClient library. This document describes the main steps. ===== Create the Python script ===== The core is something like this: <code>from mardiclient import MardiClient mc = MardiClient(user="username", password="my-password") item = mc.item.new() item.labels.set(language='en', value='My Label') item.write()</c..."
 
No edit summary
Line 5: Line 5:
The core is something like this:
The core is something like this:


<code>from mardiclient import MardiClient
<syntaxhighlight lang="python" line>
from mardiclient import MardiClient
mc = MardiClient(user="username", password="my-password")
mc = MardiClient(user="username", password="my-password")
item = mc.item.new()
item = mc.item.new()
item.labels.set(language='en', value='My Label')
item.labels.set(language='en', value='My Label')
item.write()</code>
item.write()
</syntaxhighlight>

Revision as of 10:12, 28 March 2025

Synopsis

If you want to use a script to import / update items in the MaRDI Knowledge Graph, you might want to to that by using a Python script and the MardiClient library. This document describes the main steps.

Create the Python script

The core is something like this:

from mardiclient import MardiClient
mc = MardiClient(user="username", password="my-password")
item = mc.item.new()
item.labels.set(language='en', value='My Label')
item.write()