Graph API

API for querying the OntoPop Graph Database.

Please note that the OntoPop backend open-source software project, which includes the event-driven data pipelines and APIs, is undergoing extensive redesign and refactoring as part of OntoPop Community 3.x in order to improve performance, security, extensibility and maintainability. As a result, the documentation on this page will be significantly updated. Please refer to the OntoPop Roadmap for further information.

OntoPop Community 2.x provides a basic Graph API that is detailed on this page. Based on your OntoPop implementation use-case, you may wish to expose the Gremlin API (either directly or indirectly via a Gremlin server or another type of proxy based on the security requirements of your project) of the underlying graph database engine (for example Azure Cosmos DB or JanusGraph) which may offer a richer set of features to satisfy your expected query patterns in the event that the current OntoPop Graph API does not.

1. Gremlin Query

The structure and format of the response bodies returned from the OntoPop Gremlin Query API endpoint are implementation-specific i.e. they are dependent upon the underlying graph database engine that has been deployed (e.g. JanusGraph, Azure Cosmos DB, TinkerGraph etc.). Different graph database vendors implement (either partially or fully) the Apache TinkerPop framework in different ways and support different serializers. Thus the response bodies in the examples below (which query a JanusGraph graph database cluster) do NOT represent a standard response schema. Please refer to the Get Graph endpoint in order to retrieve a standard and consistent response body schema representing an entire directed property graph model of a W3C Web Ontology Language (OWL) ontology.

Overview

Execute a Gremlin query against a W3C Web Ontology Language (OWL) ontology modelled as a directed property graph and managed by the OntoPop graph database.

HTTP request methodPOST
API endpoint/graph/ontologies/{id}/query/gremlin

Path Variables

NameDescriptionExample
id (integer)ID of the ontology to query.13

Request Body

PropertyDescriptionExample
gremlin (string) *Gremlin query (required)g.V().has('iri', 'http://webprotege.stanford.edu/R734t4iI6j8MPmpJsIqO2v4').valueMap()

Headers

KeyValueDescription
Content-Typeapplication/jsonSee request body above
X-API-KeyIssued API KeySee API Authentication for further details

Responses

HTTP StatusDescriptionResponse Schema
200 OKGremlin query successfully executed.Vendor-specific
401 UnauthorizedGremlin query request unauthorized.N/A
500 Internal Server ErrorInternal server error.N/A

Examples

Note that some graph database engines only support string-based IDs (such as Azure Cosmos DB). In this case, you should enclose any filtering vertex IDs or edge IDs in your Gremlin queries with single quotes.

1. Filter Vertices - Get vertex (class) by Vertex ID

Example request

{
    "gremlin": "g.V(897040)"
}

Response HTTP 200 OK

{
    "requestId": "a8ef2108-e447-4649-a9f2-5a3e96fb940f",
    "status": {
        "message": "",
        "code": 200,
        "attributes": {
            "@type": "g:Map",
            "@value": []
        }
    },
    "result": {
        "data": {
            "@type": "g:List",
            "@value": [
                {
                    "@type": "g:Vertex",
                    "@value": {
                        "id": {
                            "@type": "g:Int64",
                            "@value": 897040
                        },
                        "label": "class",
                        "properties": {
                            "iri": [
                                {
                                    "@type": "g:VertexProperty",
                                    "@value": {
                                        "id": {
                                            "@type": "janusgraph:RelationIdentifier",
                                            "@value": {
                                                "relationId": "qe4i-j85s-27t1"
                                            }
                                        },
                                        "value": "http://webprotege.stanford.edu/R734t4iI6j8MPmpJsIqO2v4",
                                        "label": "iri"
                                    }
                                }
                            ],
                            "latestWebhookEventId": [
                                {
                                    "@type": "g:VertexProperty",
                                    "@value": {
                                        "id": {
                                            "@type": "janusgraph:RelationIdentifier",
                                            "@value": {
                                                "relationId": "qewy-j85s-29dx"
                                            }
                                        },
                                        "value": {
                                            "@type": "g:Int64",
                                            "@value": 60
                                        },
                                        "label": "latestWebhookEventId"
                                    }
                                }
                            ],
                            "vertexId": [
                                {
                                    "@type": "g:VertexProperty",
                                    "@value": {
                                        "id": {
                                            "@type": "janusgraph:RelationIdentifier",
                                            "@value": {
                                                "relationId": "qfb6-j85s-2ayt"
                                            }
                                        },
                                        "value": {
                                            "@type": "g:Int64",
                                            "@value": 33752713048
                                        },
                                        "label": "vertexId"
                                    }
                                }
                            ],
                            "ontologyId": [
                                {
                                    "@type": "g:VertexProperty",
                                    "@value": {
                                        "id": {
                                            "@type": "janusgraph:RelationIdentifier",
                                            "@value": {
                                                "relationId": "qg3m-j85s-28lh"
                                            }
                                        },
                                        "value": {
                                            "@type": "g:Int32",
                                            "@value": 48
                                        },
                                        "label": "ontologyId"
                                    }
                                }
                            ],
                            "subdomain": [
                                {
                                    "@type": "g:VertexProperty",
                                    "@value": {
                                        "id": {
                                            "@type": "janusgraph:RelationIdentifier",
                                            "@value": {
                                                "relationId": "qfpe-j85s-4l51"
                                            }
                                        },
                                        "value": "Confirm",
                                        "label": "subdomain"
                                    }
                                }
                            ],
                            "vertexKey": [
                                {
                                    "@type": "g:VertexProperty",
                                    "@value": {
                                        "id": {
                                            "@type": "janusgraph:RelationIdentifier",
                                            "@value": {
                                                "relationId": "qgw2-j85s-2a6d"
                                            }
                                        },
                                        "value": "http://webprotege.stanford.edu/R734t4iI6j8MPmpJsIqO2v4_48",
                                        "label": "vertexKey"
                                    }
                                }
                            ],
                            "definition": [
                                {
                                    "@type": "g:VertexProperty",
                                    "@value": {
                                        "id": {
                                            "@type": "janusgraph:RelationIdentifier",
                                            "@value": {
                                                "relationId": "qghu-j85s-4flx"
                                            }
                                        },
                                        "value": "The action taken by an Entity to improve the Condition of, and remedy Defects present on, an Asset.",
                                        "label": "definition"
                                    }
                                }
                            ],
                            "dataSource": [
                                {
                                    "@type": "g:VertexProperty",
                                    "@value": {
                                        "id": {
                                            "@type": "janusgraph:RelationIdentifier",
                                            "@value": {
                                                "relationId": "qhaa-j85s-4ged"
                                            }
                                        },
                                        "value": "Confirm",
                                        "label": "dataSource"
                                    }
                                }
                            ],
                            "example": [
                                {
                                    "@type": "g:VertexProperty",
                                    "@value": {
                                        "id": {
                                            "@type": "janusgraph:RelationIdentifier",
                                            "@value": {
                                                "relationId": "qhoi-j85s-4kcl"
                                            }
                                        },
                                        "value": "Road Works",
                                        "label": "example"
                                    }
                                }
                            ]
                        }
                    }
                }
            ]
        },
        "meta": {
            "@type": "g:Map",
            "@value": []
        }
    }
}

