Hello, I copied the object properties here. I have object property (which
has problem) hasComplexity. Its domain is Question and range is Complexity
class. Complexity class have now members A,B,C



<?xml version="1.0"?>


<!DOCTYPE rdf:RDF [
    <!ENTITY owl "http://www.w3.org/2002/07/owl#"; >
    <!ENTITY xsd "http://www.w3.org/2001/XMLSchema#"; >
    <!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#"; >
    <!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#"; >
    <!ENTITY named "http://www.semanticweb.org/t/ontologies/2016/7/named#"; >
    <!ENTITY myOWL "http://www.semanticweb.org/t/ontologies/2016/7/myOWL#"; >
]>


<rdf:RDF xmlns="http://www.semanticweb.org/t/ontologies/2016/7/myOWL#";
     xml:base="http://www.semanticweb.org/t/ontologies/2016/7/myOWL";
     xmlns:named="http://www.semanticweb.org/t/ontologies/2016/7/named#";
     xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#";
     xmlns:owl="http://www.w3.org/2002/07/owl#";
     xmlns:xsd="http://www.w3.org/2001/XMLSchema#";
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
     xmlns:myOWL="http://www.semanticweb.org/t/ontologies/2016/7/myOWL#";>
    <owl:Ontology rdf:about="
http://www.semanticweb.org/t/ontologies/2016/7/myOWL"/>



    <!--

///////////////////////////////////////////////////////////////////////////////////////
    //
    // Object Properties
    //

///////////////////////////////////////////////////////////////////////////////////////
     -->






    <!-- http://www.semanticweb.org/t/ontologies/2016/7/myOWL#hasAnswers -->

    <owl:ObjectProperty rdf:about="&myOWL;hasAnswers">
        <rdf:type rdf:resource="&owl;InverseFunctionalProperty"/>
        <rdfs:range rdf:resource="&myOWL;Answers"/>
        <rdfs:domain rdf:resource="&myOWL;Questions"/>
        <owl:inverseOf rdf:resource="&myOWL;hasQuestion"/>
    </owl:ObjectProperty>



    <!-- http://www.semanticweb.org/t/ontologies/2016/7/myOWL#hasCategory
-->

    <owl:ObjectProperty rdf:about="&myOWL;hasCategory"/>



    <!-- http://www.semanticweb.org/t/ontologies/2016/7/myOWL#hasComplexity
-->

    <owl:ObjectProperty rdf:about="&myOWL;hasComplexity">
        <rdfs:range rdf:resource="&myOWL;Complexity"/>
        <rdfs:domain rdf:resource="&myOWL;Questions"/>
    </owl:ObjectProperty>



    <!-- http://www.semanticweb.org/t/ontologies/2016/7/myOWL#hasLevel -->

    <owl:ObjectProperty rdf:about="&myOWL;hasLevel"/>



    <!-- http://www.semanticweb.org/t/ontologies/2016/7/myOWL#hasQuestion
-->

    <owl:ObjectProperty rdf:about="&myOWL;hasQuestion">
        <rdf:type rdf:resource="&owl;InverseFunctionalProperty"/>
        <rdfs:domain rdf:resource="&myOWL;Answers"/>
        <rdfs:range rdf:resource="&myOWL;Questions"/>
    </owl:ObjectProperty>



    <!-- http://www.semanticweb.org/t/ontologies/2016/7/myOWL#hasScore -->

    <owl:ObjectProperty rdf:about="&myOWL;hasScore"/>



On Sat, Feb 4, 2017 at 6:58 PM, Andy Seaborne <[email protected]> wrote:

>
>
> On 04/02/17 14:38, A. Soroka wrote:
>
>> Thank you Lorenz, you mean I copy the turtle of my ontology here? It will
>>> be very large?
>>>
>>
>> Then put it on a site like Github or Pastebin and put a link in your
>> message.
>>
>
> Then create a small sample that illustrates the problem.
>
> A minimal-complete-example is not a dump of everything you have.  It is
> creating a focused question.  In fact, just the act of creating it can help
> you understand the problem.
>
>     Andy
>
>
>
>> ---
>> A. Soroka
>> The University of Virginia Library
>>
>> On Feb 4, 2017, at 7:45 AM, Sidra shah <[email protected]> wrote:
>>>
>>> Thank you Lorenz, you mean I copy the turtle of my ontology here? It will
>>> be very large?
>>>
>>> Actually what makes me confuse, when I run the same query in Protege(with
>>> all Qs,Ans/Options), it works and order the questions.
>>> In Jena, the order by part does not work.
>>>
>>> Regards
>>>
>>> On Sat, Feb 4, 2017 at 2:50 PM, Lorenz B. <
>>> [email protected]> wrote:
>>>
>>> Sample data is not an abstract description of the data...it is proper
>>>> instance data, in best case in TURTLE syntax.
>>>>
>>>> Sample code is still missing.
>>>>
>>>> Sample output is not telling me that something does not work as
>>>> expected...
>>>>
>>>> "Not in the oder you want" is no real specification. The query will
>>>> order by the URIs of the complexity values. If not it's a bug.
>>>>
>>>> But again, we need sample data, sample, code, which is also know as MWE.
>>>> And also the Jena version is interesting for the developers.
>>>>
>>>> SELECT *
>>>>> WHERE { ?questions dd:hasCategory dd:CatPhysics ; dd:hasLevel
>>>>> dd:levEasy
>>>>>
>>>> ;
>>>>
>>>>> dd:hasComplexity ?y} order by ?y
>>>>>
>>>>> Lorenz, 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
>>>>>>
>>>>>>
>>>>>> --
>>>> Lorenz Bühmann
>>>> AKSW group, University of Leipzig
>>>> Group: http://aksw.org - semantic web research center
>>>>
>>>>
>>>>
>>

Reply via email to