KIF is a knowledge integration framework from IBM Research.
KIF is based on Wikidata and it's licensed under the Apache-2.0 license.
First time here? Check out the quickstart guide.
-
KIF can be seen as a Python interface to query Wikidata (RDF).
-
KIF queries are written in the KIF pattern language, which is based on Wikidata's data model.
-
KIF can be used to query knowledge sources other than Wikidata, provided proper SPARQL mappings are given.
-
KIF comes with built-in mappings for DBpedia and PubChem RDF. Other mappings can be added programmatically.
Prints an arbitrary statement from Wikidata:
from kif_lib import *
from kif_lib.compiler.sparql.mapping.wikidata import WikidataMapping
kb = Store('sparql2', 'https://query.wikidata.org/sparql', WikidataMapping())
print(next(kb.filter()))
Prints an arbitrary Wikidata-like statement from DBpedia:
from kif_lib import *
from kif_lib.compiler.sparql.mapping.dbpedia import DBpediaMapping
kb = Store('sparql2', 'https://dbpedia.org/sparql', DBpediaMapping())
print(next(kb.filter()))
$ pip install kif-lib
See documentation and examples.
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. "KIF: A Wikidata-Based Framework for Integrating Heterogeneous Knowledge Sources", arXiv:2403.10304, 2024.
Released under the Apache-2.0 license.