2. Filter Vertices - Get vertex (class) by IRI

Example request

{
    "gremlin": "g.V().has('iri', 'http://webprotege.stanford.edu/R734t4iI6j8MPmpJsIqO2v4')"
}

Response HTTP 200 OK

{
    "requestId": "a8ef2108-e447-4649-a9f2-5a3e96fb940f",
    "status": {
        "message": "",
        "code": 200,
        "attributes": {
            "@type": "g:Map",
            "@value": []
        }
    },
    "result": {
        "data": {
            "@type": "g:List",
            "@value": [
                {
                    "@type": "g:Vertex",
                    "@value": {
                        "id": {
                            "@type": "g:Int64",
                            "@value": 897040
                        },
                        "label": "class",
                        "properties": {
                            "iri": [
                                {
                                    "@type": "g:VertexProperty",
                                    "@value": {
                                        "id": {
                                            "@type": "janusgraph:RelationIdentifier",
                                            "@value": {
                                                "relationId": "qe4i-j85s-27t1"
                                            }
                                        },
                                        "value": "http://webprotege.stanford.edu/R734t4iI6j8MPmpJsIqO2v4",
                                        "label": "iri"
                                    }
                                }
                            ],
                            "latestWebhookEventId": [
                                {
                                    "@type": "g:VertexProperty",
                                    "@value": {
                                        "id": {
                                            "@type": "janusgraph:RelationIdentifier",
                                            "@value": {
                                                "relationId": "qewy-j85s-29dx"
                                            }
                                        },
                                        "value": {
                                            "@type": "g:Int64",
                                            "@value": 60
                                        },
                                        "label": "latestWebhookEventId"
                                    }
                                }
                            ],
                            "vertexId": [
                                {
                                    "@type": "g:VertexProperty",
                                    "@value": {
                                        "id": {
                                            "@type": "janusgraph:RelationIdentifier",
                                            "@value": {
                                                "relationId": "qfb6-j85s-2ayt"
                                            }
                                        },
                                        "value": {
                                            "@type": "g:Int64",
                                            "@value": 33752713048
                                        },
                                        "label": "vertexId"
                                    }
                                }
                            ],
                            "ontologyId": [
                                {
                                    "@type": "g:VertexProperty",
                                    "@value": {
                                        "id": {
                                            "@type": "janusgraph:RelationIdentifier",
                                            "@value": {
                                                "relationId": "qg3m-j85s-28lh"
                                            }
                                        },
                                        "value": {
                                            "@type": "g:Int32",
                                            "@value": 48
                                        },
                                        "label": "ontologyId"
                                    }
                                }
                            ],
                            "subdomain": [
                                {
                                    "@type": "g:VertexProperty",
                                    "@value": {
                                        "id": {
                                            "@type": "janusgraph:RelationIdentifier",
                                            "@value": {
                                                "relationId": "qfpe-j85s-4l51"
                                            }
                                        },
                                        "value": "Confirm",
                                        "label": "subdomain"
                                    }
                                }
                            ],
                            "vertexKey": [
                                {
                                    "@type": "g:VertexProperty",
                                    "@value": {
                                        "id": {
                                            "@type": "janusgraph:RelationIdentifier",
                                            "@value": {
                                                "relationId": "qgw2-j85s-2a6d"
                                            }
                                        },
                                        "value": "http://webprotege.stanford.edu/R734t4iI6j8MPmpJsIqO2v4_48",
                                        "label": "vertexKey"
                                    }
                                }
                            ],
                            "definition": [
                                {
                                    "@type": "g:VertexProperty",
                                    "@value": {
                                        "id": {
                                            "@type": "janusgraph:RelationIdentifier",
                                            "@value": {
                                                "relationId": "qghu-j85s-4flx"
                                            }
                                        },
                                        "value": "The action taken by an Entity to improve the Condition of, and remedy Defects present on, an Asset.",
                                        "label": "definition"
                                    }
                                }
                            ],
                            "dataSource": [
                                {
                                    "@type": "g:VertexProperty",
                                    "@value": {
                                        "id": {
                                            "@type": "janusgraph:RelationIdentifier",
                                            "@value": {
                                                "relationId": "qhaa-j85s-4ged"
                                            }
                                        },
                                        "value": "Confirm",
                                        "label": "dataSource"
                                    }
                                }
                            ],
                            "example": [
                                {
                                    "@type": "g:VertexProperty",
                                    "@value": {
                                        "id": {
                                            "@type": "janusgraph:RelationIdentifier",
                                            "@value": {
                                                "relationId": "qhoi-j85s-4kcl"
                                            }
                                        },
                                        "value": "Road Works",
                                        "label": "example"
                                    }
                                }
                            ]
                        }
                    }
                }
            ]
        },
        "meta": {
            "@type": "g:Map",
            "@value": []
        }
    }
}

