Skip to main content

A knowledge integration framework based on Wikidata

Project description

KIF KIF


Knowledge Integration Framework

KIF is a Python framework for knowledge integration from IBM Research.

It is based on Wikidata and licensed under the open-source Apache-2.0 license.

First time here? Check out the tutorial.

Looking for the sources? See the GitHub repository.

Supported Python Versions PyPI version Downloads


Hello world!

Install KIF using pip:

$ pip install kif-lib

Use KIF to query Wikidata:

>>> from kif_lib import Store
>>> from kif_lib.vocabulary import wd
>>> kb = Store('wikidata')
>>> next(kb.filter(subject=wd.Alan_Turing, property=wd.doctoral_advisor))
Statement(Item(IRI('http://www.wikidata.org/entity/Q7251')), ValueSnak(...))

Or, via KIF CLI (the command-line interface):

$ pip install kif-lib[cli]    # KIF CLI is an optional dependency
$ kif filter --subject=wd.Alan_Turing --property=wd.doctoral_advisor

(Statement (Item Alan Turing) (ValueSnak (Property doctoral advisor) (Item Alonzo Church)))

KIF can also be used query other knowledge sources. Here is a similar query over DBpedia (notice the -s dbpedia switch):

$ kif filter -s dbpedia --subject=db.Alan_Turing --property=wd.doctoral_advisor

(Statement (Item dbr:Alan_Turing) (ValueSnak (Property dbo:doctoralAdvisor) (Item dbr:Alonzo_Church)))

The result is a stream of Wikidata-like statements containing DBpedia entities.

KIF in a nutshell

KIF is a knowledge integration framework based on Wikidata. The idea behind it is to use Wikidata to standardize the syntax and (whenever possible) the vocabulary of the integrated knowledge sources. Users can then query the sources through filter patterns described in terms of the Wikidata data model.

The integration done by KIF is virtual in the sense that syntax and vocabulary translations happen dynamically (at query time) and are guided by user-provided mappings. KIF comes with built-in mappings for Wikidata, DBpedia, FactGrid, PubChem, and UniProt, among others. New mappings can be added programmatically.

Highlights

  • KIF allows one to query knowledge sources as if they were Wikidata.

  • KIF queries are written as simple, high-level filters using entities of the Wikidata data model, such as items, properties, quantities, snaks, statements, etc.

  • KIF can be used to query Wikidata itself or other knowledge sources, provided proper mappings are given.

  • KIF can run queries over local RDF data using RDFLib, Apache Jena, QLever, or RDFox.

  • KIF has full support for Python's asyncio. KIF async API can be used run queries asynchronously, without blocking waiting on their results.

Installation

To install KIF, use:

$ pip install kif-lib

To include KIF CLI, use:

$ pip install kif-lib[cli]

To include all extras, use:

$ pip install kif-lib[extra]

Documentation

KIF documentation is available at https://ibm.github.io/kif/.

For a primer on KIF, see the tutorial.

Dependencies

Required:

KIF CLI (optional):

  • click - Option parsing. (Optional, with kif-lib[cli])
  • rich - Rich terminal support. (Optional, with kif-lib[cli])

Extra (optional):

  • graphviz - Graph drawing. (Optional, with kif-lib[extra])
  • jpype1 - Java support. (Optional, with kif-lib[extra])
  • pandas - CSV/DataFrame support. (Optional, with kif-lib[extra])
  • psutil - Process information. (Optional, with kif-lib[extra])

Citation

Guilherme Lima, João M. B. Rodrigues, Marcelo Machado, Elton Soares, Sandro R. Fiorini, Raphael Thiago, Leonardo G. Azevedo, Viviane T. da Silva, Renato Cerqueira. 2024. "KIF: A Wikidata-Based Framework for Integrating Heterogeneous Knowledge Sources", arXiv:2403.10304, 2024.

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

kif_lib-0.13.0.tar.gz (723.2 kB view details)

Uploaded Source

Built Distribution

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

kif_lib-0.13.0-py3-none-any.whl (801.1 kB view details)

Uploaded Python 3

File details

Details for the file kif_lib-0.13.0.tar.gz.

File metadata

  • Download URL: kif_lib-0.13.0.tar.gz
  • Upload date:
  • Size: 723.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for kif_lib-0.13.0.tar.gz
Algorithm Hash digest
SHA256 fd9237c66e3318b3c342c7cacb51f93dbcbc4cfffe77718ce8af80dc6ed53b72
MD5 1cfa41bb497b517fa058cb6f97a02293
BLAKE2b-256 043c179ebf6dc3d53ff673741dfbdc59f0301ecf26d86468d825a6e65b91daf7

See more details on using hashes here.

File details

Details for the file kif_lib-0.13.0-py3-none-any.whl.

File metadata

  • Download URL: kif_lib-0.13.0-py3-none-any.whl
  • Upload date:
  • Size: 801.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for kif_lib-0.13.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d3666dd359f3a0229135519d0e92d584d7149168bcdcbe6ca766c12397eea6ba
MD5 5ba1e1ee831d577271cdfbb6ee7cf127
BLAKE2b-256 ade9e34ddc9e0c9f6f03f8e8a5b8fcd29abe9a5cba59ba7a5ec4525cfb48aeb0

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