使用 sparql 显示具有多个属性的个人

Display Individual with multiple properties using sparql

我有两次包含属性 has_answer 和 has_choice 的个人。

    <!-- http://www.semanticweb.org/myontology#Which_of_the_following_planet_has_the_average_speed_of_about_30Km/Seconds -->

<owl:NamedIndividual rdf:about="&myontology;Which_of_the_following_planet_has_the_average_speed_of_about_30Km/Seconds">
    <rdf:type rdf:resource="&myontology;Question"/>
    <rdfs:label>Which of the following planet has the average speed of about 30Km/Seconds ?</rdfs:label>
    <myontology:QuestionNumber>1</myontology:QuestionNumber>
    <myontology:has_answer rdf:resource="http://dbpedia.org/resource/Earth"/>
    <myontology:has_choice rdf:resource="http://dbpedia.org/resource/Mars"/>
    <myontology:has_choice rdf:resource="http://dbpedia.org/resource/Moon"/>
    <myontology:has_score rdf:resource="&myontology;4_points"/>
    <myontology:has_Level rdf:resource="&myontology;Expert"/>
</owl:NamedIndividual>

我想做的是从个人

获取 属性 列表
+ "SELECT  distinct   ?Qs   ?CorrAns   ?Choice "
        + "WHERE {?Question rdf:type owl:NamedIndividual."
        + "?Question rdfs:label ?Qs.  "
        + "?Question myontology:has_answer ?CorrAns."
        + "?Question myontology:has_choice ?Choice." 
     //   
        + "}"
      //  + "GROUP BY ?Qs"
       + "";
...
     while (rs.hasNext()) { 
            QuerySolution soln = rs.nextSolution(); 
            String Qs = soln.getLiteral("Qs").getString();
            RDFNode choice = soln.get("Choice");
            String ans = choice.asNode().getLocalName();
            RDFNode Canswer = soln.get("CorrAns");
            String cans = Canswer.asNode().getLocalName();
....

给我的结果如下:

Which of the following planet has the average speed of about 30Km/Seconds ? Choice : Mars CorrectAns: Earth
Which of the following planet has the average speed of about 30Km/Seconds ? Choice : Moon CorrectAns: Earth 

我的问题是我怎样才能在一行中得到如下结果:

Which of the following planet has the average speed of about 30Km/Seconds ? ||  choice 1 : Mars  || choice 2 : Moon  || CorrecAns : Earth 

Sparql 可以做到这一点吗?

我按照@AKSW 的回答解决了我的问题,并修复了我的 OWL 文件中的一些问题