3. Filter Vertices - Get vertices (classes and their IRIs) by arbitrary properties

Example request

{
    "gremlin": "g.V().has('dataSource', within('Confirm', 'NTIS')).valueMap('iri')"
}

Response HTTP 200 OK

{
    "requestId": "abc8e3ec-c795-4f6c-a8ee-d889f14e55ce",
    "status": {
        "message": "",
        "code": 200,
        "attributes": {
            "@type": "g:Map",
            "@value": []
        }
    },
    "result": {
        "data": {
            "@type": "g:List",
            "@value": [
                {
                    "@type": "g:Map",
                    "@value": [
                        "iri",
                        {
                            "@type": "g:List",
                            "@value": [
                                "http://webprotege.stanford.edu/R734t4iI6j8MPmpJsIqO2v4"
                            ]
                        }
                    ]
                },
                {
                    "@type": "g:Map",
                    "@value": [
                        "iri",
                        {
                            "@type": "g:List",
                            "@value": [
                                "http://webprotege.stanford.edu/R7l0LqjYK03DLCUM5XgsbGk"
                            ]
                        }
                    ]
                },
                {
                    "@type": "g:Map",
                    "@value": [
                        "iri",
                        {
                            "@type": "g:List",
                            "@value": [
                                "http://webprotege.stanford.edu/RCnRceKsHZf8Gt9UvDjM6We"
                            ]
                        }
                    ]
                },

                ...

            ]
        },
        "meta": {
            "@type": "g:Map",
            "@value": []
        }
    }
}

4. Get Edges - Get vertex outgoing edges (class parents)

Example request

{
    "gremlin": "g.V().has('iri', 'http://webprotege.stanford.edu/R734t4iI6j8MPmpJsIqO2v4').outE()"
}

Response HTTP 200 OK

