Published
Edited
Jul 27, 2022
Insert cell
Insert cell
Type JavaScript, then Shift-Enter. Ctrl-space for more options. Arrow ↑/↓ to switch modes.

Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
client.db("multibranchtest")
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
client.getBranches()
Insert cell
client.query(
WOQL.using("branch/canvas-test")
.member("v:ref", ["ref"])
.triple("v:graph_id", "rdf:type", "@schema:Graph")
)
Insert cell
client.query(
WOQL.using("branch/canvas:test")
.triple("v:graph_id", "rdf:type", "@schema:Graph")
.read_document("v:graph_id", "v:graph")
.opt(
WOQL.triple("v:graph_id", "label", "v:label_id").read_document(
"v:label_id",
"v:label"
)
)
)
Insert cell
Insert cell
branches = {
const branches = await client.query(
WOQL.using("_commits")
.triple("v:Branch", "rdf:type", "@schema:Branch")
.triple("v:Branch", "@schema:name", "v:name")
.concat(["branch/", "v:name"], "v:ref")
);

const refPaths = branches.bindings.map((d) => d.ref["@value"]);

return await client.query(
WOQL.or(
...refPaths.map((refPath) =>
WOQL.using(refPath)
.member("v:refPath", [refPath])
.read_document("Actor/Fidel", "v:doc")
)
)
);

// return await client.query(
// WOQL.or(
// ...graphRefs.map(
// (d) =>
// WOQL.using(d)
// .member("v:graphRef", [d])
// .read_document("Actor/Fidel", "v:doc")
// // .triple("v:a", "v:b", "v:c")
// // .read_document("v:graph_id", "v:graph")
// // .opt(
// // WOQL.triple("v:graph_id", "label", "v:label_id").read_document(
// // "v:label_id",
// // "v:label"
// // )
// // .triple("v:label_id", "@schema:en", "v:en_label")
// // ))
// )
// )
// );
}
Insert cell
client.getBranches()
Insert cell
{
const branches = await client.query(
WOQL.using("_commits")
.triple("v:Branch", "rdf:type", "@schema:Branch")
.triple("v:Branch", "@schema:name", "v:name")
.concat(["branch/", "v:name"], "v:ref")
.using("v:ref")
.read_document("Actor/Fidel", "v:doc")
);

return branches;
}
Insert cell
client.getBranches()
Insert cell
// client.addDocument({ "@type": "Graph", type: "canvas", label: { en: "test" } })
Insert cell
// client.branch("canvas-test")
Insert cell
// client.checkout(encodeURIComponent("canvas:?"))
Insert cell
// client.branch(encodeURIComponent("canvas:?"))
Insert cell
// client.deleteBranch("canvas-test")
Insert cell
client.getDocument()
Insert cell
client.checkout("canvas-test")
Insert cell
client.generateCommitInfo("3fepp9hcdnyv69w66l15ahpm1lfs704")
Insert cell
client.generateCommitDescriptor("InitialCommit/41wl4nxr1n5cp3cjz70tu2pv85a080d")
Insert cell
client.db("amazonasfuturelab")
Insert cell
client.getDatabases()
Insert cell
client.query(WOQL.lib().branches())
Insert cell
client.query(WOQL.lib().commits("canvas:mynewcanvas2"))
Insert cell
// client.branch("base-user", true)
Insert cell
Inputs.button([
["replace schema", async () => {
await client.addDocument(localSchema, { graph_type: "schema", full_replace: true}, null, "replace schema")
}]
], {label: "→"})
Insert cell
Insert cell
// client.deleteDocument({nuke: true})
Insert cell
// client.getSchemaFrame()
Insert cell
Inputs.button(
[
[
"import data",
async () => {
await client.addDocument(
[...productTypes, ...materials, ...humanMadeObjects],
{ graph_type: "instance", full_replace: true },
null,
"import base data"
);
}
],
[
"update data",
async () => {
await client.updateDocument(
[...productTypes, ...materials, ...humanMadeObjects],
{},
null,
"update base data"
);
}
]
],
{ label: "→" }
)
Insert cell
// client.addDocument({
// "@type": "Material",
// "@id": "Material/de-MUS-019118/149565",
// label: {
// "@type": "Dictionary",
// de: "Stein",
// en: "Stone",
// es: undefined,
// pt: undefined
// }
// })
Insert cell
client.queryDocument({ type: "Canvas" }, { as_list: true })
Insert cell
client.getDocument({'id': 'E57_Material/Q42302'})
Insert cell
// types.filter(d => d['@type'] === "E55_Type")
Insert cell
client.query(
WOQL.or(
WOQL.triple('E57_Material/Q42302', 'v:prop', 'v:obj'),
WOQL.triple('v:sub', 'v:prop', 'E57_Material/Q42302'),
)
)
Insert cell
// client.getDocument({ type: "Canvas" })
Insert cell
Insert cell
Insert cell
Insert cell
import { extendedClasses } from "@fidel/cidoc-crm-to-terminusdb"
Insert cell
import { humanMadeObjects, materials, productTypes } from "@fidel/em-lido-import"
Insert cell
import { macroClasses } from "@fidel/cidoc-macro-classes"
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more