Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "ignore case" checkbox on search filed (was : 'Set literal as query object without filter from widget") #621

Open
ch-sander opened this issue Aug 24, 2024 · 2 comments
Labels
kind: Enhancement 📈 New feature or request what: Widgets Related to component value selection widgets

Comments

@ch-sander
Copy link

ch-sander commented Aug 24, 2024

Instead of

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT DISTINCT ?entitlement_1 ?entitlement_1_label WHERE {
  ?entitlement_1 rdf:type <http://www.graceful17.org/ontology/entitlement>;
    <http://www.graceful17.org/ontology/called> ?entitlement_1_label;
    <http://shmarql.com/fts> ?o.
  FILTER((LCASE(?o)) = (LCASE("even")))
}
LIMIT 10000

the widget should set

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT DISTINCT ?entitlement_1 ?entitlement_1_label WHERE {
  ?entitlement_1 rdf:type <http://www.graceful17.org/ontology/entitlement>;
    <http://www.graceful17.org/ontology/called> ?entitlement_1_label;
    <http://shmarql.com/fts>"even".
}
LIMIT 10000

http://shmarql.com/fts is a fizzysearch pattern that requires its object, a literal, directly to search the index (implemented from https://github.com/epoz/shmarql, thanks to @epoz ). This is a way to mitigate #612

which widget or sparnatural config for the dataProperty does this trick?

@tfrancart
Copy link
Contributor

the widget should set (...)

You would like it to set the criteria this way. But it does not work this way and this has been made on purpose because usually users don't have to worry about the case in what they are searching. One could probably think about an additional "ignore case" checkbox next to the search field.

In the meantime if you are comfortable with the code you can modify the SPARQL generation here :

// builds a FILTER(lcase(...) = lcase(...))

You will need to implement "isBlockingObjectProp" to return true so that the ?s :p ?o pattern is not created, and you create it with the value in the object position. Look at how the BooleanValueBuilder works, it is pretty similar to what you need :
export class BooleanValueBuilder extends BaseValueBuilder implements ValueBuilderIfc {

@tfrancart tfrancart changed the title Set literal as query object without filter from widget Add "ignore case" checkbox on search filed (was : 'Set literal as query object without filter from widget") Aug 25, 2024
@tfrancart tfrancart added kind: Enhancement 📈 New feature or request what: Widgets Related to component value selection widgets labels Aug 25, 2024
@ch-sander
Copy link
Author

I'm sorry, of course I didn't mean to suggest a better way but only specified my needs 😁. Thank you very much for your patience!

Anyway, I'll look into the code.

Maybe beyond my use case a really exact match widget might help as some text is case sensitive, e.g. some IDs or shelf marks. Also for a number this could be useful as not every number is to be expressed as range and then needs two inputs by the user. Not sure if I'm having a point here or if I'm missing important things.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: Enhancement 📈 New feature or request what: Widgets Related to component value selection widgets
Projects
None yet
Development

No branches or pull requests

2 participants