Skip to main content

How to query the Knowledge Graph

The Marketplace API exposes SPARQL for exploring ingested business knowledge.

The Knowledge Graph contains the concepts, properties, and relationships supplied by Source Adapters. The Business Concept Map and Business Concept APIs interpret this graph through the active Business Concept Model, which defines the concept types, labels, and relationships to expose. SPARQL queries the same RDF data directly, including resources that the model does not expose as Business Concepts.

note

The examples in this section use the SKOS vocabulary (for instance skos:broader, skos:prefLabel, skos:definition) because it is a common and natural way to model business concepts.

However, the Knowledge Graph is not limited to SKOS: you may use any vocabulary expressed in RDF, including RDFS, OWL, or custom predicates.

SPARQL - Explore Concepts and Relationships​

SPARQL is the standard RDF query language.

It allows you to retrieve concepts, navigate hierarchies, inspect metadata, and discover relationships.

SPARQL queries may use prefixes for readability, and responses use the W3C SPARQL Results JSON format.

Send the query as the raw request body to the Marketplace endpoint:

POST /api/marketplace/v1/knowledge-graph/sparql
Content-Type: application/sparql-query
Accept: application/sparql-results+json

Authenticate requests by following the API Authentication guide. See the Marketplace SPARQL operation reference for request and response formats, examples, and error responses.

This operation requires a configured knowledge graph and ingested source data, but not an active Business Concept Model or an enabled Business Concept Map. A direct connection to KGM is not needed.

Example: Retrieve Narrower Concepts of "Vehicle"​

PREFIX skos: <http://www.w3.org/2004/02/skos/core#>

SELECT ?child ?label WHERE {
?child skos:broader <https://example.com/concepts/Vehicle> .
OPTIONAL { ?child skos:prefLabel ?label }
}
ORDER BY ?label

Example Response​

{
"head": { "vars": ["child", "label"] },
"results": {
"bindings": [
{
"child": { "type": "uri", "value": "https://example.com/concepts/Car" },
"label": { "type": "literal", "value": "Car" }
},
{
"child": {
"type": "uri",
"value": "https://example.com/concepts/Truck"
},
"label": { "type": "literal", "value": "Truck" }
}
]
}
}

Example: Retrieve the Definition of a Concept​

PREFIX skos: <http://www.w3.org/2004/02/skos/core#>

SELECT ?definition WHERE {
<https://example.com/concepts/LiquidityRisk> skos:definition ?definition .
}
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>

SELECT ?related ?label WHERE {
<https://example.com/concepts/Customer> skos:related ?related .
OPTIONAL { ?related skos:prefLabel ?label }
}

Querying Ingested Knowledge​

SPARQL queries operate on the RDF graph composed of ingested knowledge only, not live upstream sources.

Use SPARQL when you want:

  • a unified conceptual graph across multiple sources
  • predictable navigation across broader, narrower, and related concepts
  • consistent metadata retrieval (labels, definitions, groupings)

SPARQL Capabilities and Limitations​

For predictable queries over ingested data, use the capabilities below. Advanced SPARQL features can be limited by the underlying query engine.

Supported and Reliable​

  • PREFIX declarations
  • Basic graph patterns (?s ?p ?o)
  • Navigating explicit relationships defined in the RDF data
  • FILTER, OPTIONAL, ORDER BY, LIMIT, OFFSET
  • Retrieving literals (labels, definitions, descriptions, or any other literal properties)

Not Supported or Limited​

  • SPARQL Update (INSERT / DELETE)
  • Federated queries (SERVICE)
  • Complex or arbitrary-length property paths (for example using * or + operators)
  • Advanced or backend-dependent functions (certain date/time operations, complex numeric functions, or regex/internationalization-heavy string functions)
  • Deeply nested patterns or queries requiring full reasoning or inference (for example, OWL or RDFS entailment)