You are browsing the docs for Nexus v1.6.x, the latest release is available here
CompositeView
This view is composed by multiple sources
and projections
.
Processing pipeline
An asynchronous process gets triggered for every view. This process can be visualized as a pipeline with different stages.
The first stage is the input of the pipeline: a stream of sources.
The last stage takes the resulting output from the pipeline and index it on the configured projection.
Sources
A source defines the location where to retrieve the resources. It is the input of the pipeline.
There are 3 types of sources available.
ProjectEventStream
This source reads events in a streaming fashion from the current project event log.
The events are offered to the projections stage.
{
"sources": [
{
"@id": "{sourceId},
"@type": "ProjectEventStream",
"resourceSchemas": [ "{resourceSchema}", ...],
"resourceTypes": [ "{resourceType}", ...],
"resourceTag": "{tag}"
}
],
...
}
where…
{sourceId}
: Iri - The identifier of the source. This field is optional. When missing, a randomly generated Iri will be assigned.{resourceSchema}
: Iri - Selects only resources that are validated against the provided schema Iri. This field is optional.{resourceType}
: Iri - Select only resources of the provided type Iri. This field is optional.{tag}
: String - Selects only resources with the provided tag. This field is optional.
CrossProjectEventStream
This source reads events in a streaming fashion from the defined project event log in the current Nexus Delta deployment.
The specified list of identities will be used to retrieve the resources from the project. The identities must have events/read
permission on the target project in order to read events.
The events are offered to the projections stage.
{
"sources": [
{
"@id": "{sourceId}",
"@type": "CrossProjectEventStream",
"project": "{project}",
"identities": [ {_identity_}, {...} ],
"resourceSchemas": [ "{resourceSchema}", ...],
"resourceTypes": [ "{resourceType}", ...],
"resourceTag": "{tag}"
}
],
...
}
where…
{sourceId}
: Iri - The identifier of the source. This field is optional. When missing, a randomly generated Iri will be assigned.{project}
: String - the target project (in the format ‘myorg/myproject’)._identity_
: Json object - the identity against which to enforce ACLs during the resource retrieval process.{resourceSchema}
: Iri - Selects only resources that are validated against the provided schema Iri. This field is optional.{resourceType}
: Iri - Select only resources of the provided type Iri. This field is optional.{tag}
: String - Selects only resources with the provided tag. This field is optional.
RemoteProjectEventStream
This source reads events in a streaming fashion from the defined project event log in a remote Nexus Delta deployment. The provided token
must have events/read
permissions on the target project in order to read events.
The events are offered to the projections stage.
{
"sources": [
{
"@id": "{sourceId}",
"@type": "RemoteProjectEventStream",
"project": "{project}",
"endpoint": "{endpoint}",
"token": "{token}",
"resourceSchemas": [ "{resourceSchema}", ...],
"resourceTypes": [ "{resourceType}", ...],
"resourceTag": "{tag}"
}
],
...
}
where…
{sourceId}
: Iri - The identifier of the source. This field is optional. When missing, a randomly generated Iri will be assigned.{project}
: String - the remote project (in the format ‘myorg/myproject’).{endpoint}
: Iri - the Nexus deployment endpoint.{token}
: String - the Nexus deployment token. This field is optional. When missing, the Nexus endpoint will be accessed without authentication.{resourceSchema}
: Iri - Selects only resources that are validated against the provided schema Iri. This field is optional.{resourceType}
: Iri - Select only resources of the provided type Iri. This field is optional.{tag}
: String - Selects only resources with the provided tag. This field is optional.
Intermediate Sparql space
After the events are gathered from each source, the following steps are executed:
- Convert event into a resource.
- Discard undesired resources (resources not matching the source
resourceSchemas
,resourceTypes
orresourceTag
). - Store the RDF triple representation of a resource in an intermediate Sparql space. This space will be used by the projections in the following pipeline steps.
Projections
A projection defines the type of indexing and the query to transform the data. It is the output of the pipeline.
There are 2 types of projections available
ElasticSearchProjection
This projection executes the following steps:
- Discard undesired resources (resources not matching the projection
resourceSchemas
,resourceTypes
orresourceTag
). - Transform the resource by executing an SPARQL construct query against the intermediate Sparql space.
- Convert the resulting RDF triples into JSON using the provided JSON-LD context.
- Stores the resulting JSON as a Document in an ElasticSearch index.
{
"projections": [
{
"@id": "{projectionId}",
"@type": "ElasticSearchProjection",
"mapping": _elasticsearch mapping_,
"settings": _elasticsearch settings_,
"query": "{query}",
"context": _context_,
"resourceSchemas": [ "{resourceSchema}", ...],
"resourceTypes": [ "{resourceType}", ...],
"resourceTag": "{tag}",
"includeMetadata": {includeMetadata},
"includeDeprecated": {includeDeprecated},
"permission": {permission}
}
],
...
}
where…
{projectionId}
: Iri - The identifier of the projection. This field is optional. When missing, a randomly generated Iri will be assigned._elasticsearch mapping_
: Json object - Defines the value types for the Json keys, as stated at the ElasticSearch mapping documentation._elasticsearch settings_
: Json object - Defines the indexing configuration, as stated at the ElasticSearch settings documentation._context_
: Json - the JSON-LD context value applied to the query results.{query}
: Sparql Construct Query - Defines the Sparql query to execute against the intermediate Sparql space for each target resource.{resourceSchema}
: Iri - Selects only resources that are validated against the provided schema Iri to perform the query. This field is optional.{resourceType}
: Iri - Select only resources of the provided type Iri to perform the query. This field is optional.{tag}
: String - Selects only resources with the provided tag to perform the query. This field is optional.{includeMetadata}
: Boolean - If true, the resource’s nexus metadata (_constrainedBy
,_deprecated
, …) will be included in the ElasticSearch document. The default value isfalse
.{includeDeprecated}
: Boolean - If true, deprecated resources are also indexed. The default value isfalse
.{permission}
: String - the permission necessary to query this projection. Defaults toviews/query
.
SparqlProjection
This projection executes the following steps:
- Discard undesired resources.
- Transform the resource by executing an Sparql construct query against the intermediate Sparql space.
- Stores the resulting RDF Triple in a Blazegraph namespace.
{
"projections": [
{
"@id": "{projectionId}",
"@type": "SparqlProjection",
"query": "{query}",
"resourceSchemas": [ "{resourceSchema}", ...],
"resourceTypes": [ "{resourceType}", ...],
"resourceTag": "{tag}",
"includeMetadata": {includeMetadata},
"includeDeprecated": {includeDeprecated},
"permission": "{permission}"
}
],
...
}
where…
{projectionId}
: Iri - The identifier of the projection. This field is optional. When missing, a randomly generated Iri will be assigned.{resourceSchema}
: Iri - Selects only resources that are validated against the provided schema Iri to perform the query. This field is optional.{resourceType}
: Iri - Select only resources of the provided type Iri to perform the query. This field is optional.{tag}
: String - Selects only resources with the provided tag to perform the query. This field is optional.{includeMetadata}
: Boolean - If true, the resource’s nexus metadata (_constrainedBy
,_deprecated
, …) will be stored in the ElasticSearch document. Otherwise it won’t. The default value isfalse
.{includeDeprecated}
: Boolean - If true, deprecated resources are also indexed. The default value isfalse
.{query}
: Sparql Construct Query - Defines the Sparql query to execute against the intermediate Sparql space for each target resource.{permission}
: String - the permission necessary to query this projection. Defaults toviews/query
.
Payload
{
"@id": "{someid}",
"@type": "CompositeView",
"sources": [ _source_, ...],
"projections": [ _projection_, ...],
"rebuildStrategy": {
"@type": "Interval",
"value": "{interval_value}"
}
}
where…
_source_
: Json - The source definition._projection_
: Json - The projection definition.{interval_value}
: String - The maximum interval delay for a resource to be present in a projection, in a human-readable format (e.g.: 10 minutes).
Note: The rebuildStrategy
block is optional. If missing, the view won’t be automatically restarted.
Example
The following example creates a Composite view containing 3 sources and 2 projections.
The incoming data from each of the sources is stored as RDF triples in the intermediate Sparql space .
The ElasticSearch projection http://music.com/es
queries the Sparql intermediate namespace when the current resource in the pipeline has the type http://music.com/Band
.
The Sparql projection http://music.com/sparql
queries the Sparql intermediate namespace when the current resource in the pipeline has the type http://music.com/Album
.
The view is restarted every 10 minutes if there are new resources in any of the sources since the last time it was restarted. This allows to deal with partial graph visibility issues.
{
"@type": "CompositeView",
"sources": [
{
"@id": "http://music.com/source_bands",
"@type": "ProjectEventStream",
"resourceTypes": [ "http://music.com/Band" ]
},
{
"@id": "http://music.com/source_albums",
"@type": "CrossProjectEventStream",
"project": "myorg/albums",
"identities": {
"@type": "Anonymous"
},
"resourceTypes": [ "http://music.com/Album" ]
},
{
"@id": "http://music.com/source_songs",
"@type": "RemoteProjectEventStream",
"endpoint": "http://localhost:8080/v1",
"project": "myorg/songs",
"resourceTypes": [ "http://music.com/Song" ]
}
],
"projections": [
{
"@id": "http://music.com/es",
"@type": "ElasticSearchProjection",
"mapping": {
"properties": {
"@type": {
"type": "keyword"
},
"@id": {
"type": "keyword"
},
"name": {
"type": "keyword"
},
"genre": {
"type": "keyword"
},
"start": {
"type": "integer"
},
"album": {
"type": "nested",
"properties": {
"title": {
"type": "text"
}
}
}
},
"dynamic": false
},
"query": "prefix music: <http://music.com/> CONSTRUCT {{resource_id} music:name ?bandName ; music:genre ?bandGenre ; music:start ?bandStartYear ; music:album ?albumId . ?albumId music:title ?albumTitle . } WHERE {{resource_id} music:name ?bandName ; music:start ?bandStartYear; music:genre ?bandGenre . OPTIONAL {{resource_id} ^music:by ?albumId . ?albumId music:title ?albumTitle . } }",
"context": {
"@base": "http://music.com/",
"@vocab": "http://music.com/"
},
"resourceTypes": [ "http://music.com/Band" ]
},
{
"@id": "http://music.com/sparql",
"@type": "SparqlProjection",
"query": "prefix xsd: <http://www.w3.org/2001/XMLSchema#> prefix music: <http://music.com/> prefix nxv: <https://bluebrain.github.io/nexus/vocabulary/> CONSTRUCT { {resource_id} music:name ?albumTitle ; music:length ?albumLength ; music:numberOfSongs ?numberOfSongs } WHERE {SELECT ?albumReleaseDate ?albumTitle (sum(xsd:integer(?songLength)) as ?albumLength) (count(?albumReleaseDate) as ?numberOfSongs) WHERE {OPTIONAL { {resource_id} ^music:on / music:length ?songLength } {resource_id} music:released ?albumReleaseDate ; music:title ?albumTitle . } GROUP BY ?albumReleaseDate ?albumTitle }",
"context": {
"@base": "http://music.com/",
"@vocab": "http://music.com/"
},
"resourceTypes": [ "http://music.com/Album" ]
}
],
"rebuildStrategy": {
"@type": "Interval",
"value": "10 minute"
}
}
Create using POST
POST /v1/views/{org_label}/{project_label}
{...}
The json payload:
- If the
@id
value is found on the payload, this@id
will be used. - If the
@id
value is not found on the payload, an@id
will be generated as follows:base:{UUID}
. Thebase
is theprefix
defined on the resource’s project ({project_label}
).
Example
- Request
-
source
curl -X POST \ -H "Content-Type: application/json" \ "http://localhost:8080/v1/views/myorg/bands" \ -d \ '{ "@type": "CompositeView", "sources": [ { "@id": "http://music.com/source_bands", "@type": "ProjectEventStream", "resourceTypes": [ "http://music.com/Band" ] }, { "@id": "http://music.com/source_albums", "@type": "CrossProjectEventStream", "project": "myorg/albums", "identities": { "@type": "Anonymous" }, "resourceTypes": [ "http://music.com/Album" ] }, { "@id": "http://music.com/source_songs", "@type": "RemoteProjectEventStream", "endpoint": "http://localhost:8080/v1", "project": "myorg/songs", "resourceTypes": [ "http://music.com/Song" ] } ], "projections": [ { "@id": "http://music.com/es", "@type": "ElasticSearchProjection", "mapping": { "properties": { "@type": { "type": "keyword" }, "@id": { "type": "keyword" }, "name": { "type": "keyword" }, "genre": { "type": "keyword" }, "start": { "type": "integer" }, "album": { "type": "nested", "properties": { "title": { "type": "text" } } } }, "dynamic": false }, "query": "prefix music: <http://music.com/> CONSTRUCT {{resource_id} music:name ?bandName ; music:genre ?bandGenre ; music:start ?bandStartYear ; music:album ?albumId . ?albumId music:title ?albumTitle . } WHERE {{resource_id} music:name ?bandName ; music:start ?bandStartYear; music:genre ?bandGenre . OPTIONAL {{resource_id} ^music:by ?albumId . ?albumId music:title ?albumTitle . } }", "context": { "@base": "http://music.com/", "@vocab": "http://music.com/" }, "resourceTypes": [ "http://music.com/Band" ] }, { "@id": "http://music.com/sparql", "@type": "SparqlProjection", "query": "prefix xsd: <http://www.w3.org/2001/XMLSchema#> prefix music: <http://music.com/> prefix nxv: <https://bluebrain.github.io/nexus/vocabulary/> CONSTRUCT { {resource_id} music:name ?albumTitle ; music:length ?albumLength ; music:numberOfSongs ?numberOfSongs } WHERE {SELECT ?albumReleaseDate ?albumTitle (sum(xsd:integer(?songLength)) as ?albumLength) (count(?albumReleaseDate) as ?numberOfSongs) WHERE {OPTIONAL { {resource_id} ^music:on / music:length ?songLength } {resource_id} music:released ?albumReleaseDate ; music:title ?albumTitle . } GROUP BY ?albumReleaseDate ?albumTitle }", "context": { "@base": "http://music.com/", "@vocab": "http://music.com/" }, "resourceTypes": [ "http://music.com/Album" ] } ], "rebuildStrategy": { "@type": "Interval", "value": "10 minute" } }'
- Payload
-
source
{ "@type": "CompositeView", "sources": [ { "@id": "http://music.com/source_bands", "@type": "ProjectEventStream", "resourceTypes": [ "http://music.com/Band" ] }, { "@id": "http://music.com/source_albums", "@type": "CrossProjectEventStream", "project": "myorg/albums", "identities": { "@type": "Anonymous" }, "resourceTypes": [ "http://music.com/Album" ] }, { "@id": "http://music.com/source_songs", "@type": "RemoteProjectEventStream", "endpoint": "http://localhost:8080/v1", "project": "myorg/songs", "resourceTypes": [ "http://music.com/Song" ] } ], "projections": [ { "@id": "http://music.com/es", "@type": "ElasticSearchProjection", "mapping": { "properties": { "@type": { "type": "keyword" }, "@id": { "type": "keyword" }, "name": { "type": "keyword" }, "genre": { "type": "keyword" }, "start": { "type": "integer" }, "album": { "type": "nested", "properties": { "title": { "type": "text" } } } }, "dynamic": false }, "query": "prefix music: <http://music.com/> CONSTRUCT {{resource_id} music:name ?bandName ; music:genre ?bandGenre ; music:start ?bandStartYear ; music:album ?albumId . ?albumId music:title ?albumTitle . } WHERE {{resource_id} music:name ?bandName ; music:start ?bandStartYear; music:genre ?bandGenre . OPTIONAL {{resource_id} ^music:by ?albumId . ?albumId music:title ?albumTitle . } }", "context": { "@base": "http://music.com/", "@vocab": "http://music.com/" }, "resourceTypes": [ "http://music.com/Band" ] }, { "@id": "http://music.com/sparql", "@type": "SparqlProjection", "query": "prefix xsd: <http://www.w3.org/2001/XMLSchema#> prefix music: <http://music.com/> prefix nxv: <https://bluebrain.github.io/nexus/vocabulary/> CONSTRUCT { {resource_id} music:name ?albumTitle ; music:length ?albumLength ; music:numberOfSongs ?numberOfSongs } WHERE {SELECT ?albumReleaseDate ?albumTitle (sum(xsd:integer(?songLength)) as ?albumLength) (count(?albumReleaseDate) as ?numberOfSongs) WHERE {OPTIONAL { {resource_id} ^music:on / music:length ?songLength } {resource_id} music:released ?albumReleaseDate ; music:title ?albumTitle . } GROUP BY ?albumReleaseDate ?albumTitle }", "context": { "@base": "http://music.com/", "@vocab": "http://music.com/" }, "resourceTypes": [ "http://music.com/Album" ] } ], "rebuildStrategy": { "@type": "Interval", "value": "3 minute" } }
- Response
-
source
{ "@context": [ "https://bluebrain.github.io/nexus/contexts/composite-views-metadata.json", "https://bluebrain.github.io/nexus/contexts/metadata.json" ], "@id": "http://music.com/fb935e64-58c0-4f84-85ef-c6a97d06b699", "@type": [ "View", "CompositeView" ], "_constrainedBy": "https://bluebrain.github.io/nexus/schemas/views.json", "_createdAt": "2021-05-17T14:43:41.763Z", "_createdBy": "http://localhost:8080/v1/anonymous", "_deprecated": false, "_incoming": "http://localhost:8080/v1/views/myorg/bands/fb935e64-58c0-4f84-85ef-c6a97d06b699/incoming", "_outgoing": "http://localhost:8080/v1/views/myorg/bands/fb935e64-58c0-4f84-85ef-c6a97d06b699/outgoing", "_project": "http://localhost:8080/v1/projects/myorg/bands", "_rev": 1, "_self": "http://localhost:8080/v1/views/myorg/bands/fb935e64-58c0-4f84-85ef-c6a97d06b699", "_updatedAt": "2021-05-17T14:43:41.763Z", "_updatedBy": "http://localhost:8080/v1/anonymous", "_uuid": "4b6fe5bf-675c-40bf-88ac-2b26575236c9" }
Create using PUT
This alternative endpoint to create a view is useful in case the json payload does not contain an @id
but you want to specify one. The @id
will be specified in the last segment of the endpoint URI.
PUT /v1/views/{org_label}/{project_label}/{view_id}
{...}
Note that if the payload contains an @id
different from the {view_id}
, the request will fail.
Example
- Request
-
source
curl -X PUT \ -H "Content-Type: application/json" \ "http://localhost:8080/v1/views/myorg/bands/composite_view" \ -d \ '{ "@type": "CompositeView", "sources": [ { "@id": "http://music.com/source_bands", "@type": "ProjectEventStream", "resourceTypes": [ "http://music.com/Band" ] }, { "@id": "http://music.com/source_albums", "@type": "CrossProjectEventStream", "project": "myorg/albums", "identities": { "@type": "Anonymous" }, "resourceTypes": [ "http://music.com/Album" ] }, { "@id": "http://music.com/source_songs", "@type": "RemoteProjectEventStream", "endpoint": "http://localhost:8080/v1", "project": "myorg/songs", "resourceTypes": [ "http://music.com/Song" ] } ], "projections": [ { "@id": "http://music.com/es", "@type": "ElasticSearchProjection", "mapping": { "properties": { "@type": { "type": "keyword" }, "@id": { "type": "keyword" }, "name": { "type": "keyword" }, "genre": { "type": "keyword" }, "start": { "type": "integer" }, "album": { "type": "nested", "properties": { "title": { "type": "text" } } } }, "dynamic": false }, "query": "prefix music: <http://music.com/> CONSTRUCT {{resource_id} music:name ?bandName ; music:genre ?bandGenre ; music:start ?bandStartYear ; music:album ?albumId . ?albumId music:title ?albumTitle . } WHERE {{resource_id} music:name ?bandName ; music:start ?bandStartYear; music:genre ?bandGenre . OPTIONAL {{resource_id} ^music:by ?albumId . ?albumId music:title ?albumTitle . } }", "context": { "@base": "http://music.com/", "@vocab": "http://music.com/" }, "resourceTypes": [ "http://music.com/Band" ] }, { "@id": "http://music.com/sparql", "@type": "SparqlProjection", "query": "prefix xsd: <http://www.w3.org/2001/XMLSchema#> prefix music: <http://music.com/> prefix nxv: <https://bluebrain.github.io/nexus/vocabulary/> CONSTRUCT { {resource_id} music:name ?albumTitle ; music:length ?albumLength ; music:numberOfSongs ?numberOfSongs } WHERE {SELECT ?albumReleaseDate ?albumTitle (sum(xsd:integer(?songLength)) as ?albumLength) (count(?albumReleaseDate) as ?numberOfSongs) WHERE {OPTIONAL { {resource_id} ^music:on / music:length ?songLength } {resource_id} music:released ?albumReleaseDate ; music:title ?albumTitle . } GROUP BY ?albumReleaseDate ?albumTitle }", "context": { "@base": "http://music.com/", "@vocab": "http://music.com/" }, "resourceTypes": [ "http://music.com/Album" ] } ], "rebuildStrategy": { "@type": "Interval", "value": "10 minute" } }'
- Payload
-
source
{ "@type": "CompositeView", "sources": [ { "@id": "http://music.com/source_bands", "@type": "ProjectEventStream", "resourceTypes": [ "http://music.com/Band" ] }, { "@id": "http://music.com/source_albums", "@type": "CrossProjectEventStream", "project": "myorg/albums", "identities": { "@type": "Anonymous" }, "resourceTypes": [ "http://music.com/Album" ] }, { "@id": "http://music.com/source_songs", "@type": "RemoteProjectEventStream", "endpoint": "http://localhost:8080/v1", "project": "myorg/songs", "resourceTypes": [ "http://music.com/Song" ] } ], "projections": [ { "@id": "http://music.com/es", "@type": "ElasticSearchProjection", "mapping": { "properties": { "@type": { "type": "keyword" }, "@id": { "type": "keyword" }, "name": { "type": "keyword" }, "genre": { "type": "keyword" }, "start": { "type": "integer" }, "album": { "type": "nested", "properties": { "title": { "type": "text" } } } }, "dynamic": false }, "query": "prefix music: <http://music.com/> CONSTRUCT {{resource_id} music:name ?bandName ; music:genre ?bandGenre ; music:start ?bandStartYear ; music:album ?albumId . ?albumId music:title ?albumTitle . } WHERE {{resource_id} music:name ?bandName ; music:start ?bandStartYear; music:genre ?bandGenre . OPTIONAL {{resource_id} ^music:by ?albumId . ?albumId music:title ?albumTitle . } }", "context": { "@base": "http://music.com/", "@vocab": "http://music.com/" }, "resourceTypes": [ "http://music.com/Band" ] }, { "@id": "http://music.com/sparql", "@type": "SparqlProjection", "query": "prefix xsd: <http://www.w3.org/2001/XMLSchema#> prefix music: <http://music.com/> prefix nxv: <https://bluebrain.github.io/nexus/vocabulary/> CONSTRUCT { {resource_id} music:name ?albumTitle ; music:length ?albumLength ; music:numberOfSongs ?numberOfSongs } WHERE {SELECT ?albumReleaseDate ?albumTitle (sum(xsd:integer(?songLength)) as ?albumLength) (count(?albumReleaseDate) as ?numberOfSongs) WHERE {OPTIONAL { {resource_id} ^music:on / music:length ?songLength } {resource_id} music:released ?albumReleaseDate ; music:title ?albumTitle . } GROUP BY ?albumReleaseDate ?albumTitle }", "context": { "@base": "http://music.com/", "@vocab": "http://music.com/" }, "resourceTypes": [ "http://music.com/Album" ] } ], "rebuildStrategy": { "@type": "Interval", "value": "3 minute" } }
- Response
-
source
{ "@context": [ "https://bluebrain.github.io/nexus/contexts/composite-views-metadata.json", "https://bluebrain.github.io/nexus/contexts/metadata.json" ], "@id": "http://music.com/composite_view", "@type": [ "View", "CompositeView" ], "_constrainedBy": "https://bluebrain.github.io/nexus/schemas/views.json", "_createdAt": "2021-05-17T14:43:41.763Z", "_createdBy": "http://localhost:8080/v1/anonymous", "_deprecated": false, "_incoming": "http://localhost:8080/v1/views/myorg/bands/composite_view/incoming", "_outgoing": "http://localhost:8080/v1/views/myorg/bands/composite_view/outgoing", "_project": "http://localhost:8080/v1/projects/myorg/bands", "_rev": 1, "_self": "http://localhost:8080/v1/views/myorg/bands/composite_view", "_updatedAt": "2021-05-17T14:43:41.763Z", "_updatedBy": "http://localhost:8080/v1/anonymous", "_uuid": "4b6fe5bf-675c-40bf-88ac-2b26575236c9" }
Update
This operation overrides the payload.
In order to ensure a client does not perform any changes to a resource without having had seen the previous revision of the view, the last revision needs to be passed as a query parameter.
PUT /v1/views/{org_label}/{project_label}/{view_id}?rev={previous_rev}
{...}
… where {previous_rev}
is the last known revision number for the view.
Updating a view creates new Elasticsearch indices and Blazegraph namespaces and deletes the existing ones. The indexing process will start from the beginning.
Example
- Request
-
source
curl -X PUT \ -H "Content-Type: application/json" \ "http://localhost:8080/v1/views/myorg/bands/composite_view?rev=1" \ -d \ '{ "@type": "CompositeView", "sources": [ { "@id": "http://music.com/source_bands", "@type": "ProjectEventStream", "resourceTypes": [ "http://music.com/Band" ] }, { "@id": "http://music.com/source_albums", "@type": "CrossProjectEventStream", "project": "myorg/albums", "identities": { "@type": "Anonymous" }, "resourceTypes": [ "http://music.com/Album" ] }, { "@id": "http://music.com/source_songs", "@type": "RemoteProjectEventStream", "endpoint": "http://localhost:8080/v1", "project": "myorg/songs", "resourceTypes": [ "http://music.com/Song" ] } ], "projections": [ { "@id": "http://music.com/es", "@type": "ElasticSearchProjection", "mapping": { "properties": { "@type": { "type": "keyword" }, "@id": { "type": "keyword" }, "name": { "type": "keyword" }, "genre": { "type": "keyword" }, "start": { "type": "integer" }, "album": { "type": "nested", "properties": { "title": { "type": "text" } } } }, "dynamic": false }, "query": "prefix music: <http://music.com/> CONSTRUCT {{resource_id} music:name ?bandName ; music:genre ?bandGenre ; music:start ?bandStartYear ; music:album ?albumId . ?albumId music:title ?albumTitle . } WHERE {{resource_id} music:name ?bandName ; music:start ?bandStartYear; music:genre ?bandGenre . OPTIONAL {{resource_id} ^music:by ?albumId . ?albumId music:title ?albumTitle . } }", "context": { "@base": "http://music.com/", "@vocab": "http://music.com/" }, "resourceTypes": [ "http://music.com/Band" ] }, { "@id": "http://music.com/sparql", "@type": "SparqlProjection", "query": "prefix xsd: <http://www.w3.org/2001/XMLSchema#> prefix music: <http://music.com/> prefix nxv: <https://bluebrain.github.io/nexus/vocabulary/> CONSTRUCT { {resource_id} music:name ?albumTitle ; music:length ?albumLength ; music:numberOfSongs ?numberOfSongs } WHERE {SELECT ?albumReleaseDate ?albumTitle (sum(xsd:integer(?songLength)) as ?albumLength) (count(?albumReleaseDate) as ?numberOfSongs) WHERE {OPTIONAL { {resource_id} ^music:on / music:length ?songLength } {resource_id} music:released ?albumReleaseDate ; music:title ?albumTitle . } GROUP BY ?albumReleaseDate ?albumTitle }", "context": { "@base": "http://music.com/", "@vocab": "http://music.com/" }, "resourceTypes": [ "http://music.com/Album" ] } ], "rebuildStrategy": { "@type": "Interval", "value": "10 minute" } }'
- Payload
-
source
{ "@type": "CompositeView", "sources": [ { "@id": "http://music.com/source_bands", "@type": "ProjectEventStream", "resourceTypes": [ "http://music.com/Band" ] }, { "@id": "http://music.com/source_albums", "@type": "CrossProjectEventStream", "project": "myorg/albums", "identities": { "@type": "Anonymous" }, "resourceTypes": [ "http://music.com/Album" ] }, { "@id": "http://music.com/source_songs", "@type": "RemoteProjectEventStream", "endpoint": "http://localhost:8080/v1", "project": "myorg/songs", "resourceTypes": [ "http://music.com/Song" ] } ], "projections": [ { "@id": "http://music.com/es", "@type": "ElasticSearchProjection", "mapping": { "properties": { "@type": { "type": "keyword" }, "@id": { "type": "keyword" }, "name": { "type": "keyword" }, "genre": { "type": "keyword" }, "start": { "type": "integer" }, "album": { "type": "nested", "properties": { "title": { "type": "text" } } } }, "dynamic": false }, "query": "prefix music: <http://music.com/> CONSTRUCT {{resource_id} music:name ?bandName ; music:genre ?bandGenre ; music:start ?bandStartYear ; music:album ?albumId . ?albumId music:title ?albumTitle . } WHERE {{resource_id} music:name ?bandName ; music:start ?bandStartYear; music:genre ?bandGenre . OPTIONAL {{resource_id} ^music:by ?albumId . ?albumId music:title ?albumTitle . } }", "context": { "@base": "http://music.com/", "@vocab": "http://music.com/" }, "resourceTypes": [ "http://music.com/Band" ] }, { "@id": "http://music.com/sparql", "@type": "SparqlProjection", "query": "prefix xsd: <http://www.w3.org/2001/XMLSchema#> prefix music: <http://music.com/> prefix nxv: <https://bluebrain.github.io/nexus/vocabulary/> CONSTRUCT { {resource_id} music:name ?albumTitle ; music:length ?albumLength ; music:numberOfSongs ?numberOfSongs } WHERE {SELECT ?albumReleaseDate ?albumTitle (sum(xsd:integer(?songLength)) as ?albumLength) (count(?albumReleaseDate) as ?numberOfSongs) WHERE {OPTIONAL { {resource_id} ^music:on / music:length ?songLength } {resource_id} music:released ?albumReleaseDate ; music:title ?albumTitle . } GROUP BY ?albumReleaseDate ?albumTitle }", "context": { "@base": "http://music.com/", "@vocab": "http://music.com/" }, "resourceTypes": [ "http://music.com/Album" ] } ], "rebuildStrategy": { "@type": "Interval", "value": "3 minute" } }
- Response
-
source
{ "@context": [ "https://bluebrain.github.io/nexus/contexts/composite-views-metadata.json", "https://bluebrain.github.io/nexus/contexts/metadata.json" ], "@id": "http://music.com/composite_view", "@type": [ "View", "CompositeView" ], "_constrainedBy": "https://bluebrain.github.io/nexus/schemas/views.json", "_createdAt": "2021-05-17T14:43:41.763Z", "_createdBy": "http://localhost:8080/v1/anonymous", "_deprecated": false, "_incoming": "http://localhost:8080/v1/views/myorg/bands/composite_view/incoming", "_outgoing": "http://localhost:8080/v1/views/myorg/bands/composite_view/outgoing", "_project": "http://localhost:8080/v1/projects/myorg/bands", "_rev": 2, "_self": "http://localhost:8080/v1/views/myorg/bands/composite_view", "_updatedAt": "2021-05-17T14:55:45.472Z", "_updatedBy": "http://localhost:8080/v1/anonymous", "_uuid": "4b6fe5bf-675c-40bf-88ac-2b26575236c9" }
Tag
Links a view revision to a specific name.
Tagging a view is considered to be an update as well.
POST /v1/views/{org_label}/{project_label}/{view_id}/tags?rev={previous_rev}
{
"tag": "{name}",
"rev": {rev}
}
… where
{previous_rev}
: is the last known revision number for the resource.{name}
: String - label given to the view at specific revision.{rev}
: Number - the revision to link the provided{name}
.
Example
- Request
-
source
curl -X POST \ -H "Content-Type: application/json" \ "http://localhost:8080/v1/views/myorg/bands/composite_view/tags?rev=2" \ -d \ '{ "tag": "mytag", "rev": 1 }'
- Payload
-
source
{ "tag": "mytag", "rev": 1 }
- Response
-
source
{ "@context": [ "https://bluebrain.github.io/nexus/contexts/composite-views-metadata.json", "https://bluebrain.github.io/nexus/contexts/metadata.json" ], "@id": "http://music.com/composite_view", "@type": [ "View", "CompositeView" ], "_constrainedBy": "https://bluebrain.github.io/nexus/schemas/views.json", "_createdAt": "2021-05-17T14:43:41.763Z", "_createdBy": "http://localhost:8080/v1/anonymous", "_deprecated": false, "_incoming": "http://localhost:8080/v1/views/myorg/bands/composite_view/incoming", "_outgoing": "http://localhost:8080/v1/views/myorg/bands/composite_view/outgoing", "_project": "http://localhost:8080/v1/projects/myorg/bands", "_rev": 3, "_self": "http://localhost:8080/v1/views/myorg/bands/composite_view", "_updatedAt": "2021-05-17T14:58:28.483Z", "_updatedBy": "http://localhost:8080/v1/anonymous", "_uuid": "4b6fe5bf-675c-40bf-88ac-2b26575236c9" }
Deprecate
Locks the view, so no further operations can be performed. It also stops indexing any more resources into it and deletes all the underlying Elasticsearch indices and Blazegraph namespaces.
Deprecating a view is considered to be an update as well.
Deprecating a view deletes all the underlying Elasticsearch indices and Blazegraph namespaces, making the view not searchable.
DELETE /v1/views/{org_label}/{project_label}/{view_id}?rev={previous_rev}
… where {previous_rev}
is the last known revision number for the view.
Example
- Request
-
source
curl -X DELETE \ "http://localhost:8080/v1/views/myorg/bands/composite_view?rev=3"
- Response
-
source
{ "@context": [ "https://bluebrain.github.io/nexus/contexts/composite-views-metadata.json", "https://bluebrain.github.io/nexus/contexts/metadata.json" ], "@id": "http://music.com/composite_view", "@type": [ "View", "CompositeView" ], "_constrainedBy": "https://bluebrain.github.io/nexus/schemas/views.json", "_createdAt": "2021-05-17T14:43:41.763Z", "_createdBy": "http://localhost:8080/v1/anonymous", "_deprecated": true, "_incoming": "http://localhost:8080/v1/views/myorg/bands/composite_view/incoming", "_outgoing": "http://localhost:8080/v1/views/myorg/bands/composite_view/outgoing", "_project": "http://localhost:8080/v1/projects/myorg/bands", "_rev": 4, "_self": "http://localhost:8080/v1/views/myorg/bands/composite_view", "_updatedAt": "2021-05-17T15:50:39.555Z", "_updatedBy": "http://localhost:8080/v1/anonymous", "_uuid": "4b6fe5bf-675c-40bf-88ac-2b26575236c9" }
Fetch
GET /v1/views/{org_label}/{project_label}/{view_id}?rev={rev}&tag={tag}
where …
{rev}
: Number - the targeted revision to be fetched. This field is optional and defaults to the latest revision.{tag}
: String - the targeted tag to be fetched. This field is optional.{rev}
and{tag}
fields cannot be simultaneously present.
Example
- Request
-
source
curl "http://localhost:8080/v1/views/myorg/bands/composite_view?rev=3"
- Response
-
source
{ "@context": [ "https://bluebrain.github.io/nexus/contexts/composite-views.json", "https://bluebrain.github.io/nexus/contexts/metadata.json" ], "@id": "http://music.com/composite_view", "@type": [ "View", "CompositeView" ], "projections": [ { "@id": "http://music.com/es", "@type": "ElasticSearchProjection", "context": { "@base": "http://music.com/", "@vocab": "http://music.com/" }, "includeDeprecated": false, "includeMetadata": false, "mapping": { "dynamic": false, "properties": { "@id": { "type": "keyword" }, "@type": { "type": "keyword" }, "album": { "properties": { "title": { "type": "text" } }, "type": "nested" }, "genre": { "type": "keyword" }, "name": { "type": "keyword" }, "start": { "type": "integer" } } }, "permission": "views/query", "query": "prefix music: <http://music.com/> CONSTRUCT {{resource_id} music:name ?bandName ; music:genre ?bandGenre ; music:start ?bandStartYear ; music:album ?albumId . ?albumId music:title ?albumTitle . } WHERE {{resource_id} music:name ?bandName ; music:start ?bandStartYear; music:genre ?bandGenre . OPTIONAL {{resource_id} ^music:by ?albumId . ?albumId music:title ?albumTitle . } }", "resourceSchemas": [], "resourceTypes": [ "http://music.com/Band" ], "_uuid": "4af5a80c-bac1-4d81-9c00-006da383716f" }, { "@id": "http://music.com/sparql", "@type": "SparqlProjection", "includeDeprecated": false, "includeMetadata": false, "permission": "views/query", "query": "prefix xsd: <http://www.w3.org/2001/XMLSchema#> prefix music: <http://music.com/> prefix nxv: <https://bluebrain.github.io/nexus/vocabulary/> CONSTRUCT { {resource_id} music:name ?albumTitle ; music:length ?albumLength ; music:numberOfSongs ?numberOfSongs } WHERE {SELECT ?albumReleaseDate ?albumTitle (sum(xsd:integer(?songLength)) as ?albumLength) (count(?albumReleaseDate) as ?numberOfSongs) WHERE {OPTIONAL { {resource_id} ^music:on / music:length ?songLength } {resource_id} music:released ?albumReleaseDate ; music:title ?albumTitle . } GROUP BY ?albumReleaseDate ?albumTitle }", "resourceSchemas": [], "resourceTypes": [ "http://music.com/Album" ], "_uuid": "a741d874-90d6-48b5-84c2-f87ecd689043" } ], "rebuildStrategy": { "@type": "Interval", "value": "3 minutes" }, "sources": [ { "@id": "http://music.com/source_bands", "@type": "ProjectEventStream", "includeDeprecated": false, "resourceSchemas": [], "resourceTypes": [ "http://music.com/Band" ], "_uuid": "df5ea885-f0c8-4e8b-8dd2-9ed0bd715ec0" }, { "@id": "http://music.com/source_albums", "@type": "CrossProjectEventStream", "identities": [ { "@id": "http://localhost:8080/v1/anonymous", "@type": "Anonymous" } ], "includeDeprecated": false, "project": "myorg/albums", "resourceSchemas": [], "resourceTypes": [ "http://music.com/Album" ], "_uuid": "eccca1d3-3044-4494-bde6-6c79f56fa649" }, { "@id": "http://music.com/source_songs", "@type": "RemoteProjectEventStream", "endpoint": "http://localhost:8080/v1", "includeDeprecated": false, "project": "myorg/songs", "resourceSchemas": [], "resourceTypes": [ "http://music.com/Song" ], "_uuid": "aa788720-8e0c-4504-8d54-24c597e261e5" } ], "_constrainedBy": "https://bluebrain.github.io/nexus/schemas/views.json", "_createdAt": "2021-05-17T14:43:41.763Z", "_createdBy": "http://localhost:8080/v1/anonymous", "_deprecated": false, "_incoming": "http://localhost:8080/v1/views/myorg/bands/composite_view/incoming", "_outgoing": "http://localhost:8080/v1/views/myorg/bands/composite_view/outgoing", "_project": "http://localhost:8080/v1/projects/myorg/bands", "_rev": 3, "_self": "http://localhost:8080/v1/views/myorg/bands/composite_view", "_updatedAt": "2021-05-17T14:58:28.483Z", "_updatedBy": "http://localhost:8080/v1/anonymous", "_uuid": "4b6fe5bf-675c-40bf-88ac-2b26575236c9" }
Fetch original payload
GET /v1/views/{org_label}/{project_label}/{view_id}/source?rev={rev}&tag={tag}
where …
{rev}
: Number - the targeted revision to be fetched. This field is optional and defaults to the latest revision.{tag}
: String - the targeted tag to be fetched. This field is optional.{rev}
and{tag}
fields cannot be simultaneously present.
Example
- Request
-
source
curl "http://localhost:8080/v1/views/myorg/bands/composite_view/source"
- Response
-
source
{ "@type": "CompositeView", "sources": [ { "@id": "http://music.com/source_bands", "@type": "ProjectEventStream", "resourceTypes": [ "http://music.com/Band" ] }, { "@id": "http://music.com/source_albums", "@type": "CrossProjectEventStream", "project": "myorg/albums", "identities": { "@type": "Anonymous" }, "resourceTypes": [ "http://music.com/Album" ] }, { "@id": "http://music.com/source_songs", "@type": "RemoteProjectEventStream", "endpoint": "http://localhost:8080/v1", "project": "myorg/songs", "resourceTypes": [ "http://music.com/Song" ] } ], "projections": [ { "@id": "http://music.com/es", "@type": "ElasticSearchProjection", "mapping": { "properties": { "@type": { "type": "keyword" }, "@id": { "type": "keyword" }, "name": { "type": "keyword" }, "genre": { "type": "keyword" }, "start": { "type": "integer" }, "album": { "type": "nested", "properties": { "title": { "type": "text" } } } }, "dynamic": false }, "query": "prefix music: <http://music.com/> CONSTRUCT {{resource_id} music:name ?bandName ; music:genre ?bandGenre ; music:start ?bandStartYear ; music:album ?albumId . ?albumId music:title ?albumTitle . } WHERE {{resource_id} music:name ?bandName ; music:start ?bandStartYear; music:genre ?bandGenre . OPTIONAL {{resource_id} ^music:by ?albumId . ?albumId music:title ?albumTitle . } }", "context": { "@base": "http://music.com/", "@vocab": "http://music.com/" }, "resourceTypes": [ "http://music.com/Band" ] }, { "@id": "http://music.com/sparql", "@type": "SparqlProjection", "query": "prefix xsd: <http://www.w3.org/2001/XMLSchema#> prefix music: <http://music.com/> prefix nxv: <https://bluebrain.github.io/nexus/vocabulary/> CONSTRUCT { {resource_id} music:name ?albumTitle ; music:length ?albumLength ; music:numberOfSongs ?numberOfSongs } WHERE {SELECT ?albumReleaseDate ?albumTitle (sum(xsd:integer(?songLength)) as ?albumLength) (count(?albumReleaseDate) as ?numberOfSongs) WHERE {OPTIONAL { {resource_id} ^music:on / music:length ?songLength } {resource_id} music:released ?albumReleaseDate ; music:title ?albumTitle . } GROUP BY ?albumReleaseDate ?albumTitle }", "context": { "@base": "http://music.com/", "@vocab": "http://music.com/" }, "resourceTypes": [ "http://music.com/Album" ] } ], "rebuildStrategy": { "@type": "Interval", "value": "3 minute" } }
Fetch tags
GET /v1/views/{org_label}/{project_label}/{view_id}/tags?rev={rev}&tag={tag}
where …
{rev}
: Number - the targeted revision to be fetched. This field is optional and defaults to the latest revision.{tag}
: String - the targeted tag to be fetched. This field is optional.
{rev}
and {tag}
fields cannot be simultaneously present.
Example
- Request
-
source
curl "http://localhost:8080/v1/views/myorg/bands/composite_view/tags"
- Response
-
source
{ "@context": "https://bluebrain.github.io/nexus/contexts/tags.json", "tags": [ { "rev": 1, "tag": "mytag" } ] }
Search Documents in projection(s)
POST /v1/views/{org_label}/{project_label}/{view_id}/projections/{projection_id}/_search
{...}
where {projection_id}
is the @id value of the target ElasticSearch
projection. The reserved value _
means “every projection”.
The supported payload is defined on the ElasticSearch documentation
Example
- Request
-
source
curl -X POST \ -H "Content-Type: application/json" \ "http://localhost:8080/v1/views/myorg/bands/composite_view/projections/music:es/_search" \ -d \ '{ "query": { "match": { "name": "Muse" } } }'
- Payload
-
source
{ "query": { "match": { "name": "Muse" } } }
- Response
-
source
{ "hits": { "hits": [ { "_id": "http://music.com/muse", "_index": "tests_4b6fe5bf-675c-40bf-88ac-2b26575236c9_4af5a80c-bac1-4d81-9c00-006da383716f_3", "_score": 0.6931471, "_source": { "@id": "muse", "album": [ { "@id": "absolution", "title": "Absolution" }, { "@id": "black_holes_and_revelations", "title": "Black Holes & Revelations" } ], "genre": [ "alternative rock", "progressive rock", "electronica", "art rock", "hard rock", "space rock" ], "name": "Muse", "start": 1994 }, "_type": "_doc" } ], "max_score": 0.6931471, "total": { "relation": "eq", "value": 1 } }, "timed_out": false, "took": 2, "_shards": { "failed": 0, "skipped": 0, "successful": 1, "total": 1 } }
SPARQL query in projection(s)
POST /v1/views/{org_label}/{project_label}/{view_id}/projections/{projection_id}/sparql
{query}
GET /v1/views/{org_label}/{project_label}/{view_id}/projections/{projection_id}/sparql?query={query}
where {projection_id}
is the @id value of the target Sparql
projection. The reserved value _
means “every projection”.
In both endpoints, {query}
is defined by the SPARQL documentation
The Content-Type
HTTP header for POST request is application/sparql-query
.
From Delta 1.5, we have added support for multiple Content Negotiation types when querying the SPARQL view, allowing clients to request different response formats. The Content Negotiation is controlled by the HTTP Accept
header. The following values are supported:
- application/ld+json: Returns an expanded JSON-LD document. This is supported for a subset of SPARQL queries.
- application/n-triples: Returns the n-triples representation. This is supported for a subset of SPARQL queries
- application/rdf+xml: Returns an XML document.
- application/sparql-results+xml: Returns the sparql results in XML.
- application/sparql-results+json: Returns the sparql results in Json (default).
Example
- Request
-
source
curl -X POST \ -H "Content-Type: application/sparql-query" \ -H "Accept: application/n-triples" \ "http://localhost:8080/v1/views/myorg/bands/composite_view/projections/_/sparql" \ -d \ 'prefix music: <http://music.com/> CONSTRUCT { ?s ?p ?o } WHERE { ?s ?p ?o FILTER(?s = music:absolution) }'
- Response
-
source
<http://music.com/absolution> <http://music.com/name> "Absolution" . <http://music.com/absolution> <http://music.com/numberOfSongs> "2"^^<http://www.w3.org/2001/XMLSchema#integer> . <http://music.com/absolution> <http://music.com/length> "488"^^<http://www.w3.org/2001/XMLSchema#integer> .
SPARQL query in the intermediate space
POST /v1/views/{org_label}/{project_label}/{view_id}/sparql
{query}
GET /v1/views/{org_label}/{project_label}/{view_id}/sparql?query={query}
In both endpoints, {query}
is defined by the SPARQL documentation
The Content-Type
HTTP header for POST request is application/sparql-query
.
From Delta 1.5, we have added support for multiple Content Negotiation types when querying the SPARQL view, allowing clients to request different response formats. The Content Negotiation is controlled by the HTTP Accept
header. The following values are supported:
- application/ld+json: Returns an expanded JSON-LD document. This is supported for a subset of SPARQL queries.
- application/n-triples: Returns the n-triples representation. This is supported for a subset of SPARQL queries
- application/rdf+xml: Returns an XML document.
- application/sparql-results+xml: Returns the sparql results in XML.
- application/sparql-results+json: Returns the sparql results in Json (default).
Example
- Request
-
source
curl -X POST \ -H "Content-Type: application/sparql-query" \ -H "Accept: application/n-triples" \ "http://localhost:8080/v1/views/myorg/bands/composite_view/sparql" \ -d \ 'prefix music: <http://music.com/> CONSTRUCT { ?s ?p ?o } WHERE { ?s ?p ?o FILTER(?s = music:absolution) }'
- Response
-
source
<http://music.com/absolution> <https://bluebrain.github.io/nexus/vocabulary/self> <http://localhost:8080/v1/resources/myorg/albums/_/absolution> . <http://music.com/absolution> <https://bluebrain.github.io/nexus/vocabulary/updatedAt> "2021-05-17T14:36:44.992Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> . <http://music.com/absolution> <http://music.com/label> "Warner Bros." . <http://music.com/absolution> <https://bluebrain.github.io/nexus/vocabulary/schemaProject> <http://localhost:8080/v1/projects/myorg/albums> . <http://music.com/absolution> <http://music.com/released> "2003-09-15" . <http://music.com/absolution> <https://bluebrain.github.io/nexus/vocabulary/deprecated> "false"^^<http://www.w3.org/2001/XMLSchema#boolean> . <http://music.com/absolution> <http://music.com/label> "Taste" . <http://music.com/absolution> <http://music.com/title> "Absolution" . <http://music.com/absolution> <http://music.com/label> "East West" . <http://music.com/absolution> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://music.com/Album> . <http://music.com/absolution> <https://bluebrain.github.io/nexus/vocabulary/updatedBy> <http://localhost:8080/v1/anonymous> . <http://music.com/absolution> <http://music.com/by> <http://music.com/muse> . <http://music.com/absolution> <https://bluebrain.github.io/nexus/vocabulary/project> <http://localhost:8080/v1/projects/myorg/albums> . <http://music.com/absolution> <https://bluebrain.github.io/nexus/vocabulary/createdAt> "2021-05-17T14:36:44.992Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> . <http://music.com/absolution> <https://bluebrain.github.io/nexus/vocabulary/constrainedBy> <https://bluebrain.github.io/nexus/schemas/unconstrained.json> . <http://music.com/absolution> <https://bluebrain.github.io/nexus/vocabulary/createdBy> <http://localhost:8080/v1/anonymous> . <http://music.com/absolution> <https://bluebrain.github.io/nexus/vocabulary/outgoing> <http://localhost:8080/v1/resources/myorg/albums/_/absolution/outgoing> . <http://music.com/absolution> <https://bluebrain.github.io/nexus/vocabulary/rev> "1"^^<http://www.w3.org/2001/XMLSchema#integer> . <http://music.com/absolution> <https://bluebrain.github.io/nexus/vocabulary/incoming> <http://localhost:8080/v1/resources/myorg/albums/_/absolution/incoming> .
Fetch statistics
This endpoint displays statistical information about each of the composite view projections.
GET /v1/views/{org_label}/{project_label}/{view_id}/statistics
Example
- Request
-
source
curl "http://localhost:8080/v1/views/myorg/bands/composite_view/statistics"
- Response
-
source
{ "@context": [ "https://bluebrain.github.io/nexus/contexts/metadata.json", "https://bluebrain.github.io/nexus/contexts/search.json", "https://bluebrain.github.io/nexus/contexts/statistics.json" ], "_total": 6, "_results": [ { "sourceId": "http://music.com/source_albums", "projectionId": "http://music.com/es", "delayInSeconds": 0, "discardedEvents": 0, "evaluatedEvents": 10, "failedEvents": 0, "lastEventDateTime": "2021-05-17T14:37:06.893Z", "lastProcessedEventDateTime": "2021-05-17T14:37:06.893Z", "processedEvents": 10, "remainingEvents": 0, "totalEvents": 10 }, { "sourceId": "http://music.com/source_albums", "projectionId": "http://music.com/sparql", "delayInSeconds": 0, "discardedEvents": 0, "evaluatedEvents": 10, "failedEvents": 0, "lastEventDateTime": "2021-05-17T14:37:06.893Z", "lastProcessedEventDateTime": "2021-05-17T14:37:06.893Z", "processedEvents": 10, "remainingEvents": 0, "totalEvents": 10 }, { "sourceId": "http://music.com/source_bands", "projectionId": "http://music.com/es", "delayInSeconds": 0, "discardedEvents": 1, "evaluatedEvents": 11, "failedEvents": 0, "lastEventDateTime": "2021-05-17T14:58:28.483Z", "lastProcessedEventDateTime": "2021-05-17T14:58:28.483Z", "processedEvents": 12, "remainingEvents": 0, "totalEvents": 12 }, { "sourceId": "http://music.com/source_bands", "projectionId": "http://music.com/sparql", "delayInSeconds": 0, "discardedEvents": 1, "evaluatedEvents": 11, "failedEvents": 0, "lastEventDateTime": "2021-05-17T14:58:28.483Z", "lastProcessedEventDateTime": "2021-05-17T14:58:28.483Z", "processedEvents": 12, "remainingEvents": 0, "totalEvents": 12 }, { "sourceId": "http://music.com/source_songs", "projectionId": "http://music.com/es", "delayInSeconds": 0, "discardedEvents": 1, "evaluatedEvents": 13, "failedEvents": 0, "lastEventDateTime": "2021-05-17T14:37:38.397Z", "lastProcessedEventDateTime": "2021-05-17T14:37:38.397Z", "processedEvents": 14, "remainingEvents": 0, "totalEvents": 14 }, { "sourceId": "http://music.com/source_songs", "projectionId": "http://music.com/sparql", "delayInSeconds": 0, "discardedEvents": 1, "evaluatedEvents": 13, "failedEvents": 0, "lastEventDateTime": "2021-05-17T14:37:38.397Z", "lastProcessedEventDateTime": "2021-05-17T14:37:38.397Z", "processedEvents": 14, "remainingEvents": 0, "totalEvents": 14 } ] }
where:
totalEvents
- sum of total number of events from each sourceprocessedEvents
- sum of number of events that have been considered by each sourceremainingEvents
- sum of number of events that remain to be considered by each sourcediscardedEvents
- sum of number of events that have been discarded by each source (were not evaluated due to filters, e.g. did not match schema, tag or type defined in the source)evaluatedEvents
- sum of number of events that have been used to update the intermediate Sparql space of each sourcelastEventDateTime
- timestamp of the last event in the sourceslastProcessedEventDateTime
- timestamp of the last event processed by the sourcesdelayInSeconds
- number of seconds between the last processed event timestamp and the last known event timestampsourceId
- the @id unique value of the source
Fetch source(s) statistics
This endpoint displays statistical information about the projections related to the {source_id}
source.
GET /v1/views/{org_label}/{project_label}/{view_id}/sources/{source_id}/statistics
where {source_id}
is the @id value of the source. The reserved value _
means “every source”.
Example
- Request
-
source
curl "http://localhost:8080/v1/views/myorg/bands/composite_view/sources/_/statistics"
- Response
-
source
{ "@context": [ "https://bluebrain.github.io/nexus/contexts/metadata.json", "https://bluebrain.github.io/nexus/contexts/search.json", "https://bluebrain.github.io/nexus/contexts/statistics.json" ], "_total": 6, "_results": [ { "sourceId": "http://music.com/source_albums", "projectionId": "http://music.com/es", "delayInSeconds": 0, "discardedEvents": 0, "evaluatedEvents": 10, "failedEvents": 0, "lastEventDateTime": "2021-05-17T14:37:06.893Z", "lastProcessedEventDateTime": "2021-05-17T14:37:06.893Z", "processedEvents": 10, "remainingEvents": 0, "totalEvents": 10 }, { "sourceId": "http://music.com/source_albums", "projectionId": "http://music.com/sparql", "delayInSeconds": 0, "discardedEvents": 0, "evaluatedEvents": 10, "failedEvents": 0, "lastEventDateTime": "2021-05-17T14:37:06.893Z", "lastProcessedEventDateTime": "2021-05-17T14:37:06.893Z", "processedEvents": 10, "remainingEvents": 0, "totalEvents": 10 }, { "sourceId": "http://music.com/source_bands", "projectionId": "http://music.com/es", "delayInSeconds": 0, "discardedEvents": 1, "evaluatedEvents": 11, "failedEvents": 0, "lastEventDateTime": "2021-05-17T14:58:28.483Z", "lastProcessedEventDateTime": "2021-05-17T14:58:28.483Z", "processedEvents": 12, "remainingEvents": 0, "totalEvents": 12 }, { "sourceId": "http://music.com/source_bands", "projectionId": "http://music.com/sparql", "delayInSeconds": 0, "discardedEvents": 1, "evaluatedEvents": 11, "failedEvents": 0, "lastEventDateTime": "2021-05-17T14:58:28.483Z", "lastProcessedEventDateTime": "2021-05-17T14:58:28.483Z", "processedEvents": 12, "remainingEvents": 0, "totalEvents": 12 }, { "sourceId": "http://music.com/source_songs", "projectionId": "http://music.com/es", "delayInSeconds": 0, "discardedEvents": 1, "evaluatedEvents": 13, "failedEvents": 0, "lastEventDateTime": "2021-05-17T14:37:38.397Z", "lastProcessedEventDateTime": "2021-05-17T14:37:38.397Z", "processedEvents": 14, "remainingEvents": 0, "totalEvents": 14 }, { "sourceId": "http://music.com/source_songs", "projectionId": "http://music.com/sparql", "delayInSeconds": 0, "discardedEvents": 1, "evaluatedEvents": 13, "failedEvents": 0, "lastEventDateTime": "2021-05-17T14:37:38.397Z", "lastProcessedEventDateTime": "2021-05-17T14:37:38.397Z", "processedEvents": 14, "remainingEvents": 0, "totalEvents": 14 } ] }
where:
totalEvents
- total number of events for the provided sourceprocessedEvents
- number of events that have been considered by the provided sourceremainingEvents
- number of events that remain to be considered by the provided sourcediscardedEvents
- number of events that have been discarded by the provided source (were not evaluated due to filters, e.g. did not match schema, tag or type defined in the source)evaluatedEvents
- number of events that have been used to update the intermediate Sparql of the provided sourcelastEventDateTime
- timestamp of the last event from the provided sourcelastProcessedEventDateTime
- timestamp of the last event processed by the provided sourcedelayInSeconds
- number of seconds between the last processed event timestamp and the last known event timestamp
Fetch projection(s) statistics
This endpoint displays statistical information about the provided projection.
GET /v1/views/{org_label}/{project_label}/{view_id}/projections/{projection_id}/statistics
where {projection_id}
is the @id value of the projection. The reserved value _
means “every projection”.
Example
- Request
-
source
curl "http://localhost:8080/v1/views/myorg/bands/composite_view/projections/_/statistics"
- Response
-
source
{ "@context": [ "https://bluebrain.github.io/nexus/contexts/metadata.json", "https://bluebrain.github.io/nexus/contexts/search.json", "https://bluebrain.github.io/nexus/contexts/statistics.json" ], "_total": 6, "_results": [ { "sourceId": "http://music.com/source_albums", "projectionId": "http://music.com/es", "delayInSeconds": 0, "discardedEvents": 0, "evaluatedEvents": 10, "failedEvents": 0, "lastEventDateTime": "2021-05-17T14:37:06.893Z", "lastProcessedEventDateTime": "2021-05-17T14:37:06.893Z", "processedEvents": 10, "remainingEvents": 0, "totalEvents": 10 }, { "sourceId": "http://music.com/source_albums", "projectionId": "http://music.com/sparql", "delayInSeconds": 0, "discardedEvents": 0, "evaluatedEvents": 10, "failedEvents": 0, "lastEventDateTime": "2021-05-17T14:37:06.893Z", "lastProcessedEventDateTime": "2021-05-17T14:37:06.893Z", "processedEvents": 10, "remainingEvents": 0, "totalEvents": 10 }, { "sourceId": "http://music.com/source_bands", "projectionId": "http://music.com/es", "delayInSeconds": 0, "discardedEvents": 1, "evaluatedEvents": 11, "failedEvents": 0, "lastEventDateTime": "2021-05-17T14:58:28.483Z", "lastProcessedEventDateTime": "2021-05-17T14:58:28.483Z", "processedEvents": 12, "remainingEvents": 0, "totalEvents": 12 }, { "sourceId": "http://music.com/source_bands", "projectionId": "http://music.com/sparql", "delayInSeconds": 0, "discardedEvents": 1, "evaluatedEvents": 11, "failedEvents": 0, "lastEventDateTime": "2021-05-17T14:58:28.483Z", "lastProcessedEventDateTime": "2021-05-17T14:58:28.483Z", "processedEvents": 12, "remainingEvents": 0, "totalEvents": 12 }, { "sourceId": "http://music.com/source_songs", "projectionId": "http://music.com/es", "delayInSeconds": 0, "discardedEvents": 1, "evaluatedEvents": 13, "failedEvents": 0, "lastEventDateTime": "2021-05-17T14:37:38.397Z", "lastProcessedEventDateTime": "2021-05-17T14:37:38.397Z", "processedEvents": 14, "remainingEvents": 0, "totalEvents": 14 }, { "sourceId": "http://music.com/source_songs", "projectionId": "http://music.com/sparql", "delayInSeconds": 0, "discardedEvents": 1, "evaluatedEvents": 13, "failedEvents": 0, "lastEventDateTime": "2021-05-17T14:37:38.397Z", "lastProcessedEventDateTime": "2021-05-17T14:37:38.397Z", "processedEvents": 14, "remainingEvents": 0, "totalEvents": 14 } ] }
where:
sourceId
- the @id unique value of the sourceprojectionId
- the @id unique value of the projectiontotalEvents
- total number of events for the provided sourceprocessedEvents
- number of events that have been considered by the projectionremainingEvents
- number of events that remain to be considered by the projectiondiscardedEvents
- number of events that have been discarded (were not evaluated due to filters, e.g. did not match schema, tag or type defined in the projection)evaluatedEvents
- number of events that have been used to update the projection indexlastEventDateTime
- timestamp of the last event in the sourcelastProcessedEventDateTime
- timestamp of the last event processed by the projectiondelayInSeconds
- number of seconds between the last processed event timestamp and the last known event timestamp
Fetch indexing
GET /v1/views/{org_label}/{project_label}/{view_id}/offset
Example
- Request
-
source
curl "http://localhost:8080/v1/views/myorg/bands/composite_view/offset"
- Response
-
source
{ "@context": [ "https://bluebrain.github.io/nexus/contexts/metadata.json", "https://bluebrain.github.io/nexus/contexts/search.json", "https://bluebrain.github.io/nexus/contexts/offset.json" ], "_total": 6, "_results": [ { "sourceId": "http://music.com/source_albums", "projectionId": "http://music.com/es", "offset": { "@type": "TimeBasedOffset", "instant": "2021-05-17T14:37:06.919Z", "value": "5abccf70-b71d-11eb-89c5-49f1ca92ec51" } }, { "sourceId": "http://music.com/source_albums", "projectionId": "http://music.com/sparql", "offset": { "@type": "TimeBasedOffset", "instant": "2021-05-17T14:37:06.919Z", "value": "5abccf70-b71d-11eb-89c5-49f1ca92ec51" } }, { "sourceId": "http://music.com/source_bands", "projectionId": "http://music.com/es", "offset": { "@type": "TimeBasedOffset", "instant": "2021-05-17T14:58:28.484Z", "value": "569c1c40-b720-11eb-89c5-49f1ca92ec51" } }, { "sourceId": "http://music.com/source_bands", "projectionId": "http://music.com/sparql", "offset": { "@type": "TimeBasedOffset", "instant": "2021-05-17T14:58:28.484Z", "value": "569c1c40-b720-11eb-89c5-49f1ca92ec51" } }, { "sourceId": "http://music.com/source_songs", "projectionId": "http://music.com/es", "offset": { "@type": "TimeBasedOffset", "instant": "2021-05-17T14:37:38.513Z", "value": "6d91ac10-b71d-11eb-89c5-49f1ca92ec51" } }, { "sourceId": "http://music.com/source_songs", "projectionId": "http://music.com/sparql", "offset": { "@type": "TimeBasedOffset", "instant": "2021-05-17T14:37:38.513Z", "value": "6d91ac10-b71d-11eb-89c5-49f1ca92ec51" } } ] }
where…
sourceId
- @id identifying the view’s source.projectionId
- @id identifying the view’s projection.instant
- timestamp of the last event processed by the views’ projection.value
- the value of the offset.
Fetch projection(s) indexing
GET /v1/views/{org_label}/{project_label}/{view_id}/projections/{projection_id}/offset
where {projection_id}
is the @id value of the projection. The reserved value _
means “every projection”.
Example
- Request
-
source
curl "http://localhost:8080/v1/views/myorg/bands/composite_view/projections/music:es/offset"
- Response
-
source
{ "@context": [ "https://bluebrain.github.io/nexus/contexts/metadata.json", "https://bluebrain.github.io/nexus/contexts/search.json", "https://bluebrain.github.io/nexus/contexts/offset.json" ], "_total": 3, "_results": [ { "sourceId": "http://music.com/source_albums", "projectionId": "http://music.com/es", "offset": { "@type": "TimeBasedOffset", "instant": "2021-05-17T14:37:06.919Z", "value": "5abccf70-b71d-11eb-89c5-49f1ca92ec51" } }, { "sourceId": "http://music.com/source_bands", "projectionId": "http://music.com/es", "offset": { "@type": "TimeBasedOffset", "instant": "2021-05-17T14:58:28.484Z", "value": "569c1c40-b720-11eb-89c5-49f1ca92ec51" } }, { "sourceId": "http://music.com/source_songs", "projectionId": "http://music.com/es", "offset": { "@type": "TimeBasedOffset", "instant": "2021-05-17T14:37:38.513Z", "value": "6d91ac10-b71d-11eb-89c5-49f1ca92ec51" } } ] }
where…
sourceId
- @id identifying the view’s source.projectionId
- @id identifying the view’s projection.instant
- timestamp of the last event processed by the views’ projection.value
- the value of the offset.
Restart indexing
This endpoint restarts the view indexing process. It does not delete the created indices/namespaces but it overrides the graphs/documents when going through the event log.
DELETE /v1/views/{org_label}/{project_label}/{view_id}/offset
Example
- Request
-
source
curl -X DELETE \ "http://localhost:8080/v1/views/myorg/bands/composite_view/offset"
- Response
-
source
{ "@context": [ "https://bluebrain.github.io/nexus/contexts/metadata.json", "https://bluebrain.github.io/nexus/contexts/search.json", "https://bluebrain.github.io/nexus/contexts/offset.json" ], "_total": 6, "_results": [ { "sourceId": "http://music.com/source_albums", "projectionId": "http://music.com/es", "offset": { "@type": "NoOffset" } }, { "sourceId": "http://music.com/source_albums", "projectionId": "http://music.com/sparql", "offset": { "@type": "NoOffset" } }, { "sourceId": "http://music.com/source_bands", "projectionId": "http://music.com/es", "offset": { "@type": "NoOffset" } }, { "sourceId": "http://music.com/source_bands", "projectionId": "http://music.com/sparql", "offset": { "@type": "NoOffset" } }, { "sourceId": "http://music.com/source_songs", "projectionId": "http://music.com/es", "offset": { "@type": "NoOffset" } }, { "sourceId": "http://music.com/source_songs", "projectionId": "http://music.com/sparql", "offset": { "@type": "NoOffset" } } ] }
Restart projection(s) indexing
This endpoint restarts indexing process for the provided projection(s) while keeping the sources (and the intermediate Sparql space) progress.
DELETE /v1/views/{org_label}/{project_label}/{view_id}/projections/{projection_id}/offset
Example
- Request
-
source
curl -X DELETE \ "http://localhost:8080/v1/views/myorg/bands/composite_view/offset"
- Response
-
source
{ "@context": [ "https://bluebrain.github.io/nexus/contexts/metadata.json", "https://bluebrain.github.io/nexus/contexts/search.json", "https://bluebrain.github.io/nexus/contexts/offset.json" ], "_total": 6, "_results": [ { "sourceId": "http://music.com/source_albums", "projectionId": "http://music.com/es", "offset": { "@type": "NoOffset" } }, { "sourceId": "http://music.com/source_albums", "projectionId": "http://music.com/sparql", "offset": { "@type": "NoOffset" } }, { "sourceId": "http://music.com/source_bands", "projectionId": "http://music.com/es", "offset": { "@type": "NoOffset" } }, { "sourceId": "http://music.com/source_bands", "projectionId": "http://music.com/sparql", "offset": { "@type": "NoOffset" } }, { "sourceId": "http://music.com/source_songs", "projectionId": "http://music.com/es", "offset": { "@type": "NoOffset" } }, { "sourceId": "http://music.com/source_songs", "projectionId": "http://music.com/sparql", "offset": { "@type": "NoOffset" } } ] }
Restart projection
This endpoint restarts indexing process for the provided projection while keeping the sources (and the intermediate Sparql space) progress.
DELETE /v1/views/{org_label}/{project_label}/{view_id}/projections/{projection_id}/offset
where {projection_id}
is the @id value of the projection. The reserved value _
means “every projection”.
Example
- Request
-
source
curl -X DELETE \ "http://localhost:8080/v1/views/myorg/bands/composite_view/projections/music:es/offset"
- Response
-
source
{ "@context": [ "https://bluebrain.github.io/nexus/contexts/metadata.json", "https://bluebrain.github.io/nexus/contexts/search.json", "https://bluebrain.github.io/nexus/contexts/offset.json" ], "_total": 3, "_results": [ { "sourceId": "http://music.com/source_albums", "projectionId": "http://music.com/es", "offset": { "@type": "NoOffset" } }, { "sourceId": "http://music.com/source_bands", "projectionId": "http://music.com/es", "offset": { "@type": "NoOffset" } }, { "sourceId": "http://music.com/source_songs", "projectionId": "http://music.com/es", "offset": { "@type": "NoOffset" } } ] }