Various navigation modes, knowledge graph creation, and much more!
For the sake of immediate usabillity, this API is documented in the form of curl commands with example parameters. Our knowledge graphs come as software containers and can be deployed easily whereever you want to run them. As for any REST API, the endpoints can be called very flexibly, be it from a smartphone app, a web frontend, or just from your local system.
curl -i -H “Content-Type: application/json” -X PUT \ -d ‘{“token”: 2604251, “kg_name”: “ShowcaseKG”, “project_type”: “KG_QAKR”|”KG_QAPL”, “persistence”:”binary”, “persist_file”:”products_1000.pkl”, “data_path”: “/home/kguser/data/”}’ \ 10.247.70.8:5000/initialize
Initializes a Knowledge Graph project with parameters such as token, name, type, persistence, and data path.
curl -i -H “Content-Type: application/json” -X GET \ -d ‘{“token”: 2604251}’ \ 10.247.70.8:5000/kgproject
Returns the current project definition.
curl -i -H “Content-Type: application/json” -X PUT \ -d ‘{“token”: 2604251, “data_path”: “/home/kguser/data/”}’ \ 10.247.70.8:5000/kgpath
Sets a new data path for the project.
curl -i -H “Content-Type: application/json” -X PUT \ -d ‘{“token”: 23571113, “ontofile”:”showcase_logic2.qlf”, “accessfile”:”KG_Access_And_Querying.qlf”}’ \ 10.247.70.8:5000/deflogic
Additional endpoint for logic-based projects of type KG_QAPL.
curl -i -H “Content-Type: application/json” -X GET \ -d ‘{“token”: 2604251, “query”: “Do you have a chopping board made of spruce”}’ \ 10.247.70.8:5000/querylabels
Labels are simplified domain-specific terms and refer to entities.
curl -i -H “Content-Type: application/json” -X GET \ -d ‘{“token”: 2604251}’ \ 10.247.70.8:5000/alllabels
Returns a list of all labels in the Knowledge Graph.
curl -i -H “Content-Type: application/json” -X GET \ -d ‘{“token”: 2604251, “labels”: [“chopping board”, “spruce”], “support”:1}’ \ 10.247.70.8:5000/triplesbylabel
Triples are the basic statements of the Knowledge Graph. This endpoint returns all triples referenced by the given labels.
curl -i -H “Content-Type: application/json” -X GET \ -d ‘{“token”: 2604251, “pair”: [“chopping board”, “spruce”]}’ \ 10.247.70.8:5000/triplesbypair
The triple must match both labels.
curl -i -H “Content-Type: application/json” -X GET \ -d ‘{“token”: 2604251, “labels”: [“materials”, “lampshade”]}’ \ 10.247.70.8:5000/objectsbylabels
Returns all objects referenced by any of the given labels.
curl -i -H “Content-Type: application/json” -X GET \ -d ‘{“token”: 2604251, “object”:{“object”:”clothing”, “type”:”KGType.Entity”}}’ \ 10.247.70.8:5000/labelsforobjects
Returns all labels for a given object.
curl -i -H “Content-Type: application/json” -X GET \ -d ‘{“token”: 2604251, “objects”:[{“object”:”gardening tools”, “type”:”KGType.Entity”}], “support”:1}’ \ 10.247.70.8:5000/triplesbyobjects
The support parameter specifies how many objects from the list must match a triple.
curl -i -H “Content-Type: application/json” -X GET \ -d ‘{“token”: 2604251, “triple”:{“subj”:{“object”: “dragon”, “type”: “mythical_creature”},”prop”: {“object”: “quality”, “type”: “KGType.Property”}, “obj”:{“object”: “manager”, “type”: “KGType.Entity”}}, “withTypes”:0}’ \ 10.247.70.8:5000/reifications
A reification is a statement that refers to another statement. For example, it can indicate where a statement occurs in product records or descriptive texts.
curl -i -H “Content-Type: application/json” -X GET \ -d ‘{“token”: 2604251, “number”:1237, “type”:”KGType.Statement”}’ \ 10.247.70.8:5000/stmtortext
Returns the typed triple corresponding to the given statement number.
curl -i -H “Content-Type: application/json” -X GET \ -d ‘{“token”: 2604251, “number”:”t212″, “type”:”KGType.Text”}’ \ 10.247.70.8:5000/stmtortext
Returns the full text segment corresponding to the given number as a string.
curl -i -H “Content-Type: application/json” -X GET \ -d ‘{“token”: 2604251, “subj”:{“object”:”effort”, “type”:”KGType.Entity”}, “depth”:1, “link_names”:[]}’ \ 10.247.70.8:5000/objectsbysubj
Returns all typed entities in the object role that are reachable from the given subject within the specified depth. Link names can restrict the traversal.
curl -i -H “Content-Type: application/json” -X GET \ -d ‘{“token”: 2604251, “obj”:{“object”:”solution”, “type”:”KGType.Entity”}, “link_name”:””}’ \ 10.247.70.8:5000/objectsbyobjs
Returns subject entities for the given object.
curl -i -H “Content-Type: application/json” -X GET \ -d ‘{“token”: 2604251, “object”:{“object”:”bread bag”, “type”:”KGType.Entity”}}’ \ 10.247.70.8:5000/keyobjects
A key is the root of a subgraph, such as a product number from which all specifications depend. This endpoint returns all keys for a given object.
curl -i -H “Content-Type: application/json” -X GET \ -d ‘{“token”: 2604251, “number”:”t212″, “type”:”KGType.Text”}’ \ 10.247.70.8:5000/stmtortext
Returns the full text segment corresponding to the given number as a string.
curl -i -H “Content-Type: application/json” -X PUT \ -d ‘{“token”: 2604251, “persist_file”:”products_1000.pkl”}’ \ 10.247.70.8:5000/persistfile
Saves the Knowledge Graph according to the defined persistence.
curl -i -H “Content-Type: application/json” -X GET \ -d ‘{“token”: 2604251}’ \ 10.247.70.8:5000/printkg
Prints the Knowledge Graph as ASCII text and stores it in a container file. The filename is returned.
curl -i -H “Content-Type: application/json” -X GET \ -d ‘{“token”: 2604251, “kg_file_name”: “/home/kguser/data/ShowcaseKG.txt”, “max_length”:0, “start_point”:0}’ \ 10.247.70.8:5000/kgprintfile
Retrieves a print file in full or in parts.
curl -i -H “Content-Type: application/json” -X GET \ -d ‘{“token”: 2604251}’ \ 10.247.70.8:5000/kgstatistics
Generates a set of descriptive statistics for the Knowledge Graph.