Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sparqlalgebrajs

Package Overview
Dependencies
Maintainers
1
Versions
70
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sparqlalgebrajs - npm Package Compare versions

Comparing version 2.0.1 to 2.1.0

lib/wildcard.d.ts

18

lib/algebra.d.ts
import * as rdfjs from "rdf-js";
import { Wildcard } from "./wildcard";
import { Term } from "rdf-js";
export declare const types: Readonly<{

@@ -42,2 +44,3 @@ ALT: string;

TERM: string;
WILDCARD: string;
}>;

@@ -59,11 +62,14 @@ export interface Operation {

type: 'expression';
expressionType: 'aggregate' | 'existence' | 'named' | 'operator' | 'term';
expressionType: 'aggregate' | 'existence' | 'named' | 'operator' | 'term' | 'wildcard';
}
export interface AggregateExpression extends Expression {
expressionType: 'aggregate';
aggregator: string;
aggregator: 'avg' | 'count' | 'group_concat' | 'max' | 'min' | 'sample' | 'sum';
distinct: boolean;
separator?: string;
expression: Expression;
}
export interface GroupConcatExpression extends AggregateExpression {
aggregator: 'group_concat';
separator?: string;
}
export interface ExistenceExpression extends Expression {

@@ -86,4 +92,8 @@ expressionType: 'existence';

expressionType: 'term';
term: rdfjs.Term;
term: Term;
}
export interface WildcardExpression extends Expression {
expressionType: 'wildcard';
wildcard: Wildcard;
}
export interface Alt extends Double, PropertyPathSymbol {

@@ -90,0 +100,0 @@ type: 'alt';

@@ -45,3 +45,4 @@ "use strict";

TERM: 'term',
WILDCARD: 'wildcard',
});
//# sourceMappingURL=algebra.js.map

@@ -45,4 +45,4 @@ import * as A from './algebra';

createTermExpression(term: RDF.Term): A.TermExpression;
createWildcardExpression(): A.TermExpression;
createWildcardExpression(): A.WildcardExpression;
createTerm(str: string): RDF.Term;
}

@@ -70,4 +70,4 @@ "use strict";

if (separator)
return { type: 'expression', expressionType: 'aggregate', aggregator, expression, separator, distinct };
return { type: 'expression', expressionType: 'aggregate', aggregator, expression, distinct };
return { type: 'expression', expressionType: 'aggregate', aggregator: aggregator, expression, separator, distinct };
return { type: 'expression', expressionType: 'aggregate', aggregator: aggregator, expression, distinct };
}

@@ -78,3 +78,4 @@ createExistenceExpression(not, input) { return { type: 'expression', expressionType: 'existence', not, input }; }

createTermExpression(term) { return { type: 'expression', expressionType: 'term', term }; }
createWildcardExpression() { return this.createTermExpression(new Wildcard()); }
createWildcardExpression() { return { type: 'expression', expressionType: 'wildcard', wildcard: new Wildcard() }; }
;
createTerm(str) {

@@ -81,0 +82,0 @@ return rdf_string_1.stringToTerm(str, this.dataFactory);

@@ -71,2 +71,3 @@ "use strict";

case eTypes.TERM: return translateTermExpression(expr);
case eTypes.WILDCARD: return translateWildcardExpression(expr);
}

@@ -137,2 +138,5 @@ throw new Error('Unknown Expression Operation type ' + expr.expressionType);

}
function translateWildcardExpression(expr) {
return expr.wildcard;
}
// ------------------------- OPERATIONS -------------------------

@@ -139,0 +143,0 @@ // these get translated in the project function

@@ -78,3 +78,3 @@ "use strict";

for (let v of thingy.variables) {
if (v.termType === "Wildcard")
if (util_1.default.isWildcard(v))
Object.assign(inScope, all);

@@ -140,5 +140,6 @@ else if (v.variable) // aggregates

function translateExpression(exp) {
if (util_1.default.isTerm(exp)) {
if (util_1.default.isTerm(exp))
return factory.createTermExpression(exp);
}
if (util_1.default.isWildcard(exp))
return factory.createWildcardExpression();
if (exp.aggregation)

@@ -373,3 +374,3 @@ return factory.createAggregateExpression(exp.aggregation, translateExpression(exp.expression), exp.distinct, exp.separator);

if (query.queryType === 'SELECT' || query.queryType === 'DESCRIBE') {
if (query.variables.some((e) => e && e.termType === "Wildcard"))
if (query.variables.some((e) => e && util_1.default.isWildcard(e)))
PV = variables;

@@ -376,0 +377,0 @@ else {

@@ -53,2 +53,3 @@ import * as A from "./algebra";

static isTerm(term: any): boolean;
static isWildcard(term: any): boolean;
}

@@ -55,0 +56,0 @@ /**

@@ -386,2 +386,4 @@ "use strict";

return factory.createTermExpression(term.term);
case algebra_1.expressionTypes.WILDCARD:
return factory.createWildcardExpression();
default: throw new Error('Unknown Expression type ' + expr.expressionType);

@@ -398,7 +400,11 @@ }

}
// separate terms from wildcard since we handle them differently
static isTerm(term) {
return term.termType !== undefined;
return term.termType !== undefined && term.termType !== 'Wildcard';
}
static isWildcard(term) {
return term.termType === 'Wildcard';
}
}
exports.default = Util;
//# sourceMappingURL=util.js.map
{
"name": "sparqlalgebrajs",
"version": "2.0.1",
"version": "2.1.0",
"description": "Convert SPARQL to SPARQL algebra",

@@ -5,0 +5,0 @@ "author": "Joachim Van Herwegen",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc