Re: Filter query not working

2017-09-04 Thread Sidra shah
Thank you Lorenz and sorry for late response, I was away. I have just restrict the user input to just one name (first name) and for time being, it works for me. Regards On Fri, Sep 1, 2017 at 10:21 PM, Lorenz Buehmann < buehm...@informatik.uni-leipzig.de> wrote: > The problem is not in your

Re: Filter query not working

2017-09-01 Thread Lorenz Buehmann
The problem is not in your query but in the application logic. You have to figure out what a user would enter in the text field of the UI. Indeed, a user could enter whole sentences, but you have to find a trade-off between what your application supports and its implementation complexity. Note,

Re: Filter query not working

2017-09-01 Thread Sidra shah
Sorry Rob, if my question bothered. I thought the problem is in my query and that is why I asked here., Regards On Fri, Sep 1, 2017 at 6:36 PM, Rob Vesse wrote: > Sidra > > As I have said in the past on this list please do not forget you are using > a programming

Re: Filter query not working

2017-09-01 Thread Rob Vesse
Sidra As I have said in the past on this list please do not forget you are using a programming language. You are free to implement your application however you see fit, this will involve you writing some code and making some design decisions. This list does not exist to write code for you. We

Re: Filter query not working

2017-09-01 Thread Sidra shah
Hello Rob, I have a string variable ss for string John kim, so when user enter name, it is saved in ss. how can we then use FILTER(REGEX(?name, “John|kim”, “i”) Or, I just use two text boxes for first name and last name and then ? FILTER(REGEX(?name, “firstname”, “i”) && REGEX(?name,

Re: Filter query not working

2017-09-01 Thread Rob Vesse
Really it depends on exactly what you want to do It is entirely possible to create a regular expression that looks for only a partial match, however you will have to implement logic in your application to convert the user provided search string into an appropriate regular expression for your

Re: Filter query not working

2017-09-01 Thread Sidra shah
I am sorry Lorenz, but I do not understand How to split the string by white space and then combine? I have no idea about it, currently. Could you please guide? On Fri, Sep 1, 2017 at 5:30 PM, Lorenz Buehmann < buehm...@informatik.uni-leipzig.de> wrote: > It should be clear that the REGEX "John

Re: Filter query not working

2017-09-01 Thread Lorenz Buehmann
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 >

Re: Filter query not working

2017-09-01 Thread Sidra shah
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

Re: Filter query not working

2017-09-01 Thread Lorenz Buehmann
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

Filter query not working

2017-08-31 Thread Sidra shah
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

Re: The query not working

2017-07-03 Thread Lorenz Buehmann
SPARQL returns one row for each possible matching. But to keep it short, please provide: 1. The whole query that is executed 2. The whole code snippet that runs the query 3. The whole data of the matching resource, i.e. in your case the book for which two rows are returned. By the way, you

Re: The query not working

2017-07-03 Thread Sidra shah
Hello Andy and Lorenz, thank you. I have made a mistake that I used ?x rdf:type mo:Book , because Book has sub classes of Java and Semantic Web books. So if I use ?x rdf:type mo:Java or ?x rdf:type mo:SemanticWeb, it works. But still it prints the instances of these books twice. On Mon, Jul

Re: The query not working

2017-07-03 Thread Andy Seaborne
>> The prefixes are Ok because for simple queries (without Filter), it works. So with SELECT * WHERE { ?s rdf:type mo:Book.?s mo:BookCategory ?book } you get something? what? If you do then ?book is not equal to (i.e. exactly) the string 'Semantic Web'. In your original email, you

Re: The query not working

2017-07-03 Thread Sidra shah
I am giving the code after query, may be the problem exist in these lines. Query query = QueryFactory.create(str); QueryExecution qexec = QueryExecutionFactory.create(query, model) ; ResultSet results = qexec.execSelect() ; while (results.hasNext()) { QuerySolution binding =

Re: The query not working

2017-07-03 Thread Sidra shah
Hello Lorenz, BookCategory is a data property whose value is string (Java or Semantic Web). The print out of the query is given: PREFIX rdf: PREFIX mo:< http://www.semanticweb.org/ontologies/2017/5/untitled-ontology-758#> SELECT * WHERE { ?s

Re: The query not working

2017-07-03 Thread Lorenz Buehmann
Is it Java code? Print the query string that is created. Check the prefixes. Make sure that you properly distinguish between literals and URIs -> is a book category a literal or a resource? Is the value of str a URI or a literal? On 03.07.2017 07:12, Sidra shah wrote: > Hello > > I have a

The query not working

2017-07-02 Thread Sidra shah
Hello I have a Book class having Java and Semantic Web sub classes. Java class have some instances: JSP, Java by Dietel, JDBC Semantic Web has also some instances: SPARQL, Semantic Programming, etc. I have a data property BookCategory for each instance which will be either Java or Semantic Web

Re: query not working

2016-08-13 Thread Lorenz B.
:hasClass ?class FILTER (regex(str(?class), > " + string + ")) > Best regards > >> From: neha.bang...@gmail.com >> Date: Thu, 11 Aug 2016 07:39:16 -0700 >> Subject: Re: query not working >> To: users@jena.apache.org >> >> URI? I have used the pr

Re: query not working

2016-08-11 Thread Andy Seaborne
Please show a complete, minimal example. http://stackoverflow.com/help/mcve Andy On 11/08/16 15:39, neha gupta wrote: URI? I have used the prefixes in my query. User have to select taught or research in combo box and I need to filter my query based on user selection. When I dont use

Re: query not working

2016-08-11 Thread neha gupta
URI? I have used the prefixes in my query. User have to select taught or research in combo box and I need to filter my query based on user selection. When I dont use user selection and direct use like this: select ?student where {?student my:hasClass my:taught} it works but I need to use the

Re: query not working

2016-08-11 Thread Jean-Marc Vanel
"taught" and "research" are just strings , you need the real URI's between <> . 2016-08-11 16:19 GMT+02:00 neha gupta : > I have query > > select ?student where {?student my:hasClass ?class FILTER (?class > =''"+string+"} > > hasClass has two individuals: taught and

query not working

2016-08-11 Thread neha gupta
I have query select ?student where {?student my:hasClass ?class FILTER (?class =''"+string+"} hasClass has two individuals: taught and research. I will take this from user as: String string=box1.getSelectedItem().toString(); (user will enter either taught or research).

Re: SPARQL Query not working

2015-09-02 Thread Lorenz Bühmann
Hello Jenny, I don't see any attachment. Kind regards, Lorenz Hello, I am trying to run a SPARQL query on Eclipse using Jena. I followed an online tutorial to set everything up. When I run the program, I'm getting a list of "null"s as a result. Could you help me with this? Am I doing

Re: SPARQL Query not working

2015-09-02 Thread Andy Doddington
No code attached? — On 2 Sep 2015, at 04:16, Jenny Jin wrote: Hello, I am trying to run a SPARQL query on Eclipse using Jena. I followed an online tutorial to set everything up. When I run the program, I'm getting a list of "null"s as a result. Could you help

Re: SPARQL Query not working

2015-09-02 Thread Rob Vesse
Attachments are filtered from (most) Apache lists Please either include the code in an email if short or paste on a paste board service like pastebin.com or gist.github.com and provide a link Also please bear in mine that a minimal, complete, verifiable example is preferred over a full code dump

Re: SPARQL Query not working

2015-09-02 Thread Andy Seaborne
On 02/09/15 13:59, Jenny Jin wrote: Hello, I guess the attachment was filtered. http://pastebin.com/quvN7WWz You get nulls because you print variable ?x but only ?pc (from the SELECT ?pc) is in the results. Andy Here's my code. Thank you for your help. -Jenny On Wed, Sep 2,

SPARQL Query not working

2015-09-01 Thread Jenny Jin
Hello, I am trying to run a SPARQL query on Eclipse using Jena. I followed an online tutorial to set everything up. When I run the program, I'm getting a list of "null"s as a result. Could you help me with this? Am I doing something wrong? I am attaching my code. Thank you for your time. -Jenny