Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Stardog JavaScript Framework for node.js and the browser - Develop apps using the Stardog RDF Database & JS.
Universal Javascript fetch wrapper for communicating with the Stardog HTTP server.
This framework wraps all the functionality of a client for the Stardog DBMS, and provides access to a full set of functions such as executing SPARQL queries, administrative tasks on Stardog, and the use of the Reasoning API.
All the implementation uses the HTTP protocol, since most of Stardog functionality is available using this protocol. For more information, go to the Stardog's HTTP Programming documentation.
This is a universal library and as such can be used in both the browser and Node.js.
To install stardog.js run:
npm install stardog
Stardog.js conforms to the Universal Module Definition API. To use it in Node.js, simply require
or import
it as you would any other Node module. To use it in the browser, you can either:
<script src="./node_modules/stardog/dist/stardog.js"></script>
) and then reference the global stardogjs
object (e.g., stardogjs.query.execute(/* . . . */)
).To get started, just clone the project. You'll need a local copy of Stardog to be able to run the tests. For more information on starting the Stardog DB service and how it works, go to Stardog's documentation, where you'll find everything you need to get up and running with Stardog.
Go to http://stardog.com, download and install the database and load the data provided in data/
using the script in the repository.
stardog-admin server start
stardog.js
dependencies:npm install
In order to contribute changes, all test cases must pass. With the Stardog server running, execute the following command to run all test cases in test/spec
:
npm test
To test the cluster commands you will need to first start a Stardog cluster then run the cluster suite. The easiest way to do this is to run docker-compose to start a cluster:
docker-compose -f .circleci/docker-compose.yml up
Then run the cluster test suite in test/cluster
:
npm run test:cluster
Fork, clone and develop, write or amend tests, and then open a PR. All PRs go against "master". This project uses prettier on file commit, so don't worry about style as it'll just get rewritten when you commit your changes.
First, ensure that there is a milstone for the release version, and that all PRs that you want to appear in the CHANGELOG are tagged with that milestone. The milestone must be closed before publishing.
If you have publishing rights, BE SURE TO RUN npm version (major|minor|patch)
IMMEDIATELY BEFORE PUBLISHING. This will ensure that the build is up-to-date and will also (1) bump the version number in package.json accordingly, (2) create a git tag matching the version number, and (3) automatically update the README and the CHANGELOG using our type declarations and data from the stardog.js GitHub repo. For this process to work correctly, you will need to have generated a GitHub OAuth token and assigned it to the MDCHANGELOG_TOKEN
environment variable (the name of the token is a relic of the fact that this repo once used mdchangelog to generate changelogs; it now uses a custom script). You can then publish by running npm publish
. In order to ensure that this process is followed, there will be a very annoying alert triggered whenever you publish; if you're all set, just ignore the alert.
After releasing, be sure to push to master, including the tags (so that the release is reflected on GitHub).
Each release of stardog.js is tested against the most recent version of Stardog available at the time of the release. The relationship between versions of stardog.js and versions of Stardog is detailed in the following table:
stardog.js Version | Supported Stardog Version(s) |
---|---|
6.x.x | 10.x.x |
5.x.x | 9.x.x |
4.x.x | 8.x.x |
3.x.x | 7.x.x |
2.x.x* | 6.x.x |
1.x.x* | 5.x.x |
0.x.x* | any version < 5 |
* = No longer supported
We support and maintain a particular version of stardog.js only if the corresponding Stardog version(s) is (are) officially supported and maintained. For example, we no longer support v0.x.x of stardog.js, as the corresponding Stardog versions are no longer supported. (That said, later versions of stardog.js will often mostly work with earlier Stardog versions. We just don't test this or make any guarantees to that effect.)
const { Connection, query } = require('stardog');
const conn = new Connection({
username: 'admin',
password: 'admin',
endpoint: 'http://localhost:5820',
});
query
.execute(
conn,
'myDatabaseName',
'select distinct ?s where { ?s ?p ?o }',
'application/sparql-results+json',
{
limit: 10,
reasoning: true,
offset: 0,
}
)
.then(({ body }) => {
console.log(body.results.bindings);
});
One of the following values:
'application/ld+json' | 'text/turtle' | 'application/rdf+xml' | 'application/n-triples' | 'application/n-quads' | 'application/trig'
One of the following values:
'application/sparql-results+json' | 'application/sparql-results+xml'
One of the following values:
RdfMimeType | SparqlMimeType | 'text/plain' | 'text/boolean' | 'application/json' | '*/*'
One of the following values:
'text/plain' | 'application/json'
Object with the following values:
number
)string
)object | string | boolean | null
)boolean
)Headers
)any
)string
)Object with the following values:
string
)string
)string
)string
)ConnectionMeta
)One of the following values:
{ new (input: string | Request, init?: RequestInit): Request; }
One of the following values:
({ uri, Request }: { uri: string; Request: Constructor }) => ReturnType
Object with the following values:
RequestCreator<RequestConstructor, string | Request>
)(defaults: { headers: Headers; }) => Headers
)Constructed with:
ConnectionOptions
)Takes the following params:
ConnectionOptions
)ConnectionMeta
)Returns void
Returns Headers
Takes the following params:
string[]
)Returns string
server.shutdown(conn, params)
Shuts down a Stardog server.
Expects the following parameters:
conn (Connection
)
params (object
)
Returns Promise<HTTP.Body>
server.status(conn, params)
Retrieves general status information about a Stardog server. By
default, also includes status information about all databases on
that server. If params.databases
is false
, however, then the
information about databases is omitted.
Expects the following parameters:
conn (Connection
)
params ({ databases?: boolean; }
)
Returns Promise<HTTP.Body>
server.properties(conn, names)
Retrieves server properties. By default, it will return all server
properties, but you can specify names
to return specific ones.
Expects the following parameters:
conn (Connection
)
names (string[]
)
Returns Promise<HTTP.Body>
db.create(conn, database, databaseOptions, options, params)
Creates a new database.
Expects the following parameters:
conn (Connection
)
database (string
)
databaseOptions (object
)
options ({ files: { filename: string}[] }
)
params (object
)
Returns Promise<HTTP.Body>
db.drop(conn, database, params)
Deletes a database.
Expects the following parameters:
conn (Connection
)
database (string
)
params (object
)
Returns Promise<HTTP.Body>
db.get(conn, database, params)
Gets an RDF representation of a database. See: https://www.w3.org/TR/sparql11-http-rdf-update/#http-get
Expects the following parameters:
conn (Connection
)
database (string
)
params (object
)
Returns Promise<HTTP.Body>
db.offline(conn, database, params)
Sets a database offline.
Expects the following parameters:
conn (Connection
)
database (string
)
params (object
)
Returns Promise<HTTP.Body>
db.online(conn, database, params)
Sets a database online.
Expects the following parameters:
conn (Connection
)
database (string
)
params (object
)
Returns Promise<HTTP.Body>
db.optimize(conn, database, params)
Optimizes a database.
Expects the following parameters:
conn (Connection
)
database (string
)
params (object
)
Returns Promise<HTTP.Body>
db.list(conn, params)
Gets a list of all databases on a Stardog server.
Expects the following parameters:
conn (Connection
)
params (object
)
Returns Promise<HTTP.Body>
db.listInfo(conn, params)
Gets a list of databases info on a Stardog server.
Expects the following parameters:
conn (Connection
)
params (object
)
Returns Promise<HTTP.Body>
db.size(conn, database, params)
Gets number of triples in a database.
Expects the following parameters:
conn (Connection
)
database (string
)
params (object
)
Returns Promise<HTTP.Body>
db.model(conn, database, options, params)
Gets the model for a database.
Expects the following parameters:
conn (Connection
)
database (string
)
options (object
)
params (object
)
Returns Promise<HTTP.Body>
db.clear(conn, database, transactionId, params)
Clears the contents of a database.
Expects the following parameters:
conn (Connection
)
database (string
)
transactionId (string
)
params (object
)
Returns Promise<HTTP.Body>
db.add(conn, database, transactionId, content, options, params)
Adds data within a transaction.
Expects the following parameters:
conn (Connection
)
database (string
)
transactionId (string
)
content (string
)
options (TransactionOptions
)
params (object
)
Returns Promise<transaction.TransactionResponse>
db.remove(conn, database, transactionId, content, options, params)
Removes data within a transaction.
Expects the following parameters:
conn (Connection
)
database (string
)
transactionId (string
)
content (string
)
options (TransactionOptions
)
params (object
)
Returns Promise<transaction.TransactionResponse>
db.exportData(conn, database, options, params)
Exports the contents of a database.
Expects the following parameters:
conn (Connection
)
database (string
)
options ({ mimetype: RdfMimeType
})
params ({ graphUri: string }
)
Returns Promise<HTTP.Body>
db.options.getAvailable(conn)
Gets all available database options with their default values.
Expects the following parameters:
Connection
)Returns Promise<HTTP.Body>
db.options.get(conn, database, params)
Gets set of options on a database.
Expects the following parameters:
conn (Connection
)
database (string
)
params (object
)
Returns Promise<HTTP.Body>
db.options.getAll(conn, database)
Gets all options on a database.
Expects the following parameters:
conn (Connection
)
database (string
)
Returns Promise<HTTP.Body>
db.options.set(conn, database, databaseOptions, params)
Sets options on a database.
Expects the following parameters:
conn (Connection
)
database (string
)
databaseOptions (object
)
params (object
)
Returns Promise<HTTP.Body>
db.graph.doGet(conn, database, graphUri, accept, params)
Retrieves the specified named graph
Expects the following parameters:
conn (Connection
)
database (string
)
graphUri (string
)
accept (RdfMimeType
)
params (object
)
Returns Promise<HTTP.Body>
db.graph.doPut(conn, database, graphData, graphUri, contentType, params)
Stores the given RDF data in the specified named graph
Expects the following parameters:
conn (Connection
)
database (string
)
graphData (string
)
graphUri (string
)
contentType (RdfMimeType
)
params (object
)
Returns Promise<HTTP.Body>
db.graph.doDelete(conn, database, graphUri, params)
Deletes the specified named graph
Expects the following parameters:
conn (Connection
)
database (string
)
graphUri (string
)
params (object
)
Returns Promise<HTTP.Body>
db.graph.doPost(conn, database, graphUri, options, params)
Merges the given RDF data into the specified named graph
Expects the following parameters:
conn (Connection
)
database (string
)
graphUri (string
)
options ({ contentType: RdfMimeType
})
params (object
)
Returns Promise<HTTP.Body>
One of the following values:
'gzip' | 'compress' | 'deflate' | 'identity' | 'br'
Object with the following values:
string
)Object with the following values:
HTTP.RdfMimeType
)Encodings
)db.transaction.begin(conn, database, params)
Begins a new transaction.
Expects the following parameters:
conn (Connection
)
database (string
)
params (object
)
Returns Promise<TransactionResponse>
db.transaction.rollback(conn, database, transactionId, params)
Rolls back a transaction, removing the transaction and undoing all changes
Expects the following parameters:
conn (Connection
)
database (string
)
transactionId (string
)
params (object
)
Returns Promise<TransactionResponse>
db.transaction.commit(conn, database, transactionId, params)
Commits a transaction to the database, removing the transaction and making its changes permanent.
Expects the following parameters:
conn (Connection
)
database (string
)
transactionId (string
)
params (object
)
Returns Promise<TransactionResponse>
db.icv.get(conn, database, params)
Gets the set of integrity constraints on a given database.
Expects the following parameters:
conn (Connection
)
database (string
)
params (object
)
Returns Promise<HTTP.Body>
db.icv.add(conn, database, icvAxioms, options, params)
Adds integrity constraints to a given database.
DEPRECATED: Support for storing ICV constraints in the system database is deprecated in Stardog 7.5.0
and removed in Stardog 8.0.0; instead, SHACL constraints can be managed using db.add
.
Expects the following parameters:
conn (Connection
)
database (string
)
icvAxioms (string
)
options ({ contentType: RdfMimeType
})
params (object
)
Returns Promise<HTTP.Body>
db.icv.remove(conn, database, icvAxioms, options, params)
Removes integrity constraints from a given database.
DEPRECATED: Support for storing ICV constraints in the system database is deprecated in Stardog 7.5.0
and removed in Stardog 8.0.0; instead, SHACL constraints can be managed using db.remove
.
Expects the following parameters:
conn (Connection
)
database (string
)
icvAxioms (string
)
options ({ contentType: RdfMimeType
})
params (object
)
Returns Promise<HTTP.Body>
db.icv.clear(conn, database, params)
Removes all integrity constraints from a given database.
DEPRECATED: Support for storing ICV constraints in the system database is deprecated in Stardog 7.5.0
and removed in Stardog 8.0.0; instead, SHACL constraints can be managed using db.remove
.
Expects the following parameters:
conn (Connection
)
database (string
)
params (object
)
Returns Promise<HTTP.Body>
db.icv.validate(conn, database, constraints, options, params)
Checks constraints to see if they are valid
Expects the following parameters:
conn (Connection
)
database (string
)
constraints (string
)
options ({ contentType: RdfMimeType
})
params ({ graphUri: string }
)
Returns Promise<HTTP.Body>
db.icv.validateInTx(conn, database, transactionId, constraints, options, params)
Checks constraints to see if they are valid within a transaction
Expects the following parameters:
conn (Connection
)
database (string
)
transactionId (string
)
constraints (string
)
options ({ contentType: RdfMimeType
})
params ({ graphUri: string }
)
Returns Promise<HTTP.Body>
db.icv.violations(conn, database, constraints, options, params)
Accepts integrity constraints as RDF and returns the violation explanations, if any, as RDF.
Expects the following parameters:
conn (Connection
)
database (string
)
constraints (string
)
options ({ contentType: RdfMimeType
})
params ({ graphUri: string }
)
Returns Promise<HTTP.Body>
db.icv.violationsInTx(conn, database, transactionId, constraints, options, params)
Accepts integrity constraints as RDF and returns the violation explanations, if any, as RDF.
Expects the following parameters:
conn (Connection
)
database (string
)
transactionId (string
)
constraints (string
)
options ({ contentType: RdfMimeType
})
params ({ graphUri: string }
)
Returns Promise<HTTP.Body>
db.icv.report(conn, database, constraints, options, params)
Accepts integrity constraints as RDF and returns a validation report.
Expects the following parameters:
conn (Connection
)
database (string
)
constraints (string
)
options ({ contentType?: HTTP.RdfMimeType, accept?: AcceptMimeType
})
params ({ graphUri: string }
)
Returns Promise<HTTP.Body>
db.icv.reportInTx(conn, database, transactionId, constraints, options, params)
Accepts integrity constraints as RDF and returns a validation report.
Expects the following parameters:
conn (Connection
)
database (string
)
transactionId (string
)
constraints (string
)
options ({ contentType?: HTTP.RdfMimeType, accept?: AcceptMimeType
})
params ({ graphUri: string }
)
Returns Promise<HTTP.Body>
db.reasoning.consistency(conn, database, options, params)
Returns if the database is consistent
Expects the following parameters:
conn (Connection
)
database (string
)
options ({ namedGraph: string }
)
params (object
)
Returns Promise<HTTP.Body>
db.reasoning.explainInference(conn, database, inference, config, params)
Provides an explanation for an inference
Expects the following parameters:
conn (Connection
)
database (string
)
inference (string
)
config ({ contentType: string }
)
params (object
)
Returns Promise<HTTP.Body>
db.reasoning.explainInconsistency(conn, database, options, params)
Provides the reason why a database is inconsistent, as reported by db.reasoning.consistency
Expects the following parameters:
conn (Connection
)
database (string
)
options ({ namedGraph: string }
)
params (object
)
Returns Promise<HTTP.Body>
db.reasoning.explainInferenceInTransaction(conn, database, transactionId, inference, config, params)
Provides an explanation for an inference within a transaction
Expects the following parameters:
conn (Connection
)
database (string
)
transactionId (string
)
inference (string
)
config (TransactionOptions
)
params (object
)
Returns Promise<HTTP.Body>
db.reasoning.explainInconsistencyInTransaction(conn, database, transactionId, options, params)
Provides the reason why a database is inconsistent, as reported by db.reasoning.consistency
Expects the following parameters:
conn (Connection
)
database (string
)
transactionId (string
)
options ({ namedGraph: string }
)
params (object
)
Returns Promise<HTTP.Body>
db.reasoning.schema(conn, database, params)
Gets the reasoning schema of the database
Expects the following parameters:
conn (Connection
)
database (string
)
params (object
)
Returns Promise<HTTP.Body>
db.docs.size(conn, database, params)
Retrieves the size of the document store
Expects the following parameters:
conn (Connection
)
database (string
)
params (object
)
Returns Promise<HTTP.Body>
db.docs.clear(conn, database, params)
Clears the document store
Expects the following parameters:
conn (Connection
)
database (string
)
params (object
)
Returns Promise<HTTP.Body>
db.docs.add(conn, database, fileName, fileContents, params)
Adds a document to the document store
Expects the following parameters:
conn (Connection
)
database (string
)
fileName (string
)
fileContents (string
)
params (object
)
Returns Promise<HTTP.Body>
db.docs.remove(conn, database, fileName, params)
Removes a document from the document store
Expects the following parameters:
conn (Connection
)
database (string
)
fileName (string
)
params (object
)
Returns Promise<HTTP.Body>
db.docs.get(conn, database, fileName, params)
Retrieves a document from the document store
Expects the following parameters:
conn (Connection
)
database (string
)
fileName (string
)
params (object
)
Returns Promise<HTTP.Body>
db.namespaces.get(conn, database)
Gets a mapping of the namespaces used in a database.
Expects the following parameters:
conn (Connection
)
database (string
)
Returns Promise<HTTP.Body>
db.namespaces.add(conn, database, fileOrContents, options)
Extracts namespaces from an RDF file or RDF string and adds new and updates existing namespaces in the database.
Expects the following parameters:
conn (Connection
)
database (string
)
fileOrContents (object | string
)
options ({ contentType?: RdfMimeType
})
Returns Promise<HTTP.Body>
One of the following values:
'select' | 'ask' | 'construct' | 'describe' | 'validate' | 'update' | 'paths' | null
Object with the following values:
string
)string
)Object with the following values:
(res: Response) => boolean | void
)query.property(conn, database, config, params)
Gets the values for a specific property of a URI individual.
Expects the following parameters:
conn (Connection
)
database (string
)
config (PropertyOptions
)
params (object
)
Returns Promise<HTTP.Body>
query.explain(conn, database, query, accept, params)
Gets the query plan generated by Stardog for a given SPARQL query.
Expects the following parameters:
conn (Connection
)
database (string
)
query (string
)
accept (ExplainAcceptMimeType
)
params (object
)
Returns Promise<HTTP.Body>
query.execute(conn, database, query, accept, params, additionalHandlers)
Executes a query against a database.
Expects the following parameters:
conn (Connection
)
database (string
)
query (string
)
accept (AcceptMimeType
)
params (object
)
additionalHandlers (AdditionalHandlers
)
Returns Promise<HTTP.Body>
query.executeInTransaction(conn, database, transactionId, query, options, params)
Executes a query against a database within a transaction.
Expects the following parameters:
conn (Connection
)
database (string
)
transactionId (string
)
query (string
)
options ({ accept: RdfMimeType
})
params (object
)
Returns Promise<HTTP.Body>
query.list(conn)
Gets a list of actively running queries.
Expects the following parameters:
Connection
)Returns Promise<HTTP.Body>
query.kill(conn, queryId)
Kills an actively running query.
Expects the following parameters:
conn (Connection
)
queryId (string
)
Returns Promise<HTTP.Body>
query.get(conn, queryId)
Gets information about an actively running query.
Expects the following parameters:
conn (Connection
)
queryId (string
)
Returns Promise<HTTP.Body>
Object with the following values:
string
)string
)string
)boolean
)boolean
)boolean
)query.stored.create(conn, storedQuery, options)
Stores a query in Stardog, either on the system level or for a given database.
Expects the following parameters:
conn (Connection
)
storedQuery ([StoredQueryOptions | object
](#storedqueryoptions | object))
options ({ accept?: string, contentType?: string }
)
Returns Promise<HTTP.Body>
query.stored.list(conn, options)
Lists all stored queries.
Expects the following parameters:
conn (Connection
)
options ({ accept?: string }
)
Returns Promise<HTTP.Body>
query.stored.update(conn, storedQuery, options, useUpdateMethod)
Updates a given stored query and creates it if the name does not refer to an existing stored query.
Expects the following parameters:
conn (Connection
)
storedQuery ([StoredQueryOptions | object
](#storedqueryoptions | object))
options ({ accept?: string, contentType?: string }
)
useUpdateMethod (boolean
)
Returns Promise<HTTP.Body>
query.stored.remove(conn, storedQuery)
Removes a given stored query.
Expects the following parameters:
conn (Connection
)
storedQuery (string
)
Returns Promise<HTTP.Body>
query.stored.rename(conn, name, newName)
Renames a given stored query.
Expects the following parameters:
conn (Connection
)
name (string
)
newName (string
)
Returns Promise<HTTP.Body>
query.graphql.execute(conn, database, query, variables, params, additionalHandlers)
Executes a GraphQL query
Expects the following parameters:
conn (Connection
)
database (string
)
query (string
)
variables (object
)
params (object
)
additionalHandlers (AdditionalHandlers
)
Returns Promise<HTTP.Body>
query.graphql.listSchemas(conn, database, params)
Retrieves a list of GraphQL schemas in the database
Expects the following parameters:
conn (Connection
)
database (string
)
params (object
)
Returns Promise<HTTP.Body>
query.graphql.addSchema(conn, database, name, schema, params)
Adds a GraphQL schema to the database
Expects the following parameters:
conn (Connection
)
database (string
)
name (string
)
schema (object
)
params (object
)
Returns Promise<HTTP.Body>
query.graphql.updateSchema(conn, database, name, schema, params)
Updates (or adds if non-existent) a GraphQL schema to the database
Expects the following parameters:
conn (Connection
)
database (string
)
name (string
)
schema (object
)
params (object
)
Returns Promise<HTTP.Body>
query.graphql.getSchema(conn, database, name, params)
Retrieves a GraphQL schema from the database
Expects the following parameters:
conn (Connection
)
database (string
)
name (string
)
params (object
)
Returns Promise<HTTP.Body>
query.graphql.removeSchema(conn, database, name, params)
Removes a GraphQL schemafrom the database
Expects the following parameters:
conn (Connection
)
database (string
)
name (string
)
params (object
)
Returns Promise<HTTP.Body>
query.graphql.clearSchemas(conn, database, params)
Clears all GraphQL schemas in the database
Expects the following parameters:
conn (Connection
)
database (string
)
params (object
)
Returns Promise<HTTP.Body>
query.utils.queryType(query)
Returns the QueryType (as a string or null) for the given query.
Expects the following parameters:
string
)Returns QueryType
query.utils.mimeType(query)
Returns the default HTTP Accept
MIME type for the given query.
Expects the following parameters:
string
)Returns HTTP.AcceptMimeType
Object with the following values:
string
)string
)boolean
)One of the following values:
'CREATE' | 'DELETE' | 'READ' | 'WRITE' | 'GRANT' | 'REVOKE' | 'EXECUTE'
One of the following values:
'db' | 'user' | 'role' | 'admin' | 'metadata' | 'named-graph' | 'icv-constraints'
user.list(conn, params)
Gets a list of users.
Expects the following parameters:
conn (Connection
)
params (object
)
Returns Promise<HTTP.Body>
user.listInfo(conn)
Retrieve a list of user info
Expects the following parameters:
Connection
)Returns Promise<HTTP.Body>
user.get(conn, username, params)
Gets all information for a given user.
Expects the following parameters:
conn (Connection
)
username (string
)
params (object
)
Returns Promise<HTTP.Body>
user.create(conn, user, params)
Creates a new user.
Expects the following parameters:
conn (Connection
)
user (User
)
params (object
)
Returns Promise<HTTP.Body>
user.changePassword(conn, username, password, params)
Changes a user's password.
Expects the following parameters:
conn (Connection
)
username (string
)
password (string
)
params (object
)
Returns Promise<HTTP.Body>
user.valid(conn, params)
Verifies that a Connection's credentials are valid.
Expects the following parameters:
conn (Connection
)
params (object
)
Returns Promise<HTTP.Body>
user.enabled(conn, username, params)
Verifies that a user is enabled.
Expects the following parameters:
conn (Connection
)
username (string
)
params (object
)
Returns Promise<HTTP.Body>
user.enable(conn, username, enabled, params)
Enables/disables a user.
Expects the following parameters:
conn (Connection
)
username (string
)
enabled (boolean
)
params (object
)
Returns Promise<HTTP.Body>
user.setRoles(conn, username, roles, params)
Sets roles for a user. (Overwrites any existing roles)
Expects the following parameters:
conn (Connection
)
username (string
)
roles (string[]
)
params (object
)
Returns Promise<HTTP.Body>
user.assignRole(conn, username, role, params)
Adds a role to a user.
Expects the following parameters:
conn (Connection
)
username (string
)
role (string
)
params (object
)
Returns Promise<HTTP.Body>
user.listRoles(conn, username, params)
Gets a list of roles assigned to a user.
Expects the following parameters:
conn (Connection
)
username (string
)
params (object
)
Returns Promise<HTTP.Body>
user.assignPermission(conn, username, permission, params)
Creates a new permission for a user over a given resource.
Expects the following parameters:
conn (Connection
)
username (string
)
permission (Permission
)
params (object
)
Returns Promise<HTTP.Body>
user.deletePermission(conn, username, permission, params)
Removes a permission for a user over a given resource.
Expects the following parameters:
conn (Connection
)
username (string
)
permission (Permission
)
params (object
)
Returns Promise<HTTP.Body>
user.permissions(conn, username, params)
Gets a list of permissions assigned to user.
Expects the following parameters:
conn (Connection
)
username (string
)
params (object
)
Returns Promise<HTTP.Body>
user.effectivePermissions(conn, username, params)
Gets a list of a user's effective permissions.
Expects the following parameters:
conn (Connection
)
username (string
)
params (object
)
Returns Promise<HTTP.Body>
user.superUser(conn, username, params)
Specifies whether a user is a superuser.
Expects the following parameters:
conn (Connection
)
username (string
)
params (object
)
Returns Promise<HTTP.Body>
user.remove(conn, username, params)
Deletes a user.
Expects the following parameters:
conn (Connection
)
username (string
)
params (object
)
Returns Promise<HTTP.Body>
user.token(conn)
Returns a token for the user if the connection is valid.
Expects the following parameters:
Connection
)Returns Promise<HTTP.Body>
user.whoAmI(conn)
Returns the username for the given connection.
Expects the following parameters:
Connection
)Returns Promise<HTTP.Body>
Object with the following values:
Action
)ResourceType
)string[]
)user.role.create(conn, role, params)
Creates a new role.
Expects the following parameters:
conn (Connection
)
role ({ name: string }
)
params (object
)
Returns Promise<HTTP.Body>
user.role.list(conn, params)
Lists all existing roles.
Expects the following parameters:
conn (Connection
)
params (object
)
Returns Promise<HTTP.Body>
user.role.listInfo(conn)
Retrieve a list of role info
Expects the following parameters:
Connection
)Returns Promise<HTTP.Body>
user.role.remove(conn, role, params)
Deletes an existing role from the system.
Expects the following parameters:
conn (Connection
)
role (string
)
params (object
)
Returns Promise<HTTP.Body>
user.role.usersWithRole(conn, role, params)
Lists all users that have been assigned a given role.
Expects the following parameters:
conn (Connection
)
role (string
)
params (object
)
Returns Promise<HTTP.Body>
user.role.assignPermission(conn, role, permission, params)
Adds a permission over a given resource to a given role.
Expects the following parameters:
conn (Connection
)
role (string
)
permission (Permission
)
params (object
)
Returns Promise<HTTP.Body>
user.role.deletePermission(conn, role, permission, params)
Removes a permission over a given resource from a given role.
Expects the following parameters:
conn (Connection
)
role (string
)
permission (Permission
)
params (object
)
Returns Promise<HTTP.Body>
user.role.permissions(conn, role, params)
Lists all permissions assigned to a given role.
Expects the following parameters:
conn (Connection
)
role (string
)
params (object
)
Returns Promise<HTTP.Body>
Object with the following values:
string
)string
)boolean
)boolean
)'DEFAULT' | 'LEGACY'
)Object with the following values:
string
)string
)string
)string
)'NATIVE' | 'ANSI'
)string
)string
)string
)string
)Object with the following values:
string
)Object with the following values:
string
)string
)string
)boolean
)boolean
)One of the following values:
SharedOptions & RdbmsOptions & MongoOptions & CsvOptions
Object with the following values:
boolean
)string
)Object with the following values:
string
)string
)virtualGraphs.list(conn)
Retrieve a list of virtual graphs
Expects the following parameters:
Connection
)Returns Promise<HTTP.Body>
virtualGraphs.listInfo(conn)
Retrieve a list of virtual graphs info
Expects the following parameters:
Connection
)Returns Promise<HTTP.Body>
virtualGraphs.add(conn, name, mappings, options, meta)
Add a virtual graph to the system
Expects the following parameters:
conn (Connection
)
name (string
)
mappings (string
)
options (T
)
meta (VgMeta
)
Returns Promise<HTTP.Body>
virtualGraphs.update(conn, name, mappings, options, meta)
Update a virtual graph in the system
Expects the following parameters:
conn (Connection
)
name (string
)
mappings (string
)
options (T
)
meta (VgMeta
)
Returns Promise<HTTP.Body>
virtualGraphs.remove(conn, name)
Remove a virtual graph from the system
Expects the following parameters:
conn (Connection
)
name (string
)
Returns Promise<HTTP.Body>
virtualGraphs.online(conn, name)
Bring a virtual graph online
Expects the following parameters:
conn (Connection
)
name (string
)
Returns Promise<HTTP.Body>
virtualGraphs.available(conn, name)
Determine if the named virtual graph is available
Expects the following parameters:
conn (Connection
)
name (string
)
Returns Promise<HTTP.Body>
virtualGraphs.options(conn, name)
Retrieve a virtual graph's options
Expects the following parameters:
conn (Connection
)
name (string
)
Returns Promise<HTTP.Body>
virtualGraphs.mappings(conn, name, requestOptions)
Retrieve a virtual graph's mappings
Expects the following parameters:
conn (Connection
)
name (string
)
requestOptions (MappingsRequestOptions
)
Returns Promise<HTTP.Body>
virtualGraphs.importFile(conn, file, fileType, database, importOptions)
Import a JSON or CSV file into a database via virtual import
.
Expects the following parameters:
conn (Connection
)
file (object
)
fileType (string
)
database (string
)
importOptions ({ mappings?: string, properties?: string, namedGraph?: string, }
)
Returns Promise<HTTP.Body>
storedFunctions.add(conn, functions, params)
Adds one or more stored functions to the server
Expects the following parameters:
conn (Connection
)
functions (string
)
params (object
)
Returns Promise<HTTP.Body>
storedFunctions.get(conn, name, params)
Retrieves the specified function definition
Expects the following parameters:
conn (Connection
)
name (string
)
params (object
)
Returns Promise<HTTP.Body>
storedFunctions.remove(conn, name, params)
Removes a stored function from the server
Expects the following parameters:
conn (Connection
)
name (string
)
params (object
)
Returns Promise<HTTP.Body>
storedFunctions.clear(conn, params)
Removes all stored functions from the server
Expects the following parameters:
conn (Connection
)
params (object
)
Returns Promise<HTTP.Body>
storedFunctions.getAll(conn, params)
Retrieves an export of all stored functions on the server
Expects the following parameters:
conn (Connection
)
params (object
)
Returns Promise<HTTP.Body>
cluster.info(conn)
Retrieves basic information about a Stardog cluster.
Expects the following parameters:
Connection
)Returns Promise<HTTP.Body>
cluster.status(conn)
Retrieves detailed status information about a Stardog cluster.
Expects the following parameters:
Connection
)Returns Promise<HTTP.Body>
catalog.status(conn)
Lists the status of catalog providers
Expects the following parameters:
Connection
)Returns Promise<HTTP.Body>
catalog.reload(conn, provider)
Starts a reload of information about a specific provider
Expects the following parameters:
conn (Connection
)
provider (string
)
Returns Promise<HTTP.Body>
One of the following values:
{ username: string, password: string } | { token: string } | { clientId: string, clientSecret: string }
catalog.addCredential(conn, credentials, label)
Adds a provider credential
Expects the following parameters:
conn (Connection
)
credentials (Credentials
)
label (string
)
Returns Promise<HTTP.Body>
catalog.listCredentials(conn)
Lists stored provider credentials
Expects the following parameters:
Connection
)Returns Promise<HTTP.Body>
catalog.removeCredential(conn, accessKey)
Removes a stored provider credential
Expects the following parameters:
conn (Connection
)
accessKey (string
)
Returns Promise<HTTP.Body>
catalog.runJob(conn, jobname)
Manually starts a provider job
Expects the following parameters:
conn (Connection
)
jobname (string
)
Returns Promise<HTTP.Body>
catalog.testConnection(conn, connectionOptions)
Tests a provider connection using existing/new credentials.
Expects the following parameters:
conn (Connection
)
connectionOptions (object
)
Returns Promise<HTTP.Body>
dataSources.list(conn)
Retrieve a list of data sources
Expects the following parameters:
Connection
)Returns Promise<HTTP.Body>
dataSources.listInfo(conn)
Retrieve a list of data sources info
Expects the following parameters:
Connection
)Returns Promise<HTTP.Body>
dataSources.info(conn, name)
Retrieve the named data source info
Expects the following parameters:
conn (Connection
)
name (string
)
Returns Promise<HTTP.Body>
dataSources.add(conn, name, options)
Add a data source to the system
Expects the following parameters:
conn (Connection
)
name (string
)
options (T
)
Returns Promise<HTTP.Body>
dataSources.update(conn, name, options, requestOptions)
Update the named data source in the system
Expects the following parameters:
conn (Connection
)
name (string
)
options (T
)
requestOptions ({ delta_options?: boolean; force?: boolean }
)
Returns Promise<HTTP.Body>
dataSources.remove(conn, name, params)
Remove the named data source from the system
Expects the following parameters:
conn (Connection
)
name (string
)
params (object
)
Returns Promise<HTTP.Body>
dataSources.share(conn, name)
Change a private data source to a shared one
Expects the following parameters:
conn (Connection
)
name (string
)
Returns Promise<HTTP.Body>
dataSources.online(conn, name)
Bring the named data source online
Expects the following parameters:
conn (Connection
)
name (string
)
Returns Promise<HTTP.Body>
dataSources.available(conn, name)
Determine if the named data source is available
Expects the following parameters:
conn (Connection
)
name (string
)
Returns Promise<HTTP.Body>
dataSources.options(conn, name)
Retrieve the named data source options
Expects the following parameters:
conn (Connection
)
name (string
)
Returns Promise<HTTP.Body>
dataSources.getMetadata(conn, name, options)
Retrieve the named data source metadata
Expects the following parameters:
conn (Connection
)
name (string
)
options (object
)
Returns Promise<HTTP.Body>
dataSources.updateMetadata(conn, name, metadata, options)
Update the named data source metadata
Expects the following parameters:
conn (Connection
)
name (string
)
metadata (T
)
options (object
)
Returns Promise<HTTP.Body>
dataSources.getTables(conn, name, options)
Retrieve tables
Expects the following parameters:
conn (Connection
)
name (string
)
options (object
)
Returns Promise<HTTP.Body>
dataSources.getTableMetadata(conn, name, options)
Retrieve the named table metadata
Expects the following parameters:
conn (Connection
)
name (string
)
options (object
)
Returns Promise<HTTP.Body>
One of the following values:
string | { query: string, options: object }
dataSources.query(conn, name, dataSourceQuery)
Query data source
Expects the following parameters:
conn (Connection
)
name (string
)
dataSourceQuery (DataSourceQuery
)
Returns Promise<HTTP.Body>
dataSources.refreshCounts(conn, name, tableName)
Refresh table row-count estimates
Expects the following parameters:
conn (Connection
)
name (string
)
tableName (string
)
Returns Promise<HTTP.Body>
dataSources.refreshMetadata(conn, name, tableName)
Refresh metadata
Expects the following parameters:
conn (Connection
)
name (string
)
tableName (string
)
Returns Promise<HTTP.Body>
dataSources.suggestions(conn, content, options)
Get suggestions for property matches on a model.
Expects the following parameters:
conn (Connection
)
content (string
)
options ({ accept?: string; contentType?: string }
)
Returns Promise<HTTP.Body>
dataSources.typeDescription(conn)
Get information about the data source types supported by the stardog instance, and their options
Expects the following parameters:
Connection
)Returns Promise<HTTP.Body>
FAQs
Stardog JavaScript Framework for node.js and the browser - Develop apps using the Stardog RDF Database & JS.
We found that stardog demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.