Skip to content

Knowledge Graph API (1)

A Knowledge Graph is a graph-based data model representation of knowledge within a domain. In other words, it contains nodes and edges that represent entities and the relationships between them. The API should then enable the creation, update, or query with regard to these graphs and their models.

Languages
Servers
Mock server

https://idp.cdq.com/_mock/apis/knowledge-graph-api/api-v1/

Production SOAP

https://api.corporate-data-league.ch/knowledge-graph-api/soap/v1/

Production

https://api.corporate-data-league.ch/knowledge-graph-api/

Concepts

Operations related to Concepts. A concept is a unit of knowledge that is created and managed within a model.

Operations

Concept history

Operations related to Concept history. A concept history is a record of changes made to a concept.

Operations

Imports

Operations related to Imports. An import is a process of bringing data from an external source into the system.

Operations

Knowledge Graphs

Operations related to Knowledge Graphs and their management. A Knowledge Graph is a graph-based data model

Operations

Models

Operations related to Models. A model is a collection of concepts and their relationships.

Operations

Query

Operations related to Query. A query is a request for information from a database.

Rules

Operations related to Rules. A rule is a statement that defines or constrains some aspect of the business.

Operations

Translation

Operations related to Translation. Translation is the communication of a source language text's meaning through an equivalent target language text.

Operations

Translate JSON

Request

The JSON data is translated into RDF structure based on the provided model.

Security
basicAuth
Path
knowledgeGraphIdintegerrequired

Used to identify Knowledge Graph and objects inside it.

Example: 1
modelIdintegerrequired

Used to identify model and objects inside it.

Example: 1
Headers
X-Credential-Usernamestringrequired

Username that is passed as header parameter with the name X-Credential-Username. The header can take a form of:

  • username (e.g. "johnjoe")
  • user id (e.g. "87b1bdb1-ba87-4522-b363-c5a0e6e917b3")
Example: 87b1bdb1-ba87-4522-b363-c5a0e6e917b3
Bodyapplication/jsonrequired
JsonRecordobject

JSON record to be translated.

curl -i -X POST \
  -u <username>:<password> \
  https://idp.cdq.com/_mock/apis/knowledge-graph-api/api-v1/knowledgegraphs/1/models/1/translate/json \
  -H 'Content-Type: application/json' \
  -H 'X-Credential-Username: 87b1bdb1-ba87-4522-b363-c5a0e6e917b3' \
  -d '{
    "summary": "Translate JSON data into RDF structure.",
    "value": "{ \"JsonRecord\": { \"data\": { \"record\": \"123\", \"EMail\": \"John.Doecdq.com\", \"FirstName\": \"John\", \"LastName\": \"Doe\" } } }\n"
  }'

Responses

OK

Bodyapplication/json
rdfRecordstring

RDF record.

Example: "\"?a a <http://cacac.com/Data/properties/property> ; \n <http://cacac.com/Property/Data/properties/property/url> ?data_properties_properties_property_url ;\n <http://cacac.com/Property/Has_json_path> /Data/properties/property ; \n<http://cacac.com/Property/Has_record_id> ?has_record_id . ?b a <http://cacac.com/Data> ; \n<http://cacac.com/Property/Data/EMail> ?data_EMail ; <http://cacac.com/Property/Data/FirstName> ?data_FirstName ; \n<http://cacac.com/Property/Data/LastName> ?data_LastName ; \n<http://cacac.com/Property/Data/properties> ?c ; \n<http://cacac.com/Property/Data/record> ?data_record ; \n<http://cacac.com/Property/Has_json_path> /Data ; \n<http://cacac.com/Property/Has_record_id> ?has_record_id . ?d a <http://cacac.com/Record> ; \n<http://cacac.com/Property/Data> ?b ; \n<http://cacac.com/Property/Has_record_id> ?has_record_id . ?c a <http://cacac.com/Data/properties> ;\n<http://cacac.com/Property/Data/properties/property> ?a ; \n<http://cacac.com/Property/Has_json_path> /Data/properties ; \n<http://cacac.com/Property/Has_record_id> ?has_record_id . \"\n"
allJsonPathsArray of strings

List of all JSON paths.

