Skip to content

GET request sent when searching in power-select does not work with mu-cl-resources #16

@asjongers

Description

@asjongers

When writing a string in the "search" input field of a "belongs-to" power-select (and I suppose for any other), a request is sent to the backend in this format:
http://<url>/<resource>?filter=<your search string>
Ex: http://localhost:4200/users?filter=test

Mu-cl-resource transforms this into a malformed query (with a missing predicate)

resource_1       | PREFIX muauth: <http://mu.semte.ch/vocabularies/authorization/>
resource_1       | PREFIX dct: <http://purl.org/dc/terms/>
resource_1       | PREFIX ext: <http://mu.semte.ch/vocabularies/ext/>
resource_1       | PREFIX rm: <http://mu.semte.ch/vocabularies/logical-delete/>
resource_1       | PREFIX typedLiterals: <http://mu.semte.ch/vocabularies/typed-literals/>
resource_1       | PREFIX mu: <http://mu.semte.ch/vocabularies/core/>
resource_1       | PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
resource_1       | PREFIX app: <http://mu.semte.ch/app/>
resource_1       | PREFIX owl: <http://www.w3.org/2002/07/owl#>
resource_1       | PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
resource_1       | SELECT ((COUNT (DISTINCT ?uuid)) AS ?count) WHERE {
resource_1       |     GRAPH <http://mu.semte.ch/application> {
resource_1       |     ?s mu:uuid ?uuid; a foaf:Person. 

# // Missing predicate variable 
resource_1       |  ?s  ?__search47 FILTER CONTAINS(LCASE(str(?__search47)), LCASE(\"test\")) 

resource_1       | }
resource_1       | }")
resource_1       | 9: (CL-FUSEKI::SEND-REQUEST "http://database:8890/sparql" #<unavailable &REST argument> :WANTED-STATUS-CODES #<unused argument>)
resource_1       | 10: ((:METHOD CL-FUSEKI:QUERY (CL-FUSEKI::REPOSITORY STRING)) #<MU-SUPPORT::MU-SEMTECH-REPOSITORY {1004C18D83}> "SELECT ((COUNT (DISTINCT ?uuid)) AS ?count) WHERE {
resource_1       |     GRAPH <http://mu.semte.ch/application> {
resource_1       |     ?s mu:uuid ?uuid; a foaf:Person. 
resource_1       |  ?s  ?__search47 FILTER CONTAINS(LCASE(str(?__search47)), LCASE(\"test\")) 
resource_1       | }
resource_1       | }

Moreover, I'm not sure making a request in this case is necessary, the linkable resources having already been fetched. Wouldn't it be better to simply filter what was already fetched by comparing the query string to the stringRepresentation of the resource by default?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions