Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (blankMap[name]) {
name = blankMap[name];
} else {
if (variableNames.indexOf(name) >= 0) {
// increase index added to name until we find one that is available (2 loops at most)
let idx = 0;
while (variableNames.indexOf(name + idx) >= 0) {
++idx;
}
name = name + idx;
}
blankMap[term.value] = name;
variableNames.push(name);
}
changed = true;
return variable(name);
} else {
return term;
}
});
public static patternToCountQuery(pattern: RDF.Quad): string {
return toSparql(ActorRdfResolveQuadPatternSparqlJson.FACTORY.createProject(
ActorRdfResolveQuadPatternSparqlJson.FACTORY.createExtend(
ActorRdfResolveQuadPatternSparqlJson.FACTORY.createGroup(
ActorRdfResolveQuadPatternSparqlJson.patternToBgp(pattern),
[],
[ActorRdfResolveQuadPatternSparqlJson.FACTORY.createBoundAggregate(
variable('var0'),
'count',
ActorRdfResolveQuadPatternSparqlJson.FACTORY.createTermExpression(namedNode('*')),
false,
)],
),
variable('count'),
ActorRdfResolveQuadPatternSparqlJson.FACTORY.createTermExpression(variable('var0')),
),
[ variable('count') ],
));
}
public static nullToVariable(term: RDF.Term, label: string): RDF.Term {
if (!term) {
return DataFactory.variable('v' + label);
}
return term;
}
public static patternToCountQuery(pattern: RDF.Quad): string {
return toSparql(ActorRdfResolveQuadPatternSparqlJson.FACTORY.createProject(
ActorRdfResolveQuadPatternSparqlJson.FACTORY.createExtend(
ActorRdfResolveQuadPatternSparqlJson.FACTORY.createGroup(
ActorRdfResolveQuadPatternSparqlJson.patternToBgp(pattern),
[],
[ActorRdfResolveQuadPatternSparqlJson.FACTORY.createBoundAggregate(
variable('var0'),
'count',
ActorRdfResolveQuadPatternSparqlJson.FACTORY.createTermExpression(namedNode('*')),
false,
)],
),
variable('count'),
ActorRdfResolveQuadPatternSparqlJson.FACTORY.createTermExpression(variable('var0')),
),
[ variable('count') ],
));
}
return toSparql(ActorRdfResolveQuadPatternSparqlJson.FACTORY.createProject(
ActorRdfResolveQuadPatternSparqlJson.FACTORY.createExtend(
ActorRdfResolveQuadPatternSparqlJson.FACTORY.createGroup(
ActorRdfResolveQuadPatternSparqlJson.patternToBgp(pattern),
[],
[ActorRdfResolveQuadPatternSparqlJson.FACTORY.createBoundAggregate(
variable('var0'),
'count',
ActorRdfResolveQuadPatternSparqlJson.FACTORY.createTermExpression(namedNode('*')),
false,
)],
),
variable('count'),
ActorRdfResolveQuadPatternSparqlJson.FACTORY.createTermExpression(variable('var0')),
),
[ variable('count') ],
));
}
public static patternToCountQuery(pattern: RDF.Quad): string {
return toSparql(ActorRdfResolveQuadPatternSparqlJson.FACTORY.createProject(
ActorRdfResolveQuadPatternSparqlJson.FACTORY.createExtend(
ActorRdfResolveQuadPatternSparqlJson.FACTORY.createGroup(
ActorRdfResolveQuadPatternSparqlJson.patternToBgp(pattern),
[],
[ActorRdfResolveQuadPatternSparqlJson.FACTORY.createBoundAggregate(
variable('var0'),
'count',
ActorRdfResolveQuadPatternSparqlJson.FACTORY.createTermExpression(namedNode('*')),
false,
)],
),
variable('count'),
ActorRdfResolveQuadPatternSparqlJson.FACTORY.createTermExpression(variable('var0')),
),
[ variable('count') ],
));
}