lbd-solid
v0.1.1
Published
API documentation to communicate with the LBDserver backend.
Downloads
9
Readme
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.
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. |
register(oidcIssuer, redirecturi, session) ⇒ Promise.<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. |
processSession(session) ⇒ Promise.<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. |
logout(session) ⇒ Promise.<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. |
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)
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. |
deleteProject(uri, session) ⇒ Promise.<void>
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. |
getUserProjects(session) ⇒ Promise.<Array.<IReturnProject>>
Get all the LBD projects in the POD of the authenticated user.
Kind: global function
| Param | Type | Description | | --- | --- | --- | | session | Session | The Solid Session object. |
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.
Kind: global function
| Param | Type | Description | | --- | --- | --- | | uri | string | The uri of the project. | | session | Session | The Solid Session object. |
getLocalProject(uri, session) ⇒ Promise.<IReturnProject>
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. |
getProjectResources(uri, session) ⇒ Promise.<IReturnResources>
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. |
getOpenProjects(lbdLocation) ⇒ Promise.<Array.<IReturnProject>>
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 |
uploadResource(url, data, options, session) ⇒ Promise.<void>
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 |
getResource(uri, session) ⇒ Promise.<any>
Get a resource actual data.
Kind: global function
| Param | Type | Description | | --- | --- | --- | | uri | string | The uri of the project. | | session | Session | The Solid Session object. |
getResourceMetadata(uri, session) ⇒ Promise.<IReturnMetadata>
Get a resource's metadata
Kind: global function
| Param | Type | Description | | --- | --- | --- | | uri | string | The uri of the project. | | session | Session | The Solid Session object. |
uploadGraph(url, data, metadata, options, session) ⇒ Promise.<IReturnMetadata>
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 |
uploadDocument(url, data, metadata, options, session) ⇒ Promise.<IReturnMetadata>
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 |
deleteResource(url, session) ⇒ Promise.<void>
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 |
deleteGraph(url, session) ⇒ Promise.<void>
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 |
deleteDocument(url, session) ⇒ Promise.<void>
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 |
createContainer(url, session) ⇒ Promise.<void>
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 |
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.
Kind: global function
| Param | Type | Description | | --- | --- | --- | | url | string | The url of the container | | session | Session | The Solid session object |
uploadMetadataGraph(url, data, options, session) ⇒ Promise.<void>
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 |
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
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 |
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.
Kind: global function
| Param | Type | Description | | --- | --- | --- | | url | string | The url | | session | Session | The Solid session object |
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.
Kind: global function
| Param | Type | Description | | --- | --- | --- | | webId | string | The web id to find the LBD location for. | | session | Session | The Solid session object |
checkExistence(url, session) ⇒ Promise.<boolean>
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 |