{
    "requestId": "2d8de32c-7582-4e62-b2a0-a84c5468df51",
    "status": {
        "message": "",
        "code": 200,
        "attributes": {
            "@type": "g:Map",
            "@value": []
        }
    },
    "result": {
        "data": {
            "@type": "g:List",
            "@value": [
                {
                    "@type": "g:Edge",
                    "@value": {
                        "id": {
                            "@type": "janusgraph:RelationIdentifier",
                            "@value": {
                                "relationId": "w35u-j85s-2fpx-a0bk"
                            }
                        },
                        "label": "subClassOf",
                        "inVLabel": "class",
                        "outVLabel": "class",
                        "inV": {
                            "@type": "g:Int64",
                            "@value": 466976
                        },
                        "outV": {
                            "@type": "g:Int64",
                            "@value": 897040
                        },
                        "properties": {
                            "relationship": {
                                "@type": "g:Property",
                                "@value": {
                                    "key": "relationship",
                                    "value": "Performed on"
                                }
                            },
                            "ontologyId": {
                                "@type": "g:Property",
                                "@value": {
                                    "key": "ontologyId",
                                    "value": {
                                        "@type": "g:Int32",
                                        "@value": 48
                                    }
                                }
                            },
                            "targetVertexKey": {
                                "@type": "g:Property",
                                "@value": {
                                    "key": "targetVertexKey",
                                    "value": "http://webprotege.stanford.edu/R9H3QGGtwC0XhV4Mfk6Ceep_48"
                                }
                            },
                            "sourceVertexKey": {
                                "@type": "g:Property",
                                "@value": {
                                    "key": "sourceVertexKey",
                                    "value": "http://webprotege.stanford.edu/R734t4iI6j8MPmpJsIqO2v4_48"
                                }
                            },
                            "sourceVertexId": {
                                "@type": "g:Property",
                                "@value": {
                                    "key": "sourceVertexId",
                                    "value": {
                                        "@type": "g:Int64",
                                        "@value": 33752713048
                                    }
                                }
                            },
                            "latestWebhookEventId": {
                                "@type": "g:Property",
                                "@value": {
                                    "key": "latestWebhookEventId",
                                    "value": {
                                        "@type": "g:Int64",
                                        "@value": 60
                                    }
                                }
                            },
                            "targetVertexId": {
                                "@type": "g:Property",
                                "@value": {
                                    "key": "targetVertexId",
                                    "value": {
                                        "@type": "g:Int64",
                                        "@value": 242612863048
                                    }
                                }
                            }
                        }
                    }
                },
                {
                    "@type": "g:Edge",
                    "@value": {
                        "id": {
                            "@type": "janusgraph:RelationIdentifier",
                            "@value": {
                                "relationId": "w2rm-j85s-2fpx-er4g"
                            }
                        },
                        "label": "subClassOf",
                        "inVLabel": "class",
                        "outVLabel": "class",
                        "inV": {
                            "@type": "g:Int64",
                            "@value": 688336
                        },
                        "outV": {
                            "@type": "g:Int64",
                            "@value": 897040
                        },
                        "properties": {
                            "sourceVertexId": {
                                "@type": "g:Property",
                                "@value": {
                                    "key": "sourceVertexId",
                                    "value": {
                                        "@type": "g:Int64",
                                        "@value": 33752713048
                                    }
                                }
                            },
                            "sourceVertexKey": {
                                "@type": "g:Property",
                                "@value": {
                                    "key": "sourceVertexKey",
                                    "value": "http://webprotege.stanford.edu/R734t4iI6j8MPmpJsIqO2v4_48"
                                }
                            },
                            "relationship": {
                                "@type": "g:Property",
                                "@value": {
                                    "key": "relationship",
                                    "value": "Performed by"
                                }
                            },
                            "ontologyId": {
                                "@type": "g:Property",
                                "@value": {
                                    "key": "ontologyId",
                                    "value": {
                                        "@type": "g:Int32",
                                        "@value": 48
                                    }
                                }
                            },
                            "targetVertexId": {
                                "@type": "g:Property",
                                "@value": {
                                    "key": "targetVertexId",
                                    "value": {
                                        "@type": "g:Int64",
                                        "@value": 2042871575048
                                    }
                                }
                            },
                            "targetVertexKey": {
                                "@type": "g:Property",
                                "@value": {
                                    "key": "targetVertexKey",
                                    "value": "http://webprotege.stanford.edu/R8QQzkUbCD5WRXDQQSl0vX8_48"
                                }
                            },
                            "latestWebhookEventId": {
                                "@type": "g:Property",
                                "@value": {
                                    "key": "latestWebhookEventId",
                                    "value": {
                                        "@type": "g:Int64",
                                        "@value": 60
                                    }
                                }
                            }
                        }
                    }
                },
                {
                    "@type": "g:Edge",
                    "@value": {
                        "id": {
                            "@type": "janusgraph:RelationIdentifier",
                            "@value": {
                                "relationId": "w2de-j85s-2fpx-iviw"
                            }
                        },
                        "label": "subClassOf",
                        "inVLabel": "class",
                        "outVLabel": "class",
                        "inV": {
                            "@type": "g:Int64",
                            "@value": 880664
                        },
                        "outV": {
                            "@type": "g:Int64",
                            "@value": 897040
                        },
                        "properties": {
                            "ontologyId": {
                                "@type": "g:Property",
                                "@value": {
                                    "key": "ontologyId",
                                    "value": {
                                        "@type": "g:Int32",
                                        "@value": 48
                                    }
                                }
                            },
                            "relationship": {
                                "@type": "g:Property",
                                "@value": {
                                    "key": "relationship",
                                    "value": "Affected by"
                                }
                            },
                            "sourceVertexKey": {
                                "@type": "g:Property",
                                "@value": {
                                    "key": "sourceVertexKey",
                                    "value": "http://webprotege.stanford.edu/R734t4iI6j8MPmpJsIqO2v4_48"
                                }
                            },
                            "latestWebhookEventId": {
                                "@type": "g:Property",
                                "@value": {
                                    "key": "latestWebhookEventId",
                                    "value": {
                                        "@type": "g:Int64",
                                        "@value": 60
                                    }
                                }
                            },
                            "targetVertexKey": {
                                "@type": "g:Property",
                                "@value": {
                                    "key": "targetVertexKey",
                                    "value": "http://webprotege.stanford.edu/R7OG9IJQRmrxb2LhojDfE46_48"
                                }
                            },
                            "targetVertexId": {
                                "@type": "g:Property",
                                "@value": {
                                    "key": "targetVertexId",
                                    "value": {
                                        "@type": "g:Int64",
                                        "@value": 1257106500048
                                    }
                                }
                            },
                            "sourceVertexId": {
                                "@type": "g:Property",
                                "@value": {
                                    "key": "sourceVertexId",
                                    "value": {
                                        "@type": "g:Int64",
                                        "@value": 33752713048
                                    }
                                }
                            }
                        }
                    }
                },

                ...

            ]
        },
        "meta": {
            "@type": "g:Map",
            "@value": []
        }
    }
}

5. Get Edges - Get vertex incoming edges (sub-classes of this parent class)

Example request

{
    "gremlin": "g.V().has('iri', 'http://webprotege.stanford.edu/R734t4iI6j8MPmpJsIqO2v4').inE()"
}

Response HTTP 200 OK

{
    "requestId": "b27b1c1e-a19e-4b80-96fe-290b7fba3a60",
    "status": {
        "message": "",
        "code": 200,
        "attributes": {
            "@type": "g:Map",
            "@value": []
        }
    },
    "result": {
        "data": {
            "@type": "g:List",
            "@value": [
                {
                    "@type": "g:Edge",
                    "@value": {
                        "id": {
                            "@type": "janusgraph:RelationIdentifier",
                            "@value": {
                                "relationId": "g4ck-9hcw-2fpx-j85s"
                            }
                        },
                        "label": "subClassOf",
                        "inVLabel": "class",
                        "outVLabel": "class",
                        "inV": {
                            "@type": "g:Int64",
                            "@value": 897040
                        },
                        "outV": {
                            "@type": "g:Int64",
                            "@value": 442400
                        },
                        "properties": {
                            "ontologyId": {
                                "@type": "g:Property",
                                "@value": {
                                    "key": "ontologyId",
                                    "value": {
                                        "@type": "g:Int32",
                                        "@value": 48
                                    }
                                }
                            },
                            "sourceVertexKey": {
                                "@type": "g:Property",
                                "@value": {
                                    "key": "sourceVertexKey",
                                    "value": "http://webprotege.stanford.edu/R89hr3L0oNOwO2C6z1V7rPS_48"
                                }
                            },
                            "targetVertexKey": {
                                "@type": "g:Property",
                                "@value": {
                                    "key": "targetVertexKey",
                                    "value": "http://webprotege.stanford.edu/R734t4iI6j8MPmpJsIqO2v4_48"
                                }
                            },
                            "relationship": {
                                "@type": "g:Property",
                                "@value": {
                                    "key": "relationship",
                                    "value": "Used in"
                                }
                            },
                            "latestWebhookEventId": {
                                "@type": "g:Property",
                                "@value": {
                                    "key": "latestWebhookEventId",
                                    "value": {
                                        "@type": "g:Int64",
                                        "@value": 60
                                    }
                                }
                            },
                            "sourceVertexId": {
                                "@type": "g:Property",
                                "@value": {
                                    "key": "sourceVertexId",
                                    "value": {
                                        "@type": "g:Int64",
                                        "@value": 1978975783048
                                    }
                                }
                            },
                            "targetVertexId": {
                                "@type": "g:Property",
                                "@value": {
                                    "key": "targetVertexId",
                                    "value": {
                                        "@type": "g:Int64",
                                        "@value": 33752713048
                                    }
                                }
                            }
                        }
                    }
                },
                {
                    "@type": "g:Edge",
                    "@value": {
                        "id": {
                            "@type": "janusgraph:RelationIdentifier",
                            "@value": {
                                "relationId": "pmhm-gy4w-2fpx-j85s"
                            }
                        },
                        "label": "subClassOf",
                        "inVLabel": "class",
                        "outVLabel": "class",
                        "inV": {
                            "@type": "g:Int64",
                            "@value": 897040
                        },
                        "outV": {
                            "@type": "g:Int64",
                            "@value": 790736
                        },
                        "properties": {
                            "sourceVertexKey": {
                                "@type": "g:Property",
                                "@value": {
                                    "key": "sourceVertexKey",
                                    "value": "http://webprotege.stanford.edu/RDJpPq1h6rGjSoshUKgfI92_48"
                                }
                            },
                            "latestWebhookEventId": {
                                "@type": "g:Property",
                                "@value": {
                                    "key": "latestWebhookEventId",
                                    "value": {
                                        "@type": "g:Int64",
                                        "@value": 60
                                    }
                                }
                            },
                            "relationship": {
                                "@type": "g:Property",
                                "@value": {
                                    "key": "relationship",
                                    "value": "Used in"
                                }
                            },
                            "targetVertexKey": {
                                "@type": "g:Property",
                                "@value": {
                                    "key": "targetVertexKey",
                                    "value": "http://webprotege.stanford.edu/R734t4iI6j8MPmpJsIqO2v4_48"
                                }
                            },
                            "sourceVertexId": {
                                "@type": "g:Property",
                                "@value": {
                                    "key": "sourceVertexId",
                                    "value": {
                                        "@type": "g:Int64",
                                        "@value": 1660895008048
                                    }
                                }
                            },
                            "ontologyId": {
                                "@type": "g:Property",
                                "@value": {
                                    "key": "ontologyId",
                                    "value": {
                                        "@type": "g:Int32",
                                        "@value": 48
                                    }
                                }
                            },
                            "targetVertexId": {
                                "@type": "g:Property",
                                "@value": {
                                    "key": "targetVertexId",
                                    "value": {
                                        "@type": "g:Int64",
                                        "@value": 33752713048
                                    }
                                }
                            }
                        }
                    }
                },
                {
                    "@type": "g:Edge",
                    "@value": {
                        "id": {
                            "@type": "janusgraph:RelationIdentifier",
                            "@value": {
                                "relationId": "wc8z-kw7s-2fpx-j85s"
                            }
                        },
                        "label": "subClassOf",
                        "inVLabel": "class",
                        "outVLabel": "class",
                        "inV": {
                            "@type": "g:Int64",
                            "@value": 897040
                        },
                        "outV": {
                            "@type": "g:Int64",
                            "@value": 974872
                        },
                        "properties": {
                            "relationship": {
                                "@type": "g:Property",
                                "@value": {
                                    "key": "relationship",
                                    "value": "Improved through"
                                }
                            },
                            "latestWebhookEventId": {
                                "@type": "g:Property",
                                "@value": {
                                    "key": "latestWebhookEventId",
                                    "value": {
                                        "@type": "g:Int64",
                                        "@value": 60
                                    }
                                }
                            },
                            "ontologyId": {
                                "@type": "g:Property",
                                "@value": {
                                    "key": "ontologyId",
                                    "value": {
                                        "@type": "g:Int32",
                                        "@value": 48
                                    }
                                }
                            },
                            "targetVertexId": {
                                "@type": "g:Property",
                                "@value": {
                                    "key": "targetVertexId",
                                    "value": {
                                        "@type": "g:Int64",
                                        "@value": 33752713048
                                    }
                                }
                            },
                            "sourceVertexKey": {
                                "@type": "g:Property",
                                "@value": {
                                    "key": "sourceVertexKey",
                                    "value": "http://webprotege.stanford.edu/RBNRwyHYDJAexW4IAn1ebkS_48"
                                }
                            },
                            "targetVertexKey": {
                                "@type": "g:Property",
                                "@value": {
                                    "key": "targetVertexKey",
                                    "value": "http://webprotege.stanford.edu/R734t4iI6j8MPmpJsIqO2v4_48"
                                }
                            },
                            "sourceVertexId": {
                                "@type": "g:Property",
                                "@value": {
                                    "key": "sourceVertexId",
                                    "value": {
                                        "@type": "g:Int64",
                                        "@value": 195852279048
                                    }
                                }
                            }
                        }
                    }
                },

                ...

             ]
        },
        "meta": {
            "@type": "g:Map",
            "@value": []
        }
    }
} 

