Skip to content
This repository has been archived by the owner on Sep 19, 2023. It is now read-only.

Add SPARQL-star operators and comparison #179

Merged
merged 1 commit into from
Jun 27, 2023
Merged

Conversation

rubensworks
Copy link
Member

Partially built on top of @jeswr's WIP PR from #161.

@jitsedesmet I changed the ordering logic quite a bit (the old version had a fundamental flaw where > was considered the opposite to <), so it might be good for you to check if I didn't break anything major (all unit and spec tests still pass).

@rubensworks
Copy link
Member Author

PR fails as this requires joachimvh/SPARQLAlgebra.js#98 to be merged first.

Copy link
Member

@jitsedesmet jitsedesmet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything looks good to me. I have some minor 'hints' that might make the code more consistent with the rest, but it's honestly just nit-picking.

(<E.BooleanLiteral> op.apply([ (<Quad> left).object, (<Quad> right).object ], context)).coerceEBV(),
);
},
false,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why should we not handle invalid lexicals here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(and in the other functions)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly, I'm not sure what this flag does exactly. The documentation didn't help me out much.
What would change when setting this to true?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The flag (when true = default value) makes sure that the current implementation throws an error when passed an invalid literal. (some functions don't want this, since they handle invalid literals themselves (see equality of terms))
I don't think this implementation will run into trouble so we can keep it as is.

.set(
[ 'quad', 'quad' ],
context => ([ left, right ]) => {
const op: RegularFunction = new RegularFunction(RegularOperator.EQUAL, equality);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we already use the cast made by regularFunctions in index.ts

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't due that due to the circular dependency.

import type { ISuperTypeProvider, SuperTypeCallback, TypeCache, GeneralSuperTypeDict } from './TypeHandling';
import { getSuperTypeDict } from './TypeHandling';

// Determine the relative numerical order of the two given terms.
/**
* @param enableExtendedXSDTypes System will behave like when this was true. @deprecated
*/
export function orderTypes(termA: RDF.Term | undefined, termB: RDF.Term | undefined, isAscending: boolean,
export function orderTypes(termA: RDF.Term | undefined, termB: RDF.Term | undefined,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

orderTypes is an exported function, can we just change the behavior like this? (requires major release?)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's just do a major update then :-)

The isAscending option felt a bit weird to me, and complicated the implementation too much, so I removed it.

@rubensworks rubensworks mentioned this pull request Jun 27, 2023
Partially built on top of @jeswr's WIP PR from #161.
@coveralls
Copy link

Coverage Status

coverage: 100.0%. remained the same when pulling 04af322 on feature/rdf-star into 1d9ca76 on master.

@rubensworks rubensworks merged commit d1e01c3 into master Jun 27, 2023
@rubensworks rubensworks deleted the feature/rdf-star branch June 27, 2023 12:38
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants