sparqlalgebrajs
Advanced tools
Comparing version 4.1.0 to 4.2.0
@@ -55,10 +55,10 @@ import * as rdfjs from '@rdfjs/types'; | ||
} | ||
export declare type Operation = Ask | Expression | Bgp | Construct | Describe | Distinct | Extend | From | Filter | Graph | Group | Join | LeftJoin | Minus | Nop | OrderBy | Path | Pattern | Project | PropertyPathSymbol | Reduced | Service | Slice | Union | Values | Update; | ||
export declare type Expression = AggregateExpression | GroupConcatExpression | ExistenceExpression | NamedExpression | OperatorExpression | TermExpression | WildcardExpression | BoundAggregate; | ||
export declare type PropertyPathSymbol = Alt | Inv | Link | Nps | OneOrMorePath | Seq | ZeroOrMorePath | ZeroOrOnePath; | ||
export declare type Update = CompositeUpdate | DeleteInsert | Load | Clear | Create | Drop | Add | Move | Copy | Nop; | ||
export declare type TypedOperation<T extends types> = Extract<Operation, { | ||
export type Operation = Ask | Expression | Bgp | Construct | Describe | Distinct | Extend | From | Filter | Graph | Group | Join | LeftJoin | Minus | Nop | OrderBy | Path | Pattern | Project | PropertyPathSymbol | Reduced | Service | Slice | Union | Values | Update; | ||
export type Expression = AggregateExpression | GroupConcatExpression | ExistenceExpression | NamedExpression | OperatorExpression | TermExpression | WildcardExpression | BoundAggregate; | ||
export type PropertyPathSymbol = Alt | Inv | Link | Nps | OneOrMorePath | Seq | ZeroOrMorePath | ZeroOrOnePath; | ||
export type Update = CompositeUpdate | DeleteInsert | Load | Clear | Create | Drop | Add | Move | Copy | Nop; | ||
export type TypedOperation<T extends types> = Extract<Operation, { | ||
type: T; | ||
}>; | ||
export declare type TypedExpression<T extends expressionTypes> = Extract<Expression, { | ||
export type TypedExpression<T extends expressionTypes> = Extract<Expression, { | ||
expressionType: T; | ||
@@ -65,0 +65,0 @@ }>; |
@@ -240,4 +240,14 @@ "use strict"; | ||
function translateExpression(exp) { | ||
if (util_1.default.isSimpleTerm(exp) || util_1.default.isQuad(exp)) | ||
if (util_1.default.isSimpleTerm(exp)) | ||
return factory.createTermExpression(exp); | ||
if (util_1.default.isQuad(exp)) { | ||
if (util_1.default.hasQuadVariables(exp)) | ||
return factory.createOperatorExpression('triple', [ | ||
translateExpression(exp.subject), | ||
translateExpression(exp.predicate), | ||
translateExpression(exp.object), | ||
]); | ||
else | ||
return factory.createTermExpression(exp); | ||
} | ||
if (util_1.default.isWildcard(exp)) | ||
@@ -244,0 +254,0 @@ return factory.createWildcardExpression(); |
@@ -85,2 +85,3 @@ import { Wildcard } from 'sparqljs'; | ||
static isQuad(term: any): term is RDF.Quad; | ||
static hasQuadVariables(quad: RDF.Quad): boolean; | ||
static isWildcard(term: any): term is Wildcard; | ||
@@ -87,0 +88,0 @@ } |
@@ -8,2 +8,3 @@ "use strict"; | ||
const factory_1 = __importDefault(require("./factory")); | ||
const rdf_terms_1 = require("rdf-terms"); | ||
class Util { | ||
@@ -461,2 +462,5 @@ /** | ||
} | ||
static hasQuadVariables(quad) { | ||
return (0, rdf_terms_1.someTermsNested)(quad, term => term.termType === 'Variable'); | ||
} | ||
static isWildcard(term) { | ||
@@ -463,0 +467,0 @@ return term.termType === 'Wildcard'; |
{ | ||
"name": "sparqlalgebrajs", | ||
"version": "4.1.0", | ||
"version": "4.2.0", | ||
"description": "Convert SPARQL to SPARQL algebra", | ||
@@ -25,3 +25,4 @@ "author": "Joachim Van Herwegen", | ||
"rdf-string": "^1.6.0", | ||
"sparqljs": "^3.6.1" | ||
"rdf-terms": "^1.10.0", | ||
"sparqljs": "^3.7.1" | ||
}, | ||
@@ -28,0 +29,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
319767
2788
9
+ Addedrdf-terms@^1.10.0
Updatedsparqljs@^3.7.1