6. Get Edges - Get all vertex edges (incoming and outgoing)

Example request

{
    "gremlin": "g.V().has('iri', 'http://webprotege.stanford.edu/R734t4iI6j8MPmpJsIqO2v4').bothE()"
}

Response HTTP 200 OK

{
    "requestId": "c52c020c-e2b0-4dae-8447-072ae771bbea",
    "status": {
        "message": "",
        "code": 200,
        "attributes": {
            "@type": "g:Map",
            "@value": []
        }
    },
    "result": {
        "data": {
            "@type": "g:List",
            "@value": [
                {
                    "@type": "g:Edge",
                    "@value": {
                        "id": {
                            "@type": "janusgraph:RelationIdentifier",
                            "@value": {
                                "relationId": "w35u-j85s-2fpx-a0bk"
                            }
                        },
                        "label": "subClassOf",
                        "inVLabel": "class",
                        "outVLabel": "class",
                        "inV": {
                            "@type": "g:Int64",
                            "@value": 466976
                        },
                        "outV": {
                            "@type": "g:Int64",
                            "@value": 897040
                        },
                        "properties": {
                            "latestWebhookEventId": {
                                "@type": "g:Property",
                                "@value": {
                                    "key": "latestWebhookEventId",
                                    "value": {
                                        "@type": "g:Int64",
                                        "@value": 60
                                    }
                                }
                            },
                            "sourceVertexId": {
                                "@type": "g:Property",
                                "@value": {
                                    "key": "sourceVertexId",
                                    "value": {
                                        "@type": "g:Int64",
                                        "@value": 33752713048
                                    }
                                }
                            },
                            "ontologyId": {
                                "@type": "g:Property",
                                "@value": {
                                    "key": "ontologyId",
                                    "value": {
                                        "@type": "g:Int32",
                                        "@value": 48
                                    }
                                }
                            },
                            "targetVertexKey": {
                                "@type": "g:Property",
                                "@value": {
                                    "key": "targetVertexKey",
                                    "value": "http://webprotege.stanford.edu/R9H3QGGtwC0XhV4Mfk6Ceep_48"
                                }
                            },
                            "sourceVertexKey": {
                                "@type": "g:Property",
                                "@value": {
                                    "key": "sourceVertexKey",
                                    "value": "http://webprotege.stanford.edu/R734t4iI6j8MPmpJsIqO2v4_48"
                                }
                            },
                            "targetVertexId": {
                                "@type": "g:Property",
                                "@value": {
                                    "key": "targetVertexId",
                                    "value": {
                                        "@type": "g:Int64",
                                        "@value": 242612863048
                                    }
                                }
                            },
                            "relationship": {
                                "@type": "g:Property",
                                "@value": {
                                    "key": "relationship",
                                    "value": "Performed on"
                                }
                            }
                        }
                    }
                },
                {
                    "@type": "g:Edge",
                    "@value": {
                        "id": {
                            "@type": "janusgraph:RelationIdentifier",
                            "@value": {
                                "relationId": "w2rm-j85s-2fpx-er4g"
                            }
                        },
                        "label": "subClassOf",
                        "inVLabel": "class",
                        "outVLabel": "class",
                        "inV": {
                            "@type": "g:Int64",
                            "@value": 688336
                        },
                        "outV": {
                            "@type": "g:Int64",
                            "@value": 897040
                        },
                        "properties": {
                            "ontologyId": {
                                "@type": "g:Property",
                                "@value": {
                                    "key": "ontologyId",
                                    "value": {
                                        "@type": "g:Int32",
                                        "@value": 48
                                    }
                                }
                            },
                            "sourceVertexKey": {
                                "@type": "g:Property",
                                "@value": {
                                    "key": "sourceVertexKey",
                                    "value": "http://webprotege.stanford.edu/R734t4iI6j8MPmpJsIqO2v4_48"
                                }
                            },
                            "latestWebhookEventId": {
                                "@type": "g:Property",
                                "@value": {
                                    "key": "latestWebhookEventId",
                                    "value": {
                                        "@type": "g:Int64",
                                        "@value": 60
                                    }
                                }
                            },
                            "sourceVertexId": {
                                "@type": "g:Property",
                                "@value": {
                                    "key": "sourceVertexId",
                                    "value": {
                                        "@type": "g:Int64",
                                        "@value": 33752713048
                                    }
                                }
                            },
                            "targetVertexKey": {
                                "@type": "g:Property",
                                "@value": {
                                    "key": "targetVertexKey",
                                    "value": "http://webprotege.stanford.edu/R8QQzkUbCD5WRXDQQSl0vX8_48"
                                }
                            },
                            "relationship": {
                                "@type": "g:Property",
                                "@value": {
                                    "key": "relationship",
                                    "value": "Performed by"
                                }
                            },
                            "targetVertexId": {
                                "@type": "g:Property",
                                "@value": {
                                    "key": "targetVertexId",
                                    "value": {
                                        "@type": "g:Int64",
                                        "@value": 2042871575048
                                    }
                                }
                            }
                        }
                    }
                },
                {
                    "@type": "g:Edge",
                    "@value": {
                        "id": {
                            "@type": "janusgraph:RelationIdentifier",
                            "@value": {
                                "relationId": "w2de-j85s-2fpx-iviw"
                            }
                        },
                        "label": "subClassOf",
                        "inVLabel": "class",
                        "outVLabel": "class",
                        "inV": {
                            "@type": "g:Int64",
                            "@value": 880664
                        },
                        "outV": {
                            "@type": "g:Int64",
                            "@value": 897040
                        },
                        "properties": {
                            "sourceVertexKey": {
                                "@type": "g:Property",
                                "@value": {
                                    "key": "sourceVertexKey",
                                    "value": "http://webprotege.stanford.edu/R734t4iI6j8MPmpJsIqO2v4_48"
                                }
                            },
                            "latestWebhookEventId": {
                                "@type": "g:Property",
                                "@value": {
                                    "key": "latestWebhookEventId",
                                    "value": {
                                        "@type": "g:Int64",
                                        "@value": 60
                                    }
                                }
                            },
                            "sourceVertexId": {
                                "@type": "g:Property",
                                "@value": {
                                    "key": "sourceVertexId",
                                    "value": {
                                        "@type": "g:Int64",
                                        "@value": 33752713048
                                    }
                                }
                            },
                            "relationship": {
                                "@type": "g:Property",
                                "@value": {
                                    "key": "relationship",
                                    "value": "Affected by"
                                }
                            },
                            "targetVertexKey": {
                                "@type": "g:Property",
                                "@value": {
                                    "key": "targetVertexKey",
                                    "value": "http://webprotege.stanford.edu/R7OG9IJQRmrxb2LhojDfE46_48"
                                }
                            },
                            "ontologyId": {
                                "@type": "g:Property",
                                "@value": {
                                    "key": "ontologyId",
                                    "value": {
                                        "@type": "g:Int32",
                                        "@value": 48
                                    }
                                }
                            },
                            "targetVertexId": {
                                "@type": "g:Property",
                                "@value": {
                                    "key": "targetVertexId",
                                    "value": {
                                        "@type": "g:Int64",
                                        "@value": 1257106500048
                                    }
                                }
                            }
                        }
                    }
                },

                ...

                ]
        },
        "meta": {
            "@type": "g:Map",
            "@value": []
        }
    }
}