Example: ["/Data/properties/property"]
Response
application/json
{ "summary": "Successful translation of JSON into an RDF structure.", "value": "{ \"rdfRecord\": \"SELECT * WHERE { ?a a <http://cacac.com/Data> ; <http://cacac.com/Property/Data/EMail> ?data_EMail ; <http://cacac.com/Property/Data/FirstName> ?data_FirstName ; <http://cacac.com/Property/Data/LastName> ?data_LastName ; <http://cacac.com/Property/Data/record> ?data_record ; <http://cacac.com/Property/Has_json_path> /Data ; <http://cacac.com/Property/Has_record_id> ?has_record_id . ?b a <http://cacac.com/Record> ; <http://cacac.com/Property/Data> ?a ; <http://cacac.com/Property/Has_record_id> ?has_record_id . }\", \"allJsonPaths\": [ \"data/EMail\", \"data/FirstName\", \"data/LastName\", \"data/record\" ] }\n" }

List JSON Templates

Request

Get all JSON templates that are available for translation.

Security
basicAuth
Headers
X-Credential-Usernamestringrequired

Username that is passed as header parameter with the name X-Credential-Username. The header can take a form of:

  • username (e.g. "johnjoe")
  • user id (e.g. "87b1bdb1-ba87-4522-b363-c5a0e6e917b3")
Example: 87b1bdb1-ba87-4522-b363-c5a0e6e917b3
curl -i -X GET \
  -u <username>:<password> \
  https://idp.cdq.com/_mock/apis/knowledge-graph-api/api-v1/knowledgegraphs/templates \
  -H 'X-Credential-Username: 87b1bdb1-ba87-4522-b363-c5a0e6e917b3'

Responses

OK

Bodyapplication/json
templatesArray of objects

List of templates.

Response
application/json
{ "summary": "Successfully retrieved all JSON templates.", "value": "{\"templates\": [{\"MANDATORY_VALUE\": {\"Name\": \"Template for Mandatory Value of a field/variable\",\"URL\": \"https://cdq.com/templates/MandatoryValue\",\"TemplateOperations\": [{\"Key\": \"/Input\",\"Operation\": \"REPLACE\",\"Pattern\": \"#1 #2 $var\",\"Code\": \"OPTIONAL { #1 #2 $var . FILTER (str($var) != \\\"\\\") }\"},{\"Key\": \"!InOrder!\",\"Operation\": \"ADD\",\"Code\": \"FILTER(!BOUND($var))\"}]}}]}\n" }

Generate Sparql Query

Request

Generate Sparql Query from provided template and input.

Security
basicAuth
Headers
X-Credential-Usernamestringrequired

Username that is passed as header parameter with the name X-Credential-Username. The header can take a form of:

  • username (e.g. "johnjoe")
  • user id (e.g. "87b1bdb1-ba87-4522-b363-c5a0e6e917b3")
Example: 87b1bdb1-ba87-4522-b363-c5a0e6e917b3
Bodyapplication/jsonrequired
templateobjectrequired

Template for SPARQL generation.

sparqlQuerystringrequired

SPARQL query.

Example: "SELECT ?s ?p ?o WHERE { ?s ?p ?o }"
inputDataArray of stringsrequired

List of input data.

Example: ["data_LastName"]
curl -i -X POST \
  -u <username>:<password> \
  https://idp.cdq.com/_mock/apis/knowledge-graph-api/api-v1/knowledgegraphs/generate/sparql \
  -H 'Content-Type: application/json' \
  -H 'X-Credential-Username: 87b1bdb1-ba87-4522-b363-c5a0e6e917b3' \
  -d '{
    "summary": "Translate imported JSON data into RDF structure."
  }'

Responses

OK

Bodyapplication/json
sparqlQuerystring

SPARQL query.

Example: "SELECT ?s ?p ?o WHERE { ?s ?p ?o }"
Response
application/json
{ "summary": "Successful Sparql query generation based on the provided template and input" }

Validation Graph

Operations related to Validation Graphs. A Validation Graph is a graph-based data model representation of knowledge within a domain.

Operations

Values

Operations related to Values. A value is a piece of information that is stored in a database.

Operations