Hi Lorenz, the ns is wrong, how? String ns="http://www.semanticweb.org/soccer#
Rule: (?x http://www.w3.org/1999/02/22-rdf-syntax-ns#type http:// www.semanticweb.org/soccer#Team) " + "( ?x http://www.semanticweb.org/soccer#FACupGoals ?goals )" + "greaterThan(?goals,30) + " -> (?x http://www.semanticweb.org/soccer#FavioriteLeague http://www.semanticweb.org/soccer#FACup )] On Thu, Jan 12, 2017 at 1:03 AM, Lorenz Buehmann < [email protected]> wrote: > > > On 11.01.2017 22:10, neha gupta wrote: > > Hello Lorenz, I am sure I have used the FavoriteLeague as Data Property > in > > Protege and it has the same URI as other data properties and other > > resources in the ontology ie http://www.semanticweb.org/soccer# > > <http://www.semanticweb.org/soccer#FACupGoals>FavoriteLeague. > > > > I have changed the spelling of FavoriteLeague. to FavoLeague, favLeague, > > but every time the same disappointing result. > > My namespace is also same in whole program: > > > > *String ns="http://www.semanticweb.org/soccer > > <http://www.semanticweb.org/soccer#FACupGoals>#";* > Ehm that's a totally wrong namespace declaration. To be honest, I don't > understand why you don't see this...and the namespace in the rule is > obviously NOT the same then > > favleague is declared as: > > > > *OntProperty favleague=model.getOntProperty(ns+ "FavoriteLeague");* > Please tell me, what do you think is the concatenation of the String in > the variable ns and the String "FavoriteLeague" ? > > > > //All my data properties are declared like this and it works. For ex: > Goal > > property > > OntProperty goals=model.getOntProperty(ns+ "Goals"); > > > > > > On Wed, Jan 11, 2017 at 9:41 PM, Lorenz Buehmann < > > [email protected]> wrote: > > > >> Chris is right. It's beginning to become annoying if youalways ignore > >> our advices to show data + the code - all the code. Even now you omitted > >> information like > >> > >> * the declaration of the variable ns > >> > >> * the declaration of the variable favcat > >> > >> > >> And indeed the data. IF you have anywhere in the code and/or data a > >> typo, the rule not "fire", thus no data will be inferred. In your case, > >> I'm pretty sure that data is inferred (you said that Protege shows it as > >> annotation) - but the inferred property is nowhere declared as > >> owl:DatatypeProperty in the ontology. This is mandotory for OWL/OWL > >> API/Protege > >> > >> > >> On 11.01.2017 16:48, neha gupta wrote: > >>> I used like this > >>> > >>> *OntProperty favleague=model.getOntProperty(ns+ "FavioriteLeague");* > >>> Then I wrote this rule: > >>> > >>> (?x http://www.w3.org/1999/02/22-rdf-syntax-ns#type > >>> http://www.semanticweb.org/soccer#Team) " > >>> > >>> + "( ?x http://www.semanticweb.org/soccer#FACupGoals ?goals )" + > >>> > >>> "greaterThan(?goals,30) > >>> + " -> (?x http://www.semanticweb.org/ > soccer#FavioriteLeague > >>> http://www.semanticweb.org/soccer#FACup )]"; > >>> //FACupe is resource in the ontology: > >>> > >>> Then > >>> *inf.listStatements(null,favcat,(RDFNode)null);* > >>> > >>> > >>> I think the problem is not in typo because I run similar rule for > another > >>> data property FavioriteStadium and it also saves in Annotation area. > >>> > >>> On Wed, Jan 11, 2017 at 6:31 PM, Chris Dollin < > >> [email protected]> > >>> wrote: > >>> > >>>> On 11/01/17 15:15, neha gupta wrote: > >>>> > >>>>> Even this not works > >>>>> > >>>>> inf.listStatements(null,favleague,(RDFNode)null); > >>>>> > >>>>> Gives the result but in Annotation area of Protege > >>>>> > >>>> COMPLETE MINIMAL EXAMPLE, please. You have so many > >>>> errors & omissions in the code you show us we can't > >>>> tell which one is the one you're asking about. > >>>> > >>>> If Protege is putting things in the annotation area > >>>> I'd guess that means the thing isn't declared as either > >>>> a DataProperty or an ObjectProperty. Given your erratic > >>>> spelling that's quite likely. > >>>> > >>>> > >>>> Chris > >>>> > >>>> -- > >>>> "He could not weigh up which was worse and so tried not to think about > >>>> either." > >>>> /The Spellgrinder's > >>>> Apprentice/ > >>>> > >>>> Epimorphics Ltd, http://www.epimorphics.com > >>>> Registered address: Court Lodge, 105 High Street, Portishead, Bristol > >> BS20 > >>>> 6PT > >>>> Epimorphics Ltd. is a limited company registered in England (number > >>>> 7016688) > >>>> > >> > >