7. Shortest Path - Get the shortest path between two vertices (classes)

Example request

{
    "gremlin": "g.V(897040).repeat(out().simplePath()).until(hasId(1032216)).path().limit(1)"
}

Response HTTP 200 OK

{
    "requestId": "d088a014-0c6d-479f-8d55-0b3dfad12d7b",
    "status": {
        "message": "",
        "code": 200,
        "attributes": {
            "@type": "g:Map",
            "@value": []
        }
    },
    "result": {
        "data": {
            "@type": "g:List",
            "@value": [
                {
                    "@type": "g:Path",
                    "@value": {
                        "objects": {
                            "@type": "g:List",
                            "@value": [
                                {
                                    "@type": "g:Vertex",
                                    "@value": {
                                        "id": {
                                            "@type": "g:Int64",
                                            "@value": 897040
                                        },
                                        "label": "class"
                                    }
                                },
                                {
                                    "@type": "g:Vertex",
                                    "@value": {
                                        "id": {
                                            "@type": "g:Int64",
                                            "@value": 466976
                                        },
                                        "label": "class"
                                    }
                                },
                                {
                                    "@type": "g:Vertex",
                                    "@value": {
                                        "id": {
                                            "@type": "g:Int64",
                                            "@value": 1024024
                                        },
                                        "label": "class"
                                    }
                                },
                                {
                                    "@type": "g:Vertex",
                                    "@value": {
                                        "id": {
                                            "@type": "g:Int64",
                                            "@value": 1032216
                                        },
                                        "label": "class"
                                    }
                                }
                            ]
                        }
                    }
                }
            ]
        },
        "meta": {
            "@type": "g:Map",
            "@value": []
        }
    }
}

8. Shortest Path - Get the length of the shortest path between two vertices (classes)

Example request

{
    "gremlin": "g.V(897040).repeat(out().simplePath()).until(hasId(1032216)).path().count(local).limit(1)"
}

Response HTTP 200 OK

{
    "requestId": "bf510ec1-2981-48e4-8133-b77985beed02",
    "status": {
        "message": "",
        "code": 200,
        "attributes": {
            "@type": "g:Map",
            "@value": []
        }
    },
    "result": {
        "data": {
            "@type": "g:List",
            "@value": [
                {
                    "@type": "g:Int64",
                    "@value": 4
                }
            ]
        },
        "meta": {
            "@type": "g:Map",
            "@value": []
        }
    }
}

