Mercurial > code > home > repos > streamed-graph
view src/graph_queries.ts @ 78:ea9c9db282d6
automate 'external' list, get all local code to appear in lib.bundle.js
author | drewp@bigasterisk.com |
---|---|
date | Tue, 11 Feb 2020 22:55:24 -0800 |
parents | 601a604c097a |
children | 0c188ed3bcd8 |
line wrap: on
line source
import { N3Store, NamedNode } from "n3"; export function getStringValue( store: N3Store | undefined, subj: NamedNode, pred: NamedNode, defaultValue: string = "" ): string { if (store === undefined) { // this is so you can use the function before you have a graph return "..."; } const objs = store.getObjects(subj, pred, null); if (objs.length == 0) { return defaultValue; } return objs[0].value; }