Hello Lorenz Thanks again. My variable is like OntClass favVariable = model.getOntClass(ns + "FavioriteStadium");
//then Jena rule Since I will login to the system as team1, all information saved will be for team1. Similarly for other teams. In my owl file, I have instances (Resources) like "Manchester, Arsenal, Chelsea etc" for objects of my triples like: team1 FavStadium Manchester team2 FavStadium Chelsea etc If I just write the inference model inf to the file like inf.write(), where it will be saved? As data property? I have saved all other properties (not in inference model, but traditional model) like: team1.setPropertyValue(). I dont know how to do this in the inf model case. Regards On Wed, Nov 16, 2016 at 5:21 PM, Lorenz B. < [email protected]> wrote: > > > > Hello > > > > I have a data property in my owl file: "FavoriteStadium" for a team. > > Triples will be like team1 FavoriteStadium ?stadium. > This is NOT a triple but a triple pattern in SPARQL...triples do not > contain variables. > > > > I will infer the instances using a Jena rule like if a team win % is more > > in a particular stadium, it will be her favorite stadium. > > I have two questions here: > > > > 1) How can I get the instances like team1 FavoriteStadium ?stadium. > This is not an instance! Again, this is a triple pattern. An instance > would be team1. > > Is it the right approach? * inf.listResourcesWithProperty( > FavoriteStadium, > > favVariable);* > This will list the subjects, e.g. team1 in your example, but given that > favVariable is a variable, this will not work. Your example is confusing > as you're mixing up SPARQL variable and Java variables. If favVariable > is some RDFNode, i.e. in your case an RDF resource that denotes a > particular stadium, then it will return all resources whose favorite > stadium is the stadium denoted by your Java variable favStadium. > > > > 2) *How can I then save it as data property in a file for team1*? I have > > other properties like this: > > team1 Wins 10 > > team1 Goals 150 > > team1 income 70% > > > > Similarly I want to add it like > > team1 FavoriteStadium ?SomeStadium > Save it as data property? What does this mean? I would assume that a > stadium is an RDF resource, not a plain String literal. > And what do you mean by save to file? You can serialize the whole RDF > model to disk, or you could generate a model for team1 only and > serialize write it to disk, or you could write it as CSV to disk ,or ... > > > > Thanks > > > -- > Lorenz Bühmann > AKSW group, University of Leipzig > Group: http://aksw.org - semantic web research center > >
