Skip to content

Commit

Permalink
changes made as per review
Browse files Browse the repository at this point in the history
  • Loading branch information
psvkaushik committed Jul 15, 2024
1 parent 508d618 commit ca8a021
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 36 deletions.
6 changes: 3 additions & 3 deletions lib/algebra.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,11 @@ export interface BaseOperation
export interface Paths extends BaseOperation
{
type : types.PATHS;
start: IriTerm ;
via: IriTerm;
end: IriTerm ;
shortest?: boolean;
cyclic?: boolean;
start?: rdfjs.Variable | IriTerm;
via?: rdfjs.Variable | IriTerm;
end?: rdfjs.Variable | IriTerm;
maxlength?: number
}

Expand Down
10 changes: 5 additions & 5 deletions lib/factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as A from './algebra';
import * as RDF from '@rdfjs/types';
import { DataFactory } from 'rdf-data-factory';
import { stringToTerm } from "rdf-string";
import { Wildcard } from 'sparqljs-nrt';
import { IriTerm, Wildcard } from 'sparqljs-nrt';

export default class Factory
{
Expand All @@ -22,15 +22,15 @@ export default class Factory
result.variable = variable;
return result;
}
createPaths(shortest?: boolean, cyclic?: boolean, start?: RDF.Variable | RDF.NamedNode, via?: RDF.Variable | RDF.NamedNode, end?: RDF.Variable | RDF.NamedNode, maxlength?: number): A.Paths {
createPaths(start: IriTerm , via: IriTerm, end: IriTerm , shortest?: boolean, cyclic?: boolean, maxlength?: number): A.Paths {
return {
type: A.types.PATHS,
shortest,
cyclic,
start,
via,
end,
maxlength
maxlength,
shortest,
cyclic,
};
}
createBgp (patterns: A.Pattern[]): A.Bgp { return { type: A.types.BGP, patterns }; }
Expand Down
6 changes: 3 additions & 3 deletions lib/sparql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,12 @@ function translatePaths(op: Algebra.Paths): PathsQuery {
return {
type: 'query',
queryType: 'PATHS',
start: op.start ,
via: op.via ,
end: op.end ,
prefixes: {},
shortest: op.shortest || false,
cyclic: op.cyclic || false,
start: op.start ? op.start as Variable : undefined,
via: op.via ? op.via as Variable : undefined,
end: op.end ? op.end as Variable : undefined,
maxlength: op.maxlength || undefined,
};
}
Expand Down
6 changes: 3 additions & 3 deletions lib/sparqlAlgebra.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,11 +259,11 @@ function inScopeVariables(thingy: SparqlQuery | Pattern | PropertyPath | RDF.Ter
}
function translatePathsQuery(sparql: PathsQuery): Algebra.Operation {
return factory.createPaths(
sparql.start,
sparql.via,
sparql.end,
sparql.shortest,
sparql.cyclic,
sparql.start ? sparql.start as RDF.Variable | RDF.NamedNode : undefined,
sparql.via ? sparql.via as RDF.Variable | RDF.NamedNode : undefined,
sparql.end ? sparql.end as RDF.Variable | RDF.NamedNode : undefined,
sparql.maxlength
);
}
Expand Down
8 changes: 5 additions & 3 deletions lib/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,8 @@ export default class Util

switch (result.type)
{
case types.PATHS:
break
case types.ALT:
result.input.map(recurseOp);
break;
Expand Down Expand Up @@ -353,11 +355,11 @@ export default class Util
}
if (result.type === types.PATHS) {
result = factory.createPaths(
result.start,
result.via ,
result.end,
result.shortest,
result.cyclic,
result.start ? result.start as RDF.Variable | RDF.NamedNode : undefined,
result.via ? result.via as RDF.Variable | RDF.NamedNode : undefined,
result.end ? result.end as RDF.Variable | RDF.NamedNode : undefined,
result.maxlength
);
}
Expand Down
30 changes: 14 additions & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sparqlalgebrajs",
"version": "4.3.7",
"name": "sparqlalgebrajs-nrt",
"version": "1.0.3",
"description": "Convert SPARQL to SPARQL algebra",
"author": "Joachim Van Herwegen",
"license": "MIT",
Expand All @@ -24,7 +24,7 @@
"rdf-string": "^1.6.0",
"rdf-terms": "^1.10.0",
"sparqlalgebrajs": "^4.3.7",
"sparqljs-nrt": "^1.0.8"
"sparqljs-nrt": "^1.1.3"
},
"devDependencies": {
"@tsconfig/node12": "^12.0.0",
Expand Down

0 comments on commit ca8a021

Please sign in to comment.