ldh-AddView
Creates a LinkedDataHub view resource from an existing SPARQL SELECT query so you can display selected resources in a chosen layout like list, table, grid, map, graph, read, or chart.
Instructions
Writes a view of SPARQL SELECT query results to a LinkedDataHub document. The view is a resource the document holds, not one of its content blocks: to show it in the content mode, place it with ldh-AddObjectBlock, the view's URI as its value - so give the view a fragment identifier.
A view shows resources - things, people, places, documents - each as itself: its label, its image,
its links. LinkedDataHub DESCRIBEs the resources the query's first projected variable binds and renders
those descriptions in the view's mode, so that variable must bind resources (SELECT ?thing WHERE { ... }).
One that binds values - a name, a price, a computed total - describes nothing. To show values or
aggregates (totals, counts, sums by month), use ldh-AddResultSetChart instead.
A list of resources is a view even when what matters about them lives on related resources - a thing's
shop and price on the order it came from, a message's sender on a person. Do not join those values into
one table to show them beside each resource: select the resources, and let each one's own page show
what it links to. Put values that summarise the related resources (spend per shop) in a chart beside it.
This tool:
- Creates an ldh:View resource linked to an existing sp:Select query resource
- Configures optional display mode for the view
- Posts the new view resource to the target document
- Supports optional title, description, fragment identifier, and display mode
Pick the mode by what the resources carry:
- https://w3id.org/atomgraph/client#GridMode: a card per resource, led by its image. The fit for resources
that have one (foaf:img, foaf:depiction, foaf:logo, schema:image, schema:logo, schema:thumbnailUrl):
products, possessions, people, organizations
- https://w3id.org/atomgraph/client#MapMode: a pin per resource that has geo:lat and geo:long. The fit for
places, addresses, venues, shops
- https://w3id.org/atomgraph/client#GraphMode: the resources and the links between them, as a network. The
fit for showing how things connect (who owns what, what came from where)
- https://w3id.org/atomgraph/client#ListMode: a labelled list; the default, for resources with no image or
coordinates
- https://w3id.org/atomgraph/client#TableMode: a row per resource, a column per property, for comparing
many resources property by property
- https://w3id.org/atomgraph/client#ReadMode: each resource's full description, for a few resources
- https://w3id.org/atomgraph/client#ChartMode: the resources' properties charted
Note: The query parameter must be a URI of an existing sp:Select resource, not a SPARQL query string.Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"url": "<url>",
"query": "<query>",
"title": "<title>"
},
"name": "ldh-AddView"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | The URI of the document to write the view to. | |
| mode | No | Optional URI of the layout the view shows its results in (a view mode, not an object block's mode). Defaults to ListMode. Pick it by what the resources carry: GridMode for resources with an image, MapMode for ones with coordinates, GraphMode for how they link (see the tool description). | |
| query | Yes | URI of an existing sp:Select query resource to visualize (not a SPARQL query string). | |
| title | Yes | Title of the view. | |
| fragment | No | Optional fragment identifier for the view URI (e.g., 'my-view' creates #my-view). | |
| description | No | Optional description of the view. | |
| show_when_empty | No | Optional: whether the view is shown when its query returns no results (ldh:showWhenEmpty). LinkedDataHub shows it unless this is false. |