Hi Lorenz, I have provided the whole rule in earlier messages. The error comes when I use FACup as string. When I use it as resource, it gives the result but in Annotation area.
// when use as string -> (?x http://www.semanticweb.org/soccer#FavotiteLeague "FACup" ) //it gives error ; expected //when use as resource -> (?x http://www.semanticweb.org/soccer#FavotiteLeague http://www.semanticweb.org/soccer#FACup ) //Annotation problem here On Sat, Jan 14, 2017 at 2:13 PM, Lorenz B. < [email protected]> wrote: > I don't understand why you want to use Strings now. And what kind of > error? An addition to the error stacktrace, we have to see the WHOLE > rule. Is it so difficult to provide complete information? Can you > imagine how difficult it is to help remotely if you omit all necessary > things? > > And I still don't understand the problem before. Using resources should > work, for all other people it's also working. > > > It's the last time that I'll answer here if you continue ignoring my > suggestions to > > 1. upload the current full ontology (the latest that leads to your problem) > 2. show the COMPLETE rule that doesn't work as expected and produces > annotations in Protege > > > Sorry I did mistake in previous email, I used string like this > > > > -> (?x http://www.semanticweb.org/soccer#FavioriteLeague > > > > "FACup" and it gives error. > > > > The string value in rule I found on web from link below: he used rules > like > > > > [rule: (?S rdf:type data:serveur), (?S data:identifiant-reseau > > "POLO")-> (?S data:newproperty "TEST")] > > > > > > http://stackoverflow.com/questions/24649785/jena-rules- > test-a-literal-property-to-string > > > > > > > > On Fri, Jan 13, 2017 at 6:09 PM, neha gupta <[email protected]> > wrote: > > > >> Yes Andy, I tried this and it flushed an error message. Thats why I > asked > >> it if it is possible and if yes, in what way we can use the String in > rule. > >> > >> + " -> (?x http://www.semanticweb.org/soccer#FavioriteLeague > >> > >> http://www.semanticweb.org/soccer# > >> <http://www.semanticweb.org/soccer#FACup>"FACup" > >> > >> On Fri, Jan 13, 2017 at 5:25 PM, Andy Seaborne <[email protected]> wrote: > >> > >>> > >>> On 13/01/17 13:36, neha gupta wrote: > >>> > >>>> Hello Lorenz, I am sorry. > >>>> > >>>> Can we use FACup as string rather than a resource. > >>>> > >>> Have you tried this? > >>> > >>> You are asking something you can debug locally. > >>> > >>> I mean it is also > >>>> possible, if allowed by rules, that we use something like this > >>>> > >>>> (?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# > >>>> <http://www.semanticweb.org/soccer#FACup>"FACup" > >>>> > >>>> )]"; > >>>> > >>>> FACup, ChampLeague etc are just some plain strings. > >>>> > >>>> > >>>> On Fri, Jan 13, 2017 at 12:26 AM, Lorenz Buehmann < > >>>> [email protected]> wrote: > >>>> > >>>> Again, you ignored my suggestion to UPLOAD THE WHOLE ONTOLOGY and SHOW > >>>>> US THE WHOLE RULE that does not work. > >>>>> > >>>>> Not having an individual FACup in your ontology is not really an > >>>>> explanation for me that a property will be rendered as annotation > >>>>> property in Protege after rule execution and storing the data with > Jena. > >>>>> > >>>>> > >>>>> On 12.01.2017 15:57, neha gupta wrote: > >>>>> > >>>>>> I want to ask Lorenz, about the Then part of the rule: > >>>>>> > >>>>>> THEN -> team FavoriteLeague is FACup > >>>>>> > >>>>>> FACup is the resource in my owl (just followed Create Instance tab > in > >>>>>> Protege and Protege has give it the default URI like other > resources in > >>>>>> > >>>>> the > >>>>> > >>>>>> file). > >>>>>> > >>>>>> Before we execute the rule, is it must that we should declare it in > >>>>>> Java > >>>>>> code like we do in Jena class before using it in Rules like > >>>>>> OntClass team = model.getOntClass(ns + "Team") > >>>>>> > >>>>>> Because I am sure the problem lies in the resource FACup (or its > URI). > >>>>>> > >>>>>> Regards > >>>>>> > >>>>>> On Thu, Jan 12, 2017 at 5:43 PM, Lorenz B. < > >>>>>> [email protected]> wrote: > >>>>>> > >>>>>> I don't understand your problem now, sorry. It's too confusing. > >>>>>>> You said that you changed the whole ontology: upload it somewhere > such > >>>>>>> that we can see it > >>>>>>> > >>>>>>> Show the final rule that doesn't work, not in pseudo-syntax but how > >>>>>>> you > >>>>>>> use it in Jena. > >>>>>>> > >>>>>>> Upload the code somewhere > >>>>>>> > >>>>>>> I am sorry for any inconvenience I have created. I really dont know > >>>>>>>> how > >>>>>>>> > >>>>>>> to > >>>>>>> > >>>>>>>> create minimal code snippet or uses Github. > >>>>>>>> > >>>>>>>> Coming to the problem, what I noticed is the problem is in the > object > >>>>>>>> > >>>>>>> i-e > >>>>>> FACup here. > >>>>>>>> team1 FavoriteLeague FACup > >>>>>>>> > >>>>>>>> Because I made changes and coming to the down, used different > >>>>>>>> > >>>>>>> properties > >>>>>> (in place of FavoriteLeague), and made the rule simple to: > >>>>>>>> If x is a Team, then x FavoriteLeague is FACup , > >>>>>>>> If x is a Team, then x Wins is FACup etc just for simplicity. > >>>>>>>> > >>>>>>>> In a nutshell, changed everything except object of rule FACup and > it > >>>>>>>> appears in Annotation area so the problem for sure is in the URI > of > >>>>>>>> > >>>>>>> FACup. > >>>>>>> > >>>>>>>> Now about resources FACup, PremierLeague, ChampionsLeague, these > are > >>>>>>>> > >>>>>>> not > >>>>>> associated with anything in the ontology (neither Types of anything, > >>>>>>> nor > >>>>>> data/object assertions), rather I just created it in Protege with > URI > >>>>>>> like > >>>>>>> > >>>>>>>> other resources. > >>>>>>>> URI of Team Class: http://www.semanticweb.org/soccer#Team > >>>>>>>> URI of FavoriteCategory : http://www.semanticweb.org/ > >>>>>>>> > >>>>>>> soccer#FavoriteCategory > >>>>>>> > >>>>>>>> and URI of FACup: http://www.semanticweb.org/soccer#FACup > >>>>>>>> > >>>>>>>> So I dont know if it is mandatory to get the value of resource > >>>>>>>> http://www.semanticweb.org/soccer#FACup first before the rules > >>>>>>>> > >>>>>>> executes > >>>>>> because simple putting it in the rules not working for me. > >>>>>>>> Sorry once again. > >>>>>>>> > >>>>>>>> > >>>>>>>> On Thu, Jan 12, 2017 at 12:12 PM, Lorenz B. < > >>>>>>>> [email protected]> wrote: > >>>>>>>> > >>>>>>>> in your last answer you wrote > >>>>>>>>> *String ns="http://www.semanticweb.org/soccer > >>>>>>>>> <http://www.semanticweb.org/soccer#FACupGoals>#";* > >>>>>>>>> > >>>>>>>>> if you provide us no information and the information that you > >>>>>>>>> provide > >>>>>>>>> > >>>>>>>> is > >>>>>> of such poor quality, then it's not possible to help you. > >>>>>>>>> Last time that I'll write this here: > >>>>>>>>> > >>>>>>>>> 1. provide the WHOLE ontology (there are many services only where > >>>>>>>>> you > >>>>>>>>> can put your file online for free) > >>>>>>>>> 2. show the minimal code snippet that makes it possible to see > that > >>>>>>>>> it > >>>>>>>>> doesn't work > >>>>>>>>> > >>>>>>>>> Or put everything into a Github project > >>>>>>>>> > >>>>>>>>> > >>>>>>>>> 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) > >>>>>>>>>>>>>>> -- > >>>>>>>>> Lorenz Bühmann > >>>>>>>>> AKSW group, University of Leipzig > >>>>>>>>> Group: http://aksw.org - semantic web research center > >>>>>>>>> > >>>>>>>>> > >>>>>>>>> -- > >>>>>>> Lorenz Bühmann > >>>>>>> AKSW group, University of Leipzig > >>>>>>> Group: http://aksw.org - semantic web research center > >>>>>>> > >>>>>>> > >>>>>>> > >>>>> > -- > Lorenz Bühmann > AKSW group, University of Leipzig > Group: http://aksw.org - semantic web research center > >
