SELECT *
WHERE { ?questions dd:hasCategory dd:CatPhysics ; dd:hasLevel dd:levEasy ;
dd:hasComplexity ?y} order by ?yLorenz, Each question has three categories (subjects), has level , and recently I added hasComplexity which has values 1-5. I have added a Complexity class and its members are 1-5 numbers. Domain is Question class and range is Complexity class. The query inside Jena works, load questions/answers/choices etc but not in the order I want. Regards On Sat, Feb 4, 2017 at 1:44 PM, Lorenz B. < [email protected]> wrote: > That doesn't answer my question. Can you try to compare the same queries > please? > > Moreover what's missing: > > 1. sample code > 2. sample data > 3. sample output > > > The queries are different because in Protege I retrieve only questions > and > > their complexity number while in Jena I get questions, answers, choices, > > scores and its complexity order. > > > > Regards > > > > On Fri, Feb 3, 2017 at 6:36 PM, Sidra shah <[email protected]> > wrote: > > > >> Thank you Lorenz, 1,2,3,4,5 are resources and it has URIs. Question has > >> object property and value will be selected from one of the five values > in > >> the owl file. > >> > >> Regards > >> > >> On Fri, Feb 3, 2017 at 6:26 PM, Lorenz Buehmann > <[email protected] > >> leipzig.de> wrote: > >> > >>> "object property hasComplexity (its values are 1,2,3,4,5)" > >>> > >>> -> why do you say it's an object property if the values are numerical? > >>> > >>> > >>> Moreover, you compare two different queries and then say one works in > >>> Protege, the other not. That is a totally useless statement. It should > >>> be clear that you should compare the SAME queries > >>> > >>> > >>> It remains open what kind of RDF term the complexity values > >>> are...literals or resources > >>> > >>> > >>> On 03.02.2017 16:18, Sidra shah wrote: > >>>> Hello, This query works fine and get data i-e Questions, answers, > >>> choices > >>>> and their score. But when I want to include object property > >>> hasComplexity > >>>> (its values are 1,2,3,4,5) and try to order it, its not working. (The > >>> query > >>>> still get data but not in order). > >>>> While this works inside Protege and show questions in order: > >>>> SELECT * > >>>> WHERE { ?questions dd:hasCategory dd:CatPhysics ; dd:hasLevel > >>> dd:levEasy ; > >>>> dd:hasComplexity ?y} order by ?y > >>>> > >>>> > >>>> //This query is in Jena code: I copy here it in Jena syntax > >>>> > >>>> "SELECT * " + > >>>> " WHERE { " > >>>> + "?Qs mo:Question ?QsDesc. " > >>>> > >>>> + "?QS mo:hasAnswers ?AnsQ. " > >>>> + "?AnsQ mo:hasQuestion ?Qs. " > >>>> + "?AnsQ mo:ChoiceOne ?ANSONE." > >>>> + "?AnsQ mo:ChoiceTwo ?ANSWTWO." > >>>> + "?AnsQ mo:ChoiceThree ?ANSWTHREE." > >>>> + "?AnsQ mo:CorrChoice ?ANSCORR. " > >>>> + "?Qs mo:hasCategory ?Cat. " > >>>> + "?Cat mo:category ?CatName. " > >>>> + "?Qs mo:hasLevel ?lev. " > >>>> > >>>> + "?lev mo:level ?LevName. " > >>>> + "?Qs mo:hasScore ?point." > >>>> + "?point mo:score ?Score. " > >>>> > >>>> + "?Qs mo:hasComplexity ?l. " > >>>> > >>>> + "FILTER ( ?CatName ='"+ctg+"' ). " > >>>> + "FILTER ( ?LevName ='"+lvl+"' ). " > >>>> > >>>> > >>>> + "}" > >>>> + "ORDER BY (?l) " > >>>> + ""; > >>>> > >>> > -- > Lorenz Bühmann > AKSW group, University of Leipzig > Group: http://aksw.org - semantic web research center > >
