Re: Jena rules not working

2016-09-21 Thread Andy Seaborne
Classes are identified by URIs, not by strings. On 21/09/16 11:46, javed khan wrote: Hello Andy, shouldn't there be the class name to which we assign new individuals.? inf.listResourcesWithProperty(RDF.type, "GoodStudent") Dave run this code and it works for him, but I do not know why, it does

Re: Jena rules not working

2016-09-21 Thread javed khan
Hello Andy, shouldn't there be the class name to which we assign new individuals.? inf.listResourcesWithProperty(RDF.type, "GoodStudent") Dave run this code and it works for him, but I do not know why, it does not work for me. On Wed, Sep 21, 2016 at 2:18 AM, Andy Seaborne

Re: Jena rules not working

2016-09-21 Thread javed khan
Hello Andy, I used this: ?x URI#GPA ?score + "greaterThan(?score, 3) ?score will return the scores/GPA of students and if it is greater than 3, it will assign user to GoodStudent class. On Wed, Sep 21, 2016 at 2:18 AM, Andy Seaborne wrote: > The rules have some syntax

Re: Jena rules not working

2016-09-21 Thread Lorenz B.
> model.getProperty(ns,"GPA"); I think this works for me and store the data > property GPA in the file. > > Actually I do not need this: Model::createProperty(String nameSpace, String > localName) > as I have already created the property in my owl file and just needs > getProperty() method. > >

Re: Jena rules not working

2016-09-21 Thread Andy Seaborne
The rules have some syntax problems: "( ?x http://www.semanticweb.org#GPA ?score + )" as mentioned earlier in the thread then "greaterThan(?score, userscore) " but userscore is a java variable. Also inf.listResourcesWithProperty(RDF.type, "GoodStudent") uses a string not a URI so if

Re: Jena rules not working

2016-09-21 Thread javed khan
model.getProperty(ns,"GPA"); I think this works for me and store the data property GPA in the file. Actually I do not need this: Model::createProperty(String nameSpace, String localName) as I have already created the property in my owl file and just needs getProperty() method. If I use this :

Re: Jena rules not working

2016-09-21 Thread Lorenz B.
Are you sure that this code compiles? > Property prop= model.getProperty(ns,"GPA"); ns is a String in your code, the method expects a Resource object is first argument. You totally use the wrong method here, as it returns a Statement. Model::createProperty(String nameSpace, String localName)

Re: Jena rules not working

2016-09-20 Thread javed khan
public class Student { //here call from another class where name is student name and score is GPA static void use(String name, int score) { int userscore=score; OntModel model=ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM); InputStream in

Re: Jena rules not working

2016-09-20 Thread Lorenz B.
@Javed: It would be good if you show us the WHOLE CURRENT part of the code and some sample data, otherwise it's useless to continue the discussion here. > On 19/09/16 17:14, javed khan wrote: >> Hello Dave, though I have Student class in my owl and GoodStudent as the >> subclass of Student but

Re: Jena rules not working

2016-09-19 Thread Dave Reynolds
On 19/09/16 17:14, javed khan wrote: Hello Dave, though I have Student class in my owl and GoodStudent as the subclass of Student but this statement gives me error and does not recognize GoodStudent. for (Iterator i = inf.listResourcesWithProperty(RDF.type, *GoodStudent*); i.hasNext();) {

Re: Jena rules not working

2016-09-19 Thread javed khan
It does not recognize the class name but only property names. On Mon, Sep 19, 2016 at 9:14 AM, javed khan wrote: > Hello Dave, though I have Student class in my owl and GoodStudent as the > subclass of Student but this statement gives me error and does not > recognize

Re: Jena rules not working

2016-09-19 Thread javed khan
Hello Dave, though I have Student class in my owl and GoodStudent as the subclass of Student but this statement gives me error and does not recognize GoodStudent. for (Iterator i = inf.listResourcesWithProperty(RDF.type, *GoodStudent*); i.hasNext();) { System.out.println("Good

Re: Jena rules not working

2016-09-18 Thread javed khan
Thanks a lot Dave, let me try it. I hope it will help. Regards On Sun, Sep 18, 2016 at 1:28 PM, Dave Reynolds wrote: > On 18/09/16 21:24, javed khan wrote: > >> Thanks Lorenz and Dave, I have corrected the http://www.semanticweb.org# >>

Re: Jena rules not working

2016-09-18 Thread Dave Reynolds
On 18/09/16 21:24, javed khan wrote: Thanks Lorenz and Dave, I have corrected the http://www.semanticweb.org# Student to ?x but it does not work.Actually it does not save the updated marks/GPA of student and when I remove the Jena rules part, it then updates and

Re: Jena rules not working

2016-09-18 Thread javed khan
Thanks Lorenz and Dave, I have corrected the http://www.semanticweb.org# Student to ?x but it does not work.Actually it does not save the updated marks/GPA of student and when I remove the Jena rules part, it then updates and save the GPA. I also try the SPARQL

Re: Jena rules not working

2016-09-18 Thread Lorenz Buehmann
The second condition of your rule doesn't make any sense as the subject is Student and it should be ?x. On 18.09.2016 17:41, javed khan wrote: > This code does not work. I want to save student marks/GPA in the file and > based on GPA assign students to GoodStudent or WorstStudents sub classes of

Re: Jena rules not working

2016-09-18 Thread Dave Reynolds
On 18/09/16 16:41, javed khan wrote: This code does not work. You haven't shown us the data and haven't said in what way it doesn't work. I want to save student marks/GPA in the file and based on GPA assign students to GoodStudent or WorstStudents sub classes of Student via Jena rules.

Jena rules not working

2016-09-18 Thread javed khan
This code does not work. I want to save student marks/GPA in the file and based on GPA assign students to GoodStudent or WorstStudents sub classes of Student via Jena rules. OntModel model=ModelFactory.createOntologyModel(); InputStream in =FileManager.get().open("C://std.owl");

Re: Jena Rules not working

2016-07-26 Thread javed khan
Thanks a lot, error is no longer there but not displaying the required result either i-e instance of StudentExpert class. I, for test case, created instance of StudentExpert and it display it (so no problem in ontology) but when I remove the instance, again it display nothing. It means reasoner

Re: Jena Rules not working

2016-07-26 Thread Lorenz B.
As Dave said, wrong PREFIX declaration. >> >> "Select *" + "where { ?x rdf:type std:StudentExpert }"; >> Moreover, your String concatenation will lead to Select *where { ?x rdf:type std:StudentExpert } i.e. there is a missing whitespace before "where". -- Lorenz Bühmann AKSW

Re: Jena Rules not working

2016-07-26 Thread Dave Reynolds
On 26/07/16 09:53, javed khan wrote: I have class *Expert*, *Research* and *Student*. Student has Master and Phd subclasses. Expert hasResearch Research, like BernersLee hasResearch Ontologies. Phd Student also have Research like: Khan hasResearch Ontologies. I added a class *StudentExpert*

Jena Rules not working

2016-07-26 Thread javed khan
I have class *Expert*, *Research* and *Student*. Student has Master and Phd subclasses. Expert hasResearch Research, like BernersLee hasResearch Ontologies. Phd Student also have Research like: Khan hasResearch Ontologies. I added a class *StudentExpert* which have no instance but can be created