Skip to content

MaRDI client to interact with the MaRDI knowledge graph

Notifications You must be signed in to change notification settings

MaRDI4NFDI/mardiclient

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 

Repository files navigation

mardi-client

MaRDI client to interact with the MaRDI knowledge graph.

Installation

git clone https://github.com/MaRDI4NFDI/mardiclient.git
cd mardiclient
python -m pip install --upgrade pip setuptools
python -m pip install .

Setup user and password

from mardiclient import MardiClient

mc = MardiClient(user="username", password="my-password")

Get data from an existing item

my_item = mc.item.get(entity_id='Q1')

Create a new item with statements

# Create a new item
item = mc.item.new()

# Set an english label
item.labels.set(language='en', value='My package')

# Set an english description
item.descriptions.set(language='en', value='A generic R package')

# Add a statement (instance of = R package)
item.add_claim('wdt:P31', 'wd:Q73539779')

# Write the item
item.write()

Wikidata properties and items must be prefixed with wdt: and wd:, respectively. No prefixes are necessary if MaRDI identifiers are used.

Change default configuration

The MaRDI Client is setup to interact with the portal at https://portal.mardi4nfdi.de

The default settings can be overwritten with

from mardiclient import config

config['IMPORTER_API_URL'] = 'api_endpoint'
config['MEDIAWIKI_API_URL'] = 'mediawiki_api'
config['SPARQL_ENDPOINT_URL'] = 'sparql_endpoint'
config['WIKIBASE_URL'] = 'wikibase_url'

About

MaRDI client to interact with the MaRDI knowledge graph

Resources

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages