0.1.1 • Published 3 years ago

lbd-solid v0.1.1

Weekly downloads
3
License
MIT
Repository
github
Last release
3 years ago

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

ParamTypeDescription
oidcIssuerstringuri for the OIDC issuer. E.g. 'https://broker.pod.inrupt.com'.
redirectUrlstringuri for redirect after login via OIDC. E.g. window.location.href. to return to the original page.
sessionSessionThe 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

ParamTypeDescription
oidcIssuerstringuri for the OIDC issuer. E.g. 'https://broker.pod.inrupt.com'.
redirecturistringuri for redirect after login via OIDC. E.g. window.location.href. to return to the original page.
sessionSessionThe 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

ParamTypeDescription
sessionSessionThe Solid Session object.

logout(session) ⇒ Promise.<Session>

Log out from a Solid Session.

Kind: global function
Returns: Promise.<Session> - Returns a Solid Session object

ParamTypeDescription
sessionSessionThe 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

ParamTypeDescription
stakeholdersArray.<IAgent>Array of stakeholders to be involved in the project, as well as their access rights to the project in general.
sessionSessionThe 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

ParamTypeDescription
uristringThe uri of the project to delete in your repository.
sessionSessionThe Solid Session object.

getUserProjects(session) ⇒ Promise.<Array.<IReturnProject>>

Get all the LBD projects in the POD of the authenticated user.

Kind: global function

ParamTypeDescription
sessionSessionThe 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

ParamTypeDescription
uristringThe uri of the project.
sessionSessionThe Solid Session object.

getLocalProject(uri, session) ⇒ Promise.<IReturnProject>

Get only the project data residing in your POD.

Kind: global function

ParamTypeDescription
uristringThe uri of the project.
sessionSessionThe 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

ParamTypeDescription
uristringThe uri of the project.
sessionSessionThe Solid Session object.

getOpenProjects(lbdLocation) ⇒ Promise.<Array.<IReturnProject>>

Get the open projects on a specific LBDlocation.

Kind: global function

ParamTypeDescription
lbdLocationstringThe 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

ParamTypeDescription
urlstringthe to-be url of the resource
dataBuffer | stringThe data to be uploaded. Can be a buffer or a plain string.
optionsObjectUpload options
options.overwritebooleanWhether the resource is an existing object that should be overwritten.
options.mimeTypestringThe mimetype of the resource. If not passed, the mimetype is guessed by the extension. If this files, the mimetype is st to 'text/plain'.
sessionSessionThe Solid session object

getResource(uri, session) ⇒ Promise.<any>

Get a resource actual data.

Kind: global function

ParamTypeDescription
uristringThe uri of the project.
sessionSessionThe Solid Session object.

getResourceMetadata(uri, session) ⇒ Promise.<IReturnMetadata>

Get a resource's metadata

Kind: global function

ParamTypeDescription
uristringThe uri of the project.
sessionSessionThe Solid Session object.

uploadGraph(url, data, metadata, options, session) ⇒ Promise.<IReturnMetadata>

Upload a graph (TTL) to your POD.

Kind: global function

ParamTypeDescription
urlstringthe to-be url of the resource
dataBuffer | stringThe data to be uploaded. Can be a buffer or a plain string.
metadatastringThe metadata graph as Turtle.
optionsObjectUpload options
options.overwritebooleanWhether the resource is an existing object that should be overwritten.
options.mimeTypestringThe mimetype of the resource. If not passed, the mimetype is guessed by the extension. If this files, the mimetype is st to 'text/plain'.
sessionSessionThe Solid session object

uploadDocument(url, data, metadata, options, session) ⇒ Promise.<IReturnMetadata>

Upload a non-RDF resource to your POD.

Kind: global function

ParamTypeDescription
urlstringthe to-be url of the resource
dataBuffer | stringThe data to be uploaded. Can be a buffer or a plain string.
metadatastringThe metadata graph as Turtle.
optionsObjectUpload options
options.overwritebooleanWhether the resource is an existing object that should be overwritten.
options.mimeTypestringThe mimetype of the resource. If not passed, the mimetype is guessed by the extension. If this files, the mimetype is st to 'text/plain'.
sessionSessionThe Solid session object

deleteResource(url, session) ⇒ Promise.<void>

Delete a resource

Kind: global function

ParamTypeDescription
urlstringThe url of the resource to be deleted
sessionSessionThe Solid session object

deleteGraph(url, session) ⇒ Promise.<void>

Delete an RDF resource and its metadata

Kind: global function

ParamTypeDescription
urlstringThe url of the resource to be deleted
sessionSessionThe Solid session object

deleteDocument(url, session) ⇒ Promise.<void>

Delete an non-RDF resource and its metadata

Kind: global function

ParamTypeDescription
urlstringThe url of the resource to be deleted
sessionSessionThe Solid session object

createContainer(url, session) ⇒ Promise.<void>

Create a container with a given url

Kind: global function

ParamTypeDescription
urlstringThe url of the container to be created
sessionSessionThe 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

ParamTypeDescription
urlstringThe url of the container
sessionSessionThe 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

ParamTypeDescription
urlstringThe url of the resource (if it doesn't end with ".props", the suffix is added automatically)
datastringThe metadata as Turtle
optionsObjectOptions for uploading
options.overwritebooleanWhether the resource is an existing object that should be overwritten.
options.mimeTypestringThe mimetype of the resource. If not passed, the mimetype is guessed by the extension. If this files, the mimetype is st to 'text/plain'.
sessionSessionThe 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

ParamTypeDescription
querystringThe SPARQL query string
graphsArray.<string>The resources to be queried as an Array
sessionSessionThe 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

ParamTypeDescription
urlstringThe url
sessionSessionThe 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

ParamTypeDescription
webIdstringThe web id to find the LBD location for.
sessionSessionThe Solid session object

checkExistence(url, session) ⇒ Promise.<boolean>

Check the existence of a resource (HEAD request to the given URL)

Kind: global function

ParamTypeDescription
urlstringThe url of the resource
sessionSessionThe Solid session object