LBDserver API
Documentation for the LBDserver project running on the Solid Community Server. LBDserver is a project for managing Linked Building Data, using both RDF and non-RDF resources. To make the LBDserver infrastructure federated, we base upon on the (WIP) Community Solid Server prototype. Note that both the CSS as this API functions are still higly experimental. The API is used, amongst others, in the LBDserver frontend conSOlid prototype.
Installation
Install the package with NPM:
$ npm install lbd-solid
Functions
-
login(oidcIssuer, redirectUrl, session) ⇒
Promise.<Session>
-
Log in using OIDC and a Solid Session.
-
register(oidcIssuer, redirecturi, session) ⇒
Promise.<Session>
-
Log in using OIDC and a Solid Session.
-
processSession(session) ⇒
Promise.<Session>
-
Helper function to process the session after OIDC login. Retrieves the "code" from the current uri.
-
logout(session) ⇒
Promise.<Session>
-
Log out from a Solid Session.
-
createProject(stakeholders, session) ⇒
Promise.<ICreateProject>
-
Create a new project environment. As the project ID is created here, the project metadata graph (.props) should be created afterwards (createGraph)
-
deleteProject(uri, session) ⇒
Promise.<void>
-
Delete an LBD project. The project will only be deleted in your own POD, of course.
-
getUserProjects(session) ⇒
Promise.<Array.<IReturnProject>>
-
Get all the LBD projects in the POD of the authenticated user.
-
getOneProject(uri, session) ⇒
Promise.<IReturnProject>
-
Get a single project by its uri. From your local project, other stakeholders are determined and the federated project data you have access to is fetched.
-
getLocalProject(uri, session) ⇒
Promise.<IReturnProject>
-
Get only the project data residing in your POD.
-
getProjectResources(uri, session) ⇒
Promise.<IReturnResources>
-
Gets only the graphs and documents, without other project info (i.e. their metadata & permissions)
-
getOpenProjects(lbdLocation) ⇒
Promise.<Array.<IReturnProject>>
-
Get the open projects on a specific LBDlocation.
-
uploadResource(url, data, options, session) ⇒
Promise.<void>
-
Upload a resource to your POD. You may also use uploadGraph and uploadDocument.
-
getResource(uri, session) ⇒
Promise.<any>
-
Get a resource actual data.
-
getResourceMetadata(uri, session) ⇒
Promise.<IReturnMetadata>
-
Get a resource's metadata
-
uploadGraph(url, data, metadata, options, session) ⇒
Promise.<IReturnMetadata>
-
Upload a graph (TTL) to your POD.
-
uploadDocument(url, data, metadata, options, session) ⇒
Promise.<IReturnMetadata>
-
Upload a non-RDF resource to your POD.
-
deleteResource(url, session) ⇒
Promise.<void>
-
Delete a resource
-
deleteGraph(url, session) ⇒
Promise.<void>
-
Delete an RDF resource and its metadata
-
deleteDocument(url, session) ⇒
Promise.<void>
-
Delete an non-RDF resource and its metadata
-
createContainer(url, session) ⇒
Promise.<void>
-
Create a container with a given url
-
getContainerContent(url, session) ⇒
Promise.<{containers: Array.<string>, resources: Array.<string>}>
-
Get the content of the container as an object with a list of resources and subcontainers.
-
uploadMetadataGraph(url, data, options, session) ⇒
Promise.<void>
-
Upload the metadata graph for a given resource. Metadata graph urls will end with ".props".
-
query(query, graphs, session) ⇒
Promise.<Array.<IQueryResult>>
-
Query (SPARQL SELECT) a (set of) resource(s) with Comunica. As for now, only openly accessible graphs (i.e. Read permissions) can be queried
-
getPermissions(url, session) ⇒
Promise.<Array.<PermissionType>>
-
Get the permissions for a specific resource. Placeholder until implemented (depends on authenticated or not). Only for UI purposes.
-
getLbdLocation(webId, session) ⇒
Promise.<string>
-
Get the location where LBD projects are stored. At this point, standard './lbd/' will be returned. Later phases may include more complex mechanisms such as Shape Tree discovery or Index Types. Authenticated sessions may thus be required in the future.
-
checkExistence(url, session) ⇒
Promise.<boolean>
-
Check the existence of a resource (HEAD request to the given URL)
Promise.<Session>
login(oidcIssuer, redirectUrl, session) ⇒ Log in using OIDC and a Solid Session.
Kind: global function
Returns: Promise.<Session>
- Returns a Solid Session object
Param | Type | Description |
---|---|---|
oidcIssuer | string |
uri for the OIDC issuer. E.g. 'https://broker.pod.inrupt.com'. |
redirectUrl | string |
uri for redirect after login via OIDC. E.g. window.location.href. to return to the original page. |
session | Session |
The solid session object. Will be returned, but if successful, the session will be authenticated and linked to the logged in user/webID. |
Promise.<Session>
register(oidcIssuer, redirecturi, session) ⇒ Log in using OIDC and a Solid Session.
Kind: global function
Returns: Promise.<Session>
- Returns a Solid Session object
Param | Type | Description |
---|---|---|
oidcIssuer | string |
uri for the OIDC issuer. E.g. 'https://broker.pod.inrupt.com'. |
redirecturi | string |
uri for redirect after login via OIDC. E.g. window.location.href. to return to the original page. |
session | Session |
The solid session object. Will be returned, but if successful, the session will be authenticated and linked to the logged in user/webID. |
Promise.<Session>
processSession(session) ⇒ Helper function to process the session after OIDC login. Retrieves the "code" from the current uri.
Kind: global function
Returns: Promise.<Session>
- Returns a Solid Session object
Param | Type | Description |
---|---|---|
session | Session |
The Solid Session object. |
Promise.<Session>
logout(session) ⇒ Log out from a Solid Session.
Kind: global function
Returns: Promise.<Session>
- Returns a Solid Session object
Param | Type | Description |
---|---|---|
session | Session |
The Solid Session object. |
Promise.<ICreateProject>
createProject(stakeholders, session) ⇒ Create a new project environment. As the project ID is created here, the project metadata graph (.props) should be created afterwards (createGraph)
Kind: global function
Param | Type | Description |
---|---|---|
stakeholders | Array.<IAgent> |
Array of stakeholders to be involved in the project, as well as their access rights to the project in general. |
session | Session |
The Solid Session object. |
Promise.<void>
deleteProject(uri, session) ⇒ Delete an LBD project. The project will only be deleted in your own POD, of course.
Kind: global function
Param | Type | Description |
---|---|---|
uri | string |
The uri of the project to delete in your repository. |
session | Session |
The Solid Session object. |
Promise.<Array.<IReturnProject>>
getUserProjects(session) ⇒ Get all the LBD projects in the POD of the authenticated user.
Kind: global function
Param | Type | Description |
---|---|---|
session | Session |
The Solid Session object. |
Promise.<IReturnProject>
getOneProject(uri, session) ⇒ Get a single project by its uri. From your local project, other stakeholders are determined and the federated project data you have access to is fetched.
Kind: global function
Param | Type | Description |
---|---|---|
uri | string |
The uri of the project. |
session | Session |
The Solid Session object. |
Promise.<IReturnProject>
getLocalProject(uri, session) ⇒ Get only the project data residing in your POD.
Kind: global function
Param | Type | Description |
---|---|---|
uri | string |
The uri of the project. |
session | Session |
The Solid Session object. |
Promise.<IReturnResources>
getProjectResources(uri, session) ⇒ Gets only the graphs and documents, without other project info (i.e. their metadata & permissions)
Kind: global function
Param | Type | Description |
---|---|---|
uri | string |
The uri of the project. |
session | Session |
The Solid Session object. |
Promise.<Array.<IReturnProject>>
getOpenProjects(lbdLocation) ⇒ Get the open projects on a specific LBDlocation.
Kind: global function
Param | Type | Description |
---|---|---|
lbdLocation | string |
The LBD project location to search for open projects |
Promise.<void>
uploadResource(url, data, options, session) ⇒ Upload a resource to your POD. You may also use uploadGraph and uploadDocument.
Kind: global function
Param | Type | Description |
---|---|---|
url | string |
the to-be url of the resource |
data |
Buffer | string
|
The data to be uploaded. Can be a buffer or a plain string. |
options | Object |
Upload options |
[options.overwrite] | boolean |
Whether the resource is an existing object that should be overwritten. |
[options.mimeType] | string |
The mimetype of the resource. If not passed, the mimetype is guessed by the extension. If this files, the mimetype is st to 'text/plain'. |
session | Session |
The Solid session object |
Promise.<any>
getResource(uri, session) ⇒ Get a resource actual data.
Kind: global function
Param | Type | Description |
---|---|---|
uri | string |
The uri of the project. |
session | Session |
The Solid Session object. |
Promise.<IReturnMetadata>
getResourceMetadata(uri, session) ⇒ Get a resource's metadata
Kind: global function
Param | Type | Description |
---|---|---|
uri | string |
The uri of the project. |
session | Session |
The Solid Session object. |
Promise.<IReturnMetadata>
uploadGraph(url, data, metadata, options, session) ⇒ Upload a graph (TTL) to your POD.
Kind: global function
Param | Type | Description |
---|---|---|
url | string |
the to-be url of the resource |
data |
Buffer | string
|
The data to be uploaded. Can be a buffer or a plain string. |
metadata | string |
The metadata graph as Turtle. |
options | Object |
Upload options |
options.overwrite | boolean |
Whether the resource is an existing object that should be overwritten. |
[options.mimeType] | string |
The mimetype of the resource. If not passed, the mimetype is guessed by the extension. If this files, the mimetype is st to 'text/plain'. |
session | Session |
The Solid session object |
Promise.<IReturnMetadata>
uploadDocument(url, data, metadata, options, session) ⇒ Upload a non-RDF resource to your POD.
Kind: global function
Param | Type | Description |
---|---|---|
url | string |
the to-be url of the resource |
data |
Buffer | string
|
The data to be uploaded. Can be a buffer or a plain string. |
metadata | string |
The metadata graph as Turtle. |
options | Object |
Upload options |
options.overwrite | boolean |
Whether the resource is an existing object that should be overwritten. |
[options.mimeType] | string |
The mimetype of the resource. If not passed, the mimetype is guessed by the extension. If this files, the mimetype is st to 'text/plain'. |
session | Session |
The Solid session object |
Promise.<void>
deleteResource(url, session) ⇒ Delete a resource
Kind: global function
Param | Type | Description |
---|---|---|
url | string |
The url of the resource to be deleted |
session | Session |
The Solid session object |
Promise.<void>
deleteGraph(url, session) ⇒ Delete an RDF resource and its metadata
Kind: global function
Param | Type | Description |
---|---|---|
url | string |
The url of the resource to be deleted |
session | Session |
The Solid session object |
Promise.<void>
deleteDocument(url, session) ⇒ Delete an non-RDF resource and its metadata
Kind: global function
Param | Type | Description |
---|---|---|
url | string |
The url of the resource to be deleted |
session | Session |
The Solid session object |
Promise.<void>
createContainer(url, session) ⇒ Create a container with a given url
Kind: global function
Param | Type | Description |
---|---|---|
url | string |
The url of the container to be created |
session | Session |
The Solid session object |
Promise.<{containers: Array.<string>, resources: Array.<string>}>
getContainerContent(url, session) ⇒ Get the content of the container as an object with a list of resources and subcontainers.
Kind: global function
Param | Type | Description |
---|---|---|
url | string |
The url of the container |
session | Session |
The Solid session object |
Promise.<void>
uploadMetadataGraph(url, data, options, session) ⇒ Upload the metadata graph for a given resource. Metadata graph urls will end with ".props".
Kind: global function
Param | Type | Description |
---|---|---|
url | string |
The url of the resource (if it doesn't end with ".props", the suffix is added automatically) |
data | string |
The metadata as Turtle |
options | Object |
Options for uploading |
options.overwrite | boolean |
Whether the resource is an existing object that should be overwritten. |
[options.mimeType] | string |
The mimetype of the resource. If not passed, the mimetype is guessed by the extension. If this files, the mimetype is st to 'text/plain'. |
session | Session |
The Solid session object |
Promise.<Array.<IQueryResult>>
query(query, graphs, session) ⇒ Query (SPARQL SELECT) a (set of) resource(s) with Comunica. As for now, only openly accessible graphs (i.e. Read permissions) can be queried
Kind: global function
Param | Type | Description |
---|---|---|
query | string |
The SPARQL query string |
graphs | Array.<string> |
The resources to be queried as an Array |
session | Session |
The Solid session object |
Promise.<Array.<PermissionType>>
getPermissions(url, session) ⇒ Get the permissions for a specific resource. Placeholder until implemented (depends on authenticated or not). Only for UI purposes.
Kind: global function
Param | Type | Description |
---|---|---|
url | string |
The url |
session | Session |
The Solid session object |
Promise.<string>
getLbdLocation(webId, session) ⇒ Get the location where LBD projects are stored. At this point, standard './lbd/' will be returned. Later phases may include more complex mechanisms such as Shape Tree discovery or Index Types. Authenticated sessions may thus be required in the future.
Kind: global function
Param | Type | Description |
---|---|---|
webId | string |
The web id to find the LBD location for. |
session | Session |
The Solid session object |
Promise.<boolean>
checkExistence(url, session) ⇒ Check the existence of a resource (HEAD request to the given URL)
Kind: global function
Param | Type | Description |
---|---|---|
url | string |
The url of the resource |
session | Session |
The Solid session object |