Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function findArgumentsForAssertion(assertionIri: Rdf.Iri): Kefir.Property> {
const query =
SparqlClient.setBindings(FIND_ARGUMENTS_QUERY, {'__assertion__': assertionIri});
return SparqlClient.select(
query, {context: {repository: 'assets'}}
).map(res => res.results.bindings.map(b => b['argument'] as Rdf.Iri));
}
private prepareData(props: SemanticTimelineConfigProps) {
const context = this.context.semanticContext;
const stream = SparqlClient.select(props.query, {context});
stream.onValue(res => {
if (SparqlUtil.isSelectResultEmpty(res)) {
this.setState({noResults: true, errorMessage: maybe.Nothing(), isLoading: false});
} else {
const {dataSet, errorMessage} = this.getDataSetAndError(res);
this.setState({
dataSet,
noResults: false,
errorMessage,
isLoading: false,
});
}
});
stream.onError(error => this.setState({errorMessage: maybe.Just(error), isLoading: false}));
const query =
SparqlClient.setBindings(
facetsQuery, _.assign({
[FACET_VARIABLES.RELATION_VAR]: relation.iri,
[FACET_VARIABLES.RANGE_VAR]: relation.hasRange.iri,
}, {
[SEMANTIC_SEARCH_VARIABLES.SELECTED_ALIGNMENT]:
this.context.selectedAlignment.map(a => a.iri).getOrElse(undefined),
})
);
const federatedQuery =
generateQueryForMultipleDatasets(
query, this.context.selectedDatasets, this.context.baseConfig.datasetsConfig
);
return SparqlClient.select(federatedQuery, {context: this.context.semanticContext});
}
const requests = repositories.map(repository =>
SparqlClient.select(sparql, {context: {repository}}).map(
({results}) => ({iri, images: results.bindings.map(({image}) => image.value)})
)
);
.flatMap(bound => SparqlClient.select(bound, options))
.map(response => {
componentDidMount() {
const iriString = this.props.iri || getCurrentResource().value;
const query = SparqlClient.select(
`SELECT ?visibility WHERE {
OPTIONAL { <${iriString}> <${vocabularies.VocabPlatform.visibility.value}> ?vis }
BIND(COALESCE(?vis, <${vocabularies.VocabPlatform.privateVisibility.value}>) as ?visibility).
}`
);
query
.onValue(res => {
const vis = res.results.bindings[0].visibility.value;
this.setState({ visibility: vis });
if (vis === visibility.group) {
this.selectGroups(iriString);
}
})
.onError(
private prepareConfigAndExecuteQuery = (props: SemanticTableProps, context: ComponentContext) => {
this.setState({
isLoading: true,
error: undefined,
});
this.querying = this.cancellation.deriveAndCancel(this.querying);
const loading = this.querying.map(
SparqlClient.select(props.query, {context: context.semanticContext})
).onValue(
res => this.setState({data: res, isLoading: false})
).onError(
error => this.setState({isLoading: false, error})
).onEnd(() => {
if (this.props.id) {
trigger({eventType: BuiltInEvents.ComponentLoaded, source: this.props.id});
}
});
if (this.props.id) {
trigger({
eventType: BuiltInEvents.ComponentLoading,
source: this.props.id,
data: loading,
});
}
(token: string, tokenVariable: string) => {
const parsedQuery: SparqlJs.SparqlQuery =
typeof query === 'string' ?
this.replaceTokenAndParseQuery(query as string, tokenVariable, token) :
query as SparqlJs.SparqlQuery;
const {escapeLuceneSyntax, tokenizeLuceneQuery} = this.props;
const queryParam = SparqlUtil.makeLuceneQuery(
token, escapeLuceneSyntax, tokenizeLuceneQuery,
);
const queryWithToken = SparqlClient.setBindings(
parsedQuery, {[SEARCH_INPUT_VARIABLE]: queryParam}
);
const context = this.context.semanticContext;
return SparqlClient.select(queryWithToken, {context: context}).map(
res => res.results.bindings
);
}