Source Code Panel

The Source Code panel displays the RDF statements related to the currently selected asset in Turtle or JSON-LD notation. Turtle is a compact and efficient format to exchange and edit RDF-based data and recommended to all users. JSON-LD may appeal to people with experience in JSON but is typically more verbose than Turtle.

Danger

This is an expert feature that should be used with care, and only by users who are familiar with Turtle and/or JSON-LD. It is possible to control which users are allowed to make edits through this panel on the Product Configuration Parameters Admin Page.

The Source Code Panel displays all triples that have the currently selected asset as its subject. However, it also recursively includes blank node structures (such as inner nodes of property shapes or OWL restrictions). If the selected asset is a class or node shape, it will also include all values of sh:property and their related triples. This means that you can use the Source Code Panel to make all changes related to a node shape and its properties in a single place.

If the asset has triples in an included asset collection or graph, then those triples will be displayed in a separate code block in the lower half of the panel. Only the locally stored triples are editable.

Hint

Users can potentially add triples that are not directly related to the main asset. This is both a blessing and a curse, but you can use this panel to quickly insert new triples that you have copied from elsewhere.

JSON-LD Contexts

By default JSON-LD rendering can be rather verbose and irregular. JSON-LD Contexts can be used to control details of the output, for example to make sure that certain properties are using short names instead of nested objects with an @id attribute. The JSON-LD @context used by the Source Code panel is generated by TopBraid itself, using some ADS scripts. By default, this algorithm will look at the property shapes in the ontologies, for example to determine whether all values of a property are of the same datatype. You can customize and override the generation of these contexts by creating your own instances of dash:JSONLDContextScript. In those scripts, specify for which classes it shall apply to. In the dash:js of the scripts, produce any @context object that you like. You can start by calling tbs.basicJSONLDContext() or tbs.defaultJSONLDContext and then add ontology-specific contexts.

Toolbar Buttons

  • Cancel is activated when you have unsaved changes.

  • Preview simulates the edits without actually applying them, allowing you to see the changes in a diff viewer and any constraint violations associated with the modified assets, using the Preview Dialog.

  • Save Changes applies the changes, replacing the triples that were originally displayed.

Settings

  • Use JSON-LD format instead of Turtle

    toggles between Turtle and JSON-LD.

  • Hide statements from included graphs

    makes sure that only the directly asserted “local” triples are shown.

See Also

Further Reading on TopBraid