From 38f8b5bd91194c157897a8934c0f004b82430b1a Mon Sep 17 00:00:00 2001 From: Charitha Perera Date: Mon, 8 Apr 2024 12:52:12 +0200 Subject: [PATCH 1/2] Update index.md --- docs/triplydb-js/query/index.md | 74 ++++++++++++++++++++++++++++++++- 1 file changed, 73 insertions(+), 1 deletion(-) diff --git a/docs/triplydb-js/query/index.md b/docs/triplydb-js/query/index.md index 408dfe03..05d3c96a 100644 --- a/docs/triplydb-js/query/index.md +++ b/docs/triplydb-js/query/index.md @@ -96,7 +96,10 @@ At least one of the following arguments is required to create a new version. Any
the SPARQL compliant query as a string value
output: string
-
The visualization plugin that is used to display the result set. If none is set it defaults to 'table'. Other options may include: 'response', 'geo', 'gallery', 'markup', etc
+
The visualization plugin that is used to display the result set. If none is set it defaults to 'table'. Other options may include: 'response', 'geo', 'gallery', 'markup', etc. Output will take priority over ldFrame
+ +
ldFrame: object
+
JSON LD frame object used to transform plain JSON LD into a framed JSON. Will be used only if an output is not provided.
variables: Variable[]
@@ -212,3 +215,72 @@ const user = await triply.getAccount('my-account') const query = await user.getQuery('my-query') const query_1 = await query.useVersion(1) ``` + +## Query.duplicate(name: string, metadataToReplace?: object) + +Creates a duplicate of the saved query under a new name. The duplicated query will retain all the metadata from the original query unless metadataToReplace has been provided. + +### Arguments + +
+
name
+
+

The new URL-friendly name given to the duplicated query that is used in URL paths. This name can only include ASCII letters and hyphens.

+
+ +
metadataToReplace
+
+

An optional metadata object with optionl properties that can be provided to override any of the existing metadata of the duplicated query if required

+
+
accessLevel
+
+

The access level of the query. The following values are possible:

+
+
'private' (default)
+
The dataset can only be accessed by organization members.
+
'internal'
+
The dataset can only be accessed by users that are logged into the TriplyDB server. +
'public'
+
The dataset can be accessed by everybody.
+
+
+
queryString: string
+
the SPARQL compliant query as a string value
+
output: string
+
The visualization plugin that is used to display the result set. If none is set it defaults to 'table'. Other options may include: 'response', 'geo', 'gallery', 'markup', etc
+
dataset: object
+
A dictionary object representing the dataset against which the query is evaluated.
+
description: string
+
The human-readable description of the query. This typically explains what the query does in natural language.
+
displayName: string
+
The human-readable name of the query. This name may include spaces and other characters that are not allowed in the URL-friendly name.
+
variables: Variable[]
+
+

A list of objects with the following keys:

+
+
IRI variable
+
An object of the form `Variable` + (see Account.addQuery()) +
+
+
serviceType: string("speedy" | "virtuoso" | "jena" | "blazegraph" | "prolog")
+
The SPARQL service type the duplicated query needs to be configured to
+
+
+
+ +### Example + +```ts +const user = await triply.getAccount('my-account') +const query = await user.getQuery('my-query') +const query_1 = await query.useVersion(1) + +// Without overwriting any metadata +const duplicatedQuery_1 = await query.duplicate('newDuplicateQuery') +// With overwitting metadata +const duplicatedQuery_1 = await query.duplicate('newDuplicateQuery', { + description: 'newDescription', + displayName: 'newDisplayName' +}) +``` From fd23cd1308ff8731fd348dc4c2594a2193327b9a Mon Sep 17 00:00:00 2001 From: Charitha Perera Date: Mon, 8 Apr 2024 13:57:26 +0200 Subject: [PATCH 2/2] review fix --- docs/triplydb-js/query/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/triplydb-js/query/index.md b/docs/triplydb-js/query/index.md index 05d3c96a..7182b4e7 100644 --- a/docs/triplydb-js/query/index.md +++ b/docs/triplydb-js/query/index.md @@ -99,7 +99,7 @@ At least one of the following arguments is required to create a new version. Any
The visualization plugin that is used to display the result set. If none is set it defaults to 'table'. Other options may include: 'response', 'geo', 'gallery', 'markup', etc. Output will take priority over ldFrame
ldFrame: object
-
JSON LD frame object used to transform plain JSON LD into a framed JSON. Will be used only if an output is not provided. +
JSON LD frame object used to transform plain JSON LD into a framed JSON. Will be used only if an output is not provided.
variables: Variable[]