owl:Restriction in WOQL.js?

OWL allows for property restrictions in schemas. For example, the OWL wines example allows to specify that each wine has exactly one manufacturer, which must be an instance of the Winery class.

Is it possible to implement similar restrictions in WOQL.js? I tried searching for “restriction” in the documentation, on the forum, and in Discord, but couldn’t find anything.


Hi Aram,

Yes, TerminusDB supports OWL Restrictions in the schema - you can add them either with OWL or WOQL - in WOQL it looks something like this:

WOQL.add_quad("scm:R", "type", "owl:Restriction", "schema/main")
    .add_quad("scm:R", "owl:onProperty", "scm:myProperty", "schema/main")
    .add_quad("scm:R", "owl:minCardinality", literal(1, "xsd:nonNegativeInteger", "schema/main")
    .add_quad("scm:MyClass", "subClassOf", "scm:R", "schema/main")

(adds the restriction to scm:myProperty when the domain is scm:MyClass)

1 Like