Skip to main content

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.

Release files for kif-lib 0.13.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kif-lib 0.13.0
File Size Uploaded
kif_lib-0.13.0.tar.gz 723.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for kif-lib 0.13.0
File Interpreter ABI Platform
kif_lib-0.13.0-py3-none-any.whl Python 3 none any Details

Total release size: 1.5 MB

Release files / kif_lib-0.13.0.tar.gz

Download URL kif_lib-0.13.0.tar.gz
Size 723.2 kB
Tags Source
SHA-256 checksum
How to use checksums
fd9237c66e3318b3c342c7cacb51f93dbcbc4cfffe77718ce8af80dc6ed53b72
BLAKE2b-256 checksum
How to use checksums
043c179ebf6dc3d53ff673741dfbdc59f0301ecf26d86468d825a6e65b91daf7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.0

Release files / kif_lib-0.13.0-py3-none-any.whl

Download URL kif_lib-0.13.0-py3-none-any.whl
Size 801.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d3666dd359f3a0229135519d0e92d584d7149168bcdcbe6ca766c12397eea6ba
BLAKE2b-256 checksum
How to use checksums
ade9e34ddc9e0c9f6f03f8e8a5b8fcd29abe9a5cba59ba7a5ec4525cfb48aeb0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.0

Release history Release notifications | RSS feed

This release

0.13.0 This release

2 release files

0.11.0

2 release files

0.10.0

2 release files

0.9.2

2 release files

0.9.1

2 release files

0.9.0

2 release files

0.8.2

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.8

2 release files

0.7.7

2 release files

0.7.6

2 release files

0.7.5

2 release files

0.7.4

2 release files

0.7.3

2 release files

0.7.2

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.3

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.5

2 release files

0.4.1

2 release files

0.4

2 release files

0.3

2 release files

0.2

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page