Skip to main content

Resource view

Views that make up the pages of spaces, people and resources: kinds, queries, placement, versions, and making one.

What a view is​

A view is a block on a page — a table, a list, a text, a diagram — filled from a query over the network. The pages of spaces, people and maintained resources are made almost entirely of views: the member list, the messages, the vocabulary's classes, this documentation's paragraphs are each one view showing the results of one query for the page's resource.

A view is a nanopublication. It names the query, says how to show the results, which kinds of page it belongs on, where on the page it goes, and which buttons it offers. Defining a new view needs no programming: a query plus a view nanopublication is a new kind of page section.

Nanopublication · Open in Nanodash

Types of view​

The view type decides how rows are shown. A tabular view is a table with one column per result variable. A list shows one linked item per row, run together on a line; an item list shows them one below the other. A plain paragraph view shows each row as a heading and a block of text. A nanopublication set view shows each row's nanopublication in full, and none of the other columns. An SVG view shows one diagram per row, drawn by the query itself, and a network view draws each row as a link between two nodes, in a diagram that can be rearranged and clicked through (Nanodash 5.20 and later). A header view has no query and no rows: it is just a section heading with optional actions.

Separately from its type, a view can be made a query form: the page then shows a form for those query parameters that the page does not fill itself, and the results open on a page of their own, laid out according to the view's type.

Every view keeps the type gen:ResourceView alongside its specific one; that is the type everything else looks for.

Nanopublication · Open in Nanodash

The query behind a view​

A view names a published query template and the parameter it fills with the page's resource, usually resource. When the page opens, the query runs with that value, and the rows become the view's content. Result columns holding a URI are shown as links, with a companion label column giving the link text; a np column at the end links each row to its source nanopublication.

The same query can back several views, and a view can be re-pointed at a newer query by publishing a new version of the view. Query references are exact, so improving a query means updating the views that use it.

Nanopublication · Open in Nanodash

Where a view belongs​

A view declares which kinds of page it is for: spaces, people, maintained resources — any combination. A view for the pages of parts of a resource, such as the terms of a vocabulary or the paragraphs of a documentation, instead names the class of those parts, or the namespace their URIs fall under.

Declaring where a view belongs does not put it on any page yet. That is done by a display, which attaches a view to one particular resource, or by a preset, which attaches a bundle of views to every resource of a type.

Nanopublication · Open in Nanodash

Position, width and size​

Views are laid out in sections down the page, and within a section from left to right. A view's position is a short code such as 4.2.members: the first digit is the section, the second orders views within it, and the rest is a name for readability. Sections 3 to 7 are in use, from an introduction section at the top to a closing one at the bottom; the default is 5.5.default.

A view may take the full width or a fraction of it, given in twelfths, so two half-width views sit side by side. Long results are paged; the page size is the view's to set. A display can override all three for one resource.

Nanopublication · Open in Nanodash

Versions of a view​

A view and its versions are two different things. The view is a URI that stays the same across versions; each view version names it with dct:isVersionOf and holds the query, the type and the actions. Views made since late October 2026 call the two …/my-view and …/viewVersion; older ones call the view …/my-view-kind and the version …/my-view, which works just as well.

A display or a preset names a view version — the node its view nanopublication embeds — and Nanodash moves on from there to the newest version. Naming the view itself instead does not work: the view simply does not appear. A view can additionally be governed by a space that lists it as a maintained resource; then the newest version published by any member of that space is current, so a community can keep its shared views up to date without depending on one person's key.

Two people publishing a new version of the same ungoverned view independently produce a fork, which pages resolve by keeping the version they had. It is repaired by one version superseding both.

Nanopublication · Open in Nanodash

Making a view​

A view is made with the "Declaring a resource view" form: pick the type, the query and its parameter, the page types, a title with a leading emoji as its icon, a position, and any actions. Test the query first with the page's resource as the parameter, since a view is only as good as its query.

The form also takes an optional description, shown under the view's title wherever it is displayed. Most views need none, since the title and column headings already say what they show; keep it for a view whose purpose is not evident, and then to one line.

The result appears in the list of views, from where a space admin can attach it to a page. A view nobody has attached is harmless: it exists, and does nothing until displayed.

Nanopublication · Open in Nanodash

This page is a copy of the topic Resource view of the Nanopublication Docs. Each paragraph is a nanopublication. In Nanodash you also find their examples, related paragraphs, and version history, and members of the nanopub space can edit them there.