For further Gremlin query traversal examples, please visit Gremlin Recipes. And for further extensive details on the Apache TinkerPop framework, including all possible Gremlin graph traversal steps, please visit the Apache TinkerPop reference documentation.

2. Get Graph

Overview

Get the contents of an entire W3C Web Ontology Language (OWL) ontology modelled as a directed property graph, and respond with a standard and consistent response body schema.

HTTP request methodGET
API endpoint/graph/ontologies/{id}

Path Variables

NameDescriptionExample
id (integer)ID of the ontology to retrieve as a property graph.13

Request Parameters

NameDescriptionExample
gitWebhookId (long)Optional ID of a specific Git webhook in order to retrieve the contents of the property graph at that historical point in time. If this request parameter is not provided, then the contents of the latest property graph will be retrieved (optional). 98

Request Body

Not applicable

Headers

KeyValueDescription
X-API-KeyIssued API KeySee API Authentication for further details

Responses

Note that whilst an entire graph (or subgraph) may be retrieved using a Gremlin query, the aim of this endpoint is to provide a standard and consistent response body schema which is independent of the underlying graph database implementation. As such, this endpoint will always respond with a SimpleOntologyPropertyGraph object.

HTTP StatusDescriptionResponse Schema
200 OKProperty graph successfully retrieved.SimpleOntologyPropertyGraph.class
401 UnauthorizedRetrieval of property graph unauthorized.N/A
500 Internal Server ErrorInternal server error.N/A

Examples

Directed Property Graph Model

Example Response (HTTP 200 OK)

{
    "id": 83,
    "latestGitWebhookId": 95,
    "vertices": {
        "http://webprotege.stanford.edu/R0hGCuAkhsiBUbd7pftEpN_83": {
            "iri": "http://webprotege.stanford.edu/R0hGCuAkhsiBUbd7pftEpN",
            "ontologyId": 83,
            "vertexKey": "http://webprotege.stanford.edu/R0hGCuAkhsiBUbd7pftEpN_83",
            "vertexId": 774014706083,
            "latestGitWebhookId": 95,
            "properties": {
                "definition": "A request made by a Customer or their legal representative for their personal information under data protection legislation.",
                "dataSource": "FFC",
                "label": "Data Subject Request"
            },
            "dateLastUpdated": "2022-02-17 14:33:53"
        },
        "http://webprotege.stanford.edu/R0jI731hv09ZcJeji1fbtY_83": {
            "iri": "http://webprotege.stanford.edu/R0jI731hv09ZcJeji1fbtY",
            "ontologyId": 83,
            "vertexKey": "http://webprotege.stanford.edu/R0jI731hv09ZcJeji1fbtY_83",
            "vertexId": 8514896083,
            "latestGitWebhookId": 95,
            "properties": {
                "businessArea": "Communications",
                "definition": "Document storing the information conveyed between two or more parties.",
                "label": "Communication Document",
                "comment": "A communication will typically have the Licence Holder (Highways England) as one of the parties."
            },
            "dateLastUpdated": "2022-02-17 14:33:53"
        },
        "http://webprotege.stanford.edu/R0qk59fxFmgNbyUncZoU8M_83": {
            "iri": "http://webprotege.stanford.edu/R0qk59fxFmgNbyUncZoU8M",
            "ontologyId": 83,
            "vertexKey": "http://webprotege.stanford.edu/R0qk59fxFmgNbyUncZoU8M_83",
            "vertexId": 797576050083,
            "latestGitWebhookId": 95,
            "properties": {
                "comment": "A strategic goal that is achieved through a number of projects.",
                "label": "Programme",
                "example": "Develop connectivity between London and Inverness.",
                "definition": "A collection of projects or tasks undertaken to realise a strategic goal.",
                "businessArea": "Maintain Plan"
            },
            "dateLastUpdated": "2022-02-17 14:33:53"
        }

        ...

    },
    "edges": [
        {
            "sourceVertexKey": "http://webprotege.stanford.edu/R0hGCuAkhsiBUbd7pftEpN_83",
            "sourceVertexId": 774014706083,
            "targetVertexKey": "http://webprotege.stanford.edu/R0jI731hv09ZcJeji1fbtY_83",
            "targetVertexId": 8514896083,
            "ontologyId": 83,
            "latestGitWebhookId": 95,
            "properties": {},
            "dateLastUpdated": "2022-02-17 14:33:54"
        },
        {
            "sourceVertexKey": "http://webprotege.stanford.edu/R0hGCuAkhsiBUbd7pftEpN_83",
            "sourceVertexId": 774014706083,
            "targetVertexKey": "http://webprotege.stanford.edu/RBJ3sWyEdjzo3HjkcABim8C_83",
            "targetVertexId": 1599284725083,
            "ontologyId": 83,
            "latestGitWebhookId": 95,
            "properties": {
                "relationship": "Provided by"
            },
            "dateLastUpdated": "2022-02-17 14:33:54"
        },
        {
            "sourceVertexKey": "http://webprotege.stanford.edu/R0jI731hv09ZcJeji1fbtY_83",
            "sourceVertexId": 8514896083,
            "targetVertexKey": "http://webprotege.stanford.edu/RY4x5rU5jNH9YIcM63gBgJ_83",
            "targetVertexId": 192641538083,
            "ontologyId": 83,
            "latestGitWebhookId": 95,
            "properties": {
                "relationship": "Provided to"
            },
            "dateLastUpdated": "2022-02-17 14:33:54"
        }

        ...

    ]
}