Closed jitsedesmet closed 3 years ago
Changes Missing Coverage | Covered Lines | Changed/Added Lines | % | ||
---|---|---|---|---|---|
lib/functions/NamedFunctions.ts | 27 | 28 | 96.43% | ||
lib/transformers/TermTransformer.ts | 47 | 50 | 94.0% | ||
lib/evaluators/evaluatorHelpers/AsyncRecursiveEvaluator.ts | 23 | 28 | 82.14% | ||
lib/evaluators/evaluatorHelpers/SyncRecursiveEvaluator.ts | 22 | 27 | 81.48% | ||
lib/functions/Helpers.ts | 64 | 72 | 88.89% | ||
lib/functions/RegularFunctions.ts | 99 | 112 | 88.39% | ||
lib/transformers/AlgebraTransformer.ts | 59 | 74 | 79.73% | ||
<!-- | Total: | 627 | 677 | 92.61% | --> |
Totals | |
---|---|
Change from base Build 1162151356: | 0.3% |
Covered Lines: | 1503 |
Relevant Lines: | 1625 |
Just wondering I we shouldn't use the general config/context in places where the openworld config thing is passed.
We could do this for sure. We can then also make SuperTypeCallback
async. To handle this we would then also need to provide Static create method so the creation can be async. Some problems will arise handling normal construction but we'll see about that.
This pull request aims to close #109 .
What this PR does:
lib/transformation.ts
in 2 classes that are easier to read and maintain.lib/Aggragators
in multiple files and create a base class for the evaluators to use instead of calling global functions.TypeCheckedLiteral
Reason: A literal almost always has a known dataType. Only when transforming an RDF.Term to it's internal representation does it have an other type. Every operation on a custom function return a known type. For example providing '-5 ' with dataType myNegatives extends Integer provided to UnaryMinus should return the known known type integer and not something with dataType myNegatives. Typechecking every internal literal would thus be an unnecessary overhead.
tests/util/generalEvaluation
I added ageneralErrorEvaluation
function. Using generalEvaluate in combination with an ErrorTable made SyncAvaluator not fully tested. When theAsyncEvaluator
throws an error in an ErrorTable. We still want to test theSyncEvaluator
. This function makes sure this happens by catching all thrown Errors.OverLoadTree
. This allows functions to access theIOpenWorldEnabler
. It also allows us to make IRI and NOW regular functions.I couldn't move
BNODE
because the sync and async implementation is different. It might be interesting to move this in the future since we probably want theAsyncEvaluator
to be able to get an asyncSuperTypeDiscoverCallback
. This should be possible but I would leave it for another PR. This one is big enough as is.It should be noted that the values of the caches are not to be used by the user. Not providing a
typeCache
results in us making one our self. Not providing anoverloadCache
will not create one.