API
  • API Index
  • Batch API
  • Content Negotiation
  • Dynamic Paths
  • Hierarchy API
  • List API
  • Quick Reference
  • Time Series API
  • Views
    • Configuration
  • Overview
  • Application Configuration
  • Documentation Configuration
  • Spec Configuration
    • Features
  • API Testing
  • Asynchronous Processing
  • Cassandra Time-Series Engine
  • Cassandra Integration
  • Default Controller Customisation
  • Documentation
  • Geospatial Filtering
  • Model Documentation
  • PostgreSQL Integration
  • Excel Spreadsheet Format
    • Tutorials
  • Step-by-Step Guide
  • Archetype Setup
  • Logging
  • Prometheus
  • Sentry Logging
    • UI Customisation
  • UI Customisation
  • SASS Build Chain
  • Shared Layout
  • API Documentation
  • Model Documentation
  • Results
  • sapi-nt v current

    View Configuration

    In sapi-nt, views define tree-shaped projections of property paths relative to the root resources of a query result. Views are usually used on item and list endpoints to characterise the SPARQL queries that they issue to the data source, and the structured responses that they emit. Template endpoints can also use views to define structured responses.

    Views can be derived from or extend the model. As such, any views configured by your application should be well defined, and kept consistent with the default model.

    View specs have a type value of view.

    A view spec can have the following properties:

    Property Meaning Default
    view A definition of the properties that comprise the view.  
    includeId If true, the root @id property will be included in responses that are in CSV and XLS format. true
    csv.map A map of names of properties on the view to corresponding aliases that will be rendered in CSV and XLS format.  
    csv.flatPaths A list of .-delimited property paths whose values should be denormalised in flat formats such as CSV and XLS.  
    csvmap Deprecated - Please use csv.map.  
    flatPaths Deprecated - Please use csv.flatPaths.  
    showLangTags Determines whether to render language tagged strings as objects with separate value and language fields in JSON results.  

    The view definition, given by the view property of the spec, can be defined as an inline list of properties in the same form as property specs defined in a model, or as a projection on a class in the model.

    The showLangTags property only affects results that are rendered in JSON format. If you do not set this property, sapi-nt uses the default value that is set on the model spec.

    View Definition

    Inline

    An inline view consists of an array of entries, each of which defines an RDF property. These property definitions use the same form as property specs that would be defined in a model.

    As in a model spec, a property can be written simply as a URI or compact URI (eg. rdfs:label). In this case it will take default values for its other attributes.

    Example

    name: compactView
    type: view
    view :
        - "rdfs:label"
        - prop: "rdf:type"
          multi: true
          nested:
          - "rdfs:label"
        - "skos:notation"
    csv:
      flatPaths: [ label, type.label ]
    

    Projection

    Views can be defined as projections on a named class in the model.

    Property Meaning
    class The URI of the class to be projected on (defined in the global model spec).
    projection A projection string or tree structure defining which property paths to include.

    Properties in the projection are referenced by their short names . A * in the projection denotes a wildcard, which will include all of the properties defined on the related class in the model.

    String Notation

    The string notation is a comma separated list of properties and/or dot separated property paths which define the projection. The syntax is the same as that of the _projection query parameter.

    Character Meaning
    , Separator between properties and/or property paths.
    . Separator between properties that comprise a property path.
    ( ) Surrounds a set of properties and/or property paths that are relative to the preceding property or property path.
    Example
    name : fullView
    type : view
    view :
      class     : def-pa:ProtectedArea
      projection: "type,label,notation,protectedAreaType.label, envelope(*)"
    

    Tree Notation

    The tree structure is comprised by a list of property definitions that correspond to properties defined in the model. They can written as either the property name, or a nested object whose prop value is the property name. Each property definition can optionally specify a list of nested properties, given by the nested property, to include in the projection.

    Example
    name : fullView
    type : view
    view :
      class     : def-pa:ProtectedArea
      projection:
        - type
        - label
        - prop: notation
        - prop: protectedAreaType
          nested:
            - prop: label
        - prop: envelope
          nested:
            - "*"