Skip to main content

Basic info about NFDI consortia. Named entity linking for them. Support for Wikidata WikiProject NFDI.

Project description

NFDI

PyPI version Jupyter Book Badge

The Python library NFDI provides:

  • basic information about NFDI (also known as Nationale ForschungsDatenInfrastruktur and National Research Data Infrastructure) and all funded NFDI consortia,
  • support for Wikidata WikiProject NFDI aimed to create and edit the Wikidata entities and entity schemas relevant for NFDI,
  • simple named entity linker on texts for the accepted NFDI consortia.

The NFDI Jupyter Book describes:

Table of contents

Installation

pip install NFDI

How to use

Module info

[docs module info]

The module info has classes consortium and consortia:

from nfdi import info
nfdi = info.consortia()
berd = info.consortium('BERD@NFDI')

The instance nfdi has the following attributes: 'label', 'homepage', 'wikidata', 'github', 'google', 'linkedin', 'twitter', 'youtube', 'zenodo', 'labels', 'consortia'. For example:

nfdi.twitter

prints

"https://twitter.com/NFDI_de"

The instances nfdi and berd have the methods print, dict and _wikidata:

json = berd._wikidata()
nfdi.print()

The json variable contains JSON representation of the corresponding entity at Wikidata including labels, aliases and descriptions:

print('LABELS', json.get('labels'))
print('DESCRIPTIONS', json.get('descriptions'))
print('ALIASES', json.get('aliases'))

It prints:

LABELS {'en': {'language': 'en', 'value': 'BERD@NFDI'}, 'de': {'language': 'de', 'value': 'BERD@NFDI'}, 'fr': {'language': 'fr', 'value': 'BERD@NFDI'}, 'bar': {'language': 'bar', 'value': 'BERD@NFDI'}, 'de-at': {'language': 'de-at', 'value': 'BERD@NFDI'}, 'de-ch': {'language': 'de-ch', 'value': 'BERD@NFDI'}, 'de-formal': {'language': 'de-formal', 'value': 'BERD@NFDI'}, 'en-ca': {'language': 'en-ca', 'value': 'BERD@NFDI'}, 'en-gb': {'language': 'en-gb', 'value': 'BERD@NFDI'}, 'es': {'language': 'es', 'value': 'BERD@NFDI'}, 'nl': {'language': 'nl', 'value': 'BERD@NFDI'}, 'pt': {'language': 'pt', 'value': 'BERD@NFDI'}, 'simple': {'language': 'simple', 'value': 'BERD@NFDI'}}
DESCRIPTIONS {'en': {'language': 'en', 'value': 'NFDI consortium for Business, Economic and Related Data (Social and Behavioural Sciences)'}, 'de': {'language': 'de', 'value': 'NFDI für Wirtschaftsdaten und Verwandtes (Sozial- und Verhaltenswissenschaften)'}}
ALIASES {'en': [{'language': 'en', 'value': 'BERD-NFDI'}], 'de': [{'language': 'de', 'value': 'BERD-NFDI'}], 'fr': [{'language': 'fr', 'value': 'BERD-NFDI'}], 'bar': [{'language': 'bar', 'value': 'BERD-NFDI'}], 'de-at': [{'language': 'de-at', 'value': 'BERD-NFDI'}], 'de-ch': [{'language': 'de-ch', 'value': 'BERD-NFDI'}], 'de-formal': [{'language': 'de-formal', 'value': 'BERD-NFDI'}], 'en-ca': [{'language': 'en-ca', 'value': 'BERD-NFDI'}], 'en-gb': [{'language': 'en-gb', 'value': 'BERD-NFDI'}], 'es': [{'language': 'es', 'value': 'BERD-NFDI'}], 'nl': [{'language': 'nl', 'value': 'BERD-NFDI'}], 'pt': [{'language': 'pt', 'value': 'BERD-NFDI'}], 'simple': [{'language': 'simple', 'value': 'BERD-NFDI'}]}

Module data

[docs module data]

The module data has raw data as a dictionary:

from nfdi import data
data.raw()

Module nel

[docs module nel]

The module nel provides simple rule-based named entity linker for the NFDI consortia. In Jupyter Notebook use

from nfdi.nel import linker, test
t = linker(test)
t.render()

where test stores the following sentences:

What are BERD@NFDI, NFDI4Earth, NFDI4DataScience, NFDI-MatWerk, PUNCH4NFDI, FAIRmat and Text+?
How are they related to NFDI4Ing, NFDI4Culture, NFDI4Chem and NFDIGHGA?

In Python console use:

from nfdi.nel import linker, test
t = linker(test)
t.serve()

The Wikidata QIDs are stored in .ent_id_:

from nfdi.nel import linker, test
t = linker(test)
for span in t.doc.ents:
    print((span.text, span.ent_id_, span.label_))

It prints:

('BERD@NFDI', 'Q108542181', 'ORG')
('NFDI4Earth', 'Q108542504', 'ORG')
('NFDI4DataScience', 'Q108542422', 'ORG')
('NFDI-MatWerk', 'Q108542607', 'ORG')
('PUNCH4NFDI', 'Q108542637', 'ORG')
('FAIRmat', 'Q108542373', 'ORG')
('Text+', 'Q98271443', 'ORG')
('NFDI4Ing', 'Q98380344', 'ORG')
('NFDI4Culture', 'Q98276929', 'ORG')
('NFDI4Chem', 'Q96678459', 'ORG')
('NFDIGHGA', 'Q98380337', 'ORG')

NFDI Jupyter Book

Check out NFDI Jupyter Book.

Deploying the Book locally

First, create and activate conda environment using the provided docs/environment.yml:

conda env create -f docs/environment.yml
conda activate nfdi

Then, build the Book:

jb build docs

Open the file docs/_build/html/index.html in a browser.

To remove the build folder, run:

jb clean --all docs

Deploying the Book at GitHub

Install ghp-import:

pip install ghp-import

Once the book is built, run:

ghp-import -n -p -f docs/_build/html

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

NFDI-0.1.1.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

NFDI-0.1.1-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file NFDI-0.1.1.tar.gz.

File metadata

  • Download URL: NFDI-0.1.1.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.7.6

File hashes

Hashes for NFDI-0.1.1.tar.gz
Algorithm Hash digest
SHA256 4efd08b8ae78791e70d7f60ce8be27858649766992def561bb3145d75301be21
MD5 8ae63daf5155f56a344878bf2b811159
BLAKE2b-256 4778dac7f713ecef70dd2f2f18809389d4143b90d703186e3f6751a793623d2e

See more details on using hashes here.

File details

Details for the file NFDI-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: NFDI-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.7.6

File hashes

Hashes for NFDI-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2744f58e1c1035f06551d7a46b94912e0f5226ae7a39554a2a21cfc1bf21acd0
MD5 b62f99081853462f3dd0a1db810b3985
BLAKE2b-256 17292d2033544db996d706113ee2fbfa94dbd4a65fd9d5b16765a3a1d9373519

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page