質問

I use AllegroGraph and Sparql to query the results. I am trying to sort based on alphabetical order, but Sparql gives the upper case more preference. Below is an analogous data and query that resembles my issue.

Data:

<http://mydomain.com/person1> <http://mydomain.com/name> "John"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral>
<http://mydomain.com/person1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://mydomain.com/person>

<http://mydomain.com/person2> <http://mydomain.com/name> "Abraham"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral>
<http://mydomain.com/person2> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://mydomain.com/person>    

<http://mydomain.com/person3> <http://mydomain.com/name> "edward"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral>
<http://mydomain.com/person3> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://mydomain.com/person>

I am trying to sort based on alphabetical order on names - so the result should be Abraham, edward and then John. But the result is Abraham, John and then edward since edward starts with smaller case. Please let me know how to achieve this.

Query:

select ?person ?name where
{
  ?person <http://mydomain.com/name> ?name.
  ?person <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://mydomain.com/person>.
  } order by asc(str(?name))
役に立ちましたか?

解決

SPARQL 1.1: order by asc(UCASE(str(?name)))

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top