GraphDB Utils
GraphDB utils is an object data modelling tool.
Basics
When create a Model, each property requires specifying data type.
Available Types
| Type | Type in RDF | Example in JS | Example in RDF |
|---|---|---|---|
Types.NamedIndividual | owl:NamedIndividual | :primary_contact_1 | :primary_contact_1 |
Types.String or String | ^^xsd:string | "sample string" | "sample string" |
Types.Number or Number | ^^xsd:integer ^^xsd:decimal ^^xsd:double | 1 1.3 1.0e6 | 1 1.3 1.0e6 |
Types.Date or Date | ^^xsd:integer | Date.now() / new Date() | 1597676490573 |
Types.Boolean or Boolean | ^^xsd:boolean | true false | true false |
[String] (*see below) | ^^xsd:string | ["str1", "str2"] | "str1", "str2". |
Array Types
The above data types (Types.NamedIndividual, String, Number, ...) can be wrapped by [],
i.e. [String], [Number], which represents a list of String or Number.
SchemaOptions
| schemaOptions | type | description |
|---|---|---|
rdfTypes | string[] | The list of value in rdf:type. e.g. [Types.NamedIndividual, ":primary_contact"] => some_instance rdf:type owl:NamedIndividual, :primary_contact. |
name | string | The prefix of the created document, e.g. if name="primary_contact", the new created document will have id :primary_contact_1 |
Internal Key and External Key
By default, has_ is added to the front of the property name as an internal key for SPARQL.
External keys are usually same as the property name.
When creating the following model and create new instance / document / individual for that model:
The SPARQL query will be:
Note that name property renames to has_name in the SPARQL query.
In this case name is the external key, has_name is the internal key.
ATTENTION
We defined property hobby as an array of strings. The external key will is be hobbies because we defined
it that way, if we don't define the external key manually, the external key will be hobbys, an s is appended
to the property key for every array type.