-
Notifications
You must be signed in to change notification settings - Fork 0
Concepts
The internal model used is based on SHACL in JSON-LD format. An example:
[
{
"@id": "AddressShape",
"https://2019.summerofcode.be/unshacled#path": [
{
"@id": "http://example.org/ns#address"
}
],
"https://2019.summerofcode.be/unshacled#class": [
{
"@id": "http://example.org/ns#PostalAddress"
}
]
},
{
"@id": "http://example.org/ns#ClassExampleShape",
"@type": ["https://2019.summerofcode.be/unshacled#NodeShape"],
"https://2019.summerofcode.be/unshacled#property": [
{
"@id": "AddressShape"
}
],
"https://2019.summerofcode.be/unshacled#targetNode": [
{
"@id": "http://example.org/ns#Bob"
}
]
}
]
Existing shape files need to be translated to the internal model before use. This translation consists of two steps:
- Parse to JSON-LD: the internal model structure is based on SHACL in JSON-LD format.
- Translate SHACL specific terminology to interal terminology.
Classes responsible for parsing or serialization are in src/parsing
. Parsing can be done from various formats such as Turtle or N3 to a JSON-LD object via the parserManager
which is responsible for assigning a compatible parser. The same holds for the serializerManager
which allows to serialize from JSON-LD to other formats.
Replacing specific terminology with our own is the responsibility of the translatorManager
in src/translation
e.g. http://www.w3.org/ns/shacl#and
becomes https://2019.summerofcode.be/unshacled#and
.
Translate between internal uris and SHACL uris. TranslatorManager
is responsible for choosing the correct translator e.g. ShaclTranslator
translates from and to SHACL.
Responsible for translating URIs from SHACL or ShEx to URIs used in the model. Translation from and to SHACL uses the shaclTranslator
which in turn relies on the shaclDictionary
. The translatorManager
is responsible for assigning a translation job to the correct translator.
Note: makes use of traverse helper function
Validates RDF data using the shapes in the editor. SHACL data is validated by the shaclValidator
which produces a SHACL report. The validatorManager
assigns the correct validator to a job. Currently no unified reporting is supported (ShEx and SHACL produce different types of report). Adding such support should be done in the validatorManager
by introducing a translation step from SHACL/ShEx report to a unified report.
Contains helper functions used throughout the project.
- extensionToFormat
- Returns the corresponding media type for a file extension e.g. "ttl" to "text/turtle".
- languages
- Contains shape constraint languages such as SHACL and ShEx. Used to ensure no string mismatches happen.
- terminology
- Contains all existing terms. Classes and predicates such as NodeShape, properties, ...
Contains all the configuration objects. These are used to determine the colors, position, stroke... in konva figures.
- traverse(o, func, ...args)
- Helper function to traverse over an object and apply a function. Can be used to rename properties of an object or change values of certain properties.
Contains functions to determine possible options when adding new shapes or constraints.
- Vocabulary#isClass(uri)
- Returns whether uri is a class.
- Vocabulary#isPredicate(uri)
- Returns whether uri is a predicate.
- Vocabulary#isInDictionary(id)
- Returns whether id is a known term. Used to distinguish between model uris and external uris.
- Vocabulary#listType(predicate, state)
- Returns an array with possible values for @List of predicate
- Vocabulary#possiblePredicates(subject)
- Returns an array with possible predicates for a given subject.
- Vocabulary#possibleObjects(predicate)
- Returns an array with possible objects for a given predicate.
Questions? Anything unclear? Feel free to message me!