Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function propSetForAssertedBelief(
belief: AssertedBelief
): Kefir.Property {
const query =
buildQueryForAssertedBelief(
SparqlUtil.parseQuerySync(belief.field.insertPattern), belief.isCanonical
);
return SparqlClient.construct(
SparqlClient.setBindings(query, {'subject': belief.target, 'value': belief.targetValue})
);
}
function propSetForArgumentsBelief(belief: ArgumentsFieldBelief): Kefir.Property {
const query =
buildQueryForArgumentsBelief(
SparqlUtil.parseQuerySync(belief.field.insertPattern)
);
return SparqlClient.construct(
SparqlClient.setBindings(query, {'subject': belief.target})
);
}
private createQueryModel(props: SemanticTreeInputProps): State {
try {
const model = new SparqlNodeModel({
rootsQuery: SparqlUtil.parseQuerySync(props.rootsQuery),
childrenQuery: SparqlUtil.parseQuerySync(props.childrenQuery),
parentsQuery: SparqlUtil.parseQuerySync(props.parentsQuery),
limit: ITEMS_LIMIT,
sparqlOptions: () => ({context: this.context.semanticContext}),
});
const searchQuery = SparqlUtil.parseQuerySync(props.searchQuery);
return {model, searchQuery};
} catch (loadError) {
return {loadError};
}
}
function parseQueryPattern(queryPattern: string, projectionVariable: string): SparqlJs.SelectQuery {
const query = SparqlUtil.parseQuerySync(`SELECT * {{ ${queryPattern} }}`);
return rewriteProjectionVariable(query, projectionVariable);
}
private createQueryModel(props: SemanticTreeInputProps): State {
try {
const model = new SparqlNodeModel({
rootsQuery: SparqlUtil.parseQuerySync(props.rootsQuery),
childrenQuery: SparqlUtil.parseQuerySync(props.childrenQuery),
parentsQuery: SparqlUtil.parseQuerySync(props.parentsQuery),
limit: ITEMS_LIMIT,
sparqlOptions: () => ({context: this.context.semanticContext}),
});
const searchQuery = SparqlUtil.parseQuerySync(props.searchQuery);
return {model, searchQuery};
} catch (loadError) {
return {loadError};
}
}