It should be clear that the REGEX "John kim" does not match the literal "John".
Simply split the string by white space and combine this in your REGEX On 01.09.2017 15:31, Sidra shah wrote: > Hello Lorenz, thank you > > It matches now matches the name when some one enter opposite case like > john, John etc. > > But in my owl file, only first name is given i.e John and I want if some > one even type John kim, the query matches. The above query supposed to work > for it but it does not display the record when full name is typed. > > + "Filter regex(str(?name),'"+ss+"', 'i') . " // ss is java variable > > The properties in owl are like: > > Publication publishedBy authors > authors authorname someName //not string literal, > plain > > > > > > On Fri, Sep 1, 2017 at 9:07 AM, Lorenz Buehmann < > [email protected]> wrote: > >> Jena version please. >> >> Show the other query please. >> >> Share some sample data please. >> >> Note, REGEX is case-sensitive, i.e. >> >> FILTER(regex(?name ,'john')) won't match the literal "John kim" >> >> >> As I don't know the data nor your query, I only know that the query >> >> SELECT * >> WHERE >> { ?x mo:publishedBy ?y ; >> mo:authorname ?name ; >> rdfs:label ?label >> FILTER regex(str(?name), "john", "i") >> } >> >> would match "John kim" >> >> On 31.08.2017 19:42, Sidra shah wrote: >>> Hello >>> >>> I used Filter query in Jena which will filter the query using a name in >>> text area. In my dataset, the name is John Kim but I want if a user enter >>> even John, it display the result. I use this query but it does not >> display. >>> select * WHERE { ?x mo:publishedBy ?y.?x mo:authorname ?name. ?x >>> rdfs:label ?label .Filter regex(?name ,'John kim') . } >>> >>> the ?name is plain literal. The query works when I put the exact name in >>> the text area but not working when I enter first name or last name. >>> >>
