Resolve
RDF Terms
Data based on @zazuko/vocabularies
Defined by
DASH Data Shapes Vocabulary
Click to Copy
dash:JSONTableViewer
Click to Copy
http://datashapes.org/dash#JSONTableViewer
Namespace
Recommended prefix
Copy 'PREFIX dash: <http://datashapes.org/dash#>'
lang:""
JSON table viewer
lang:""
A tabular viewer for rdf:JSON literals with a lexical form in the following format:
{
vars: [ 'col1', 'col2' ], // These are the column keys
headerLabels: [ 'Column 1', 'Column 2' ], // Optional, for the column headers
bindings: [ // These become the rows
{
col1: {
lex: 'Value2',
datatype: '...#string',
},
col2: {
uri: 'http://.../Instance',
label: 'Example Instance',
},
},
...
],
}
The resulting table will use the headerLabels (if they exist) as column headers, otherwise derive the headers from the variable names. The vars must match the fields in the bindings. The table will contain one row for each binding.
Using Active Data Shapes, you can construct such literals dynamically using a sh:values rule, e.g.
ex:MyClass-myProperty
a sh:PropertyShape ;
sh:path ex:myProperty ;
sh:values [
dash:js """
DataViewers.createTableViewerJSON(focusNode.select(`
SELECT ?col1 ?col2
WHERE {
$this ex:prop1 ?col1 .
$this ex:prop2 ?col2 .
}
`))"""
] .
You may also produce the JSON literal programmatically in JavaScript, or assert the triples by other means.