SPARQL exception

HI Team,

I created a virtual graph using My SQL DB and executing a SPARQL over it. I want to use GROUP by in the SPARQL. There are 2 fields i want to group by. One is working fine, but while grouping by other field, it shows Internal Server Error and log says:
Caused by: java.sql.SQLException: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '='

Can you please help me with the same!

Thank you!

You need to fix the collation type on your database. You should be able to find lots of answers to this problem if you do a search on the error "Caused by: java.sql.SQLException: Illegal mix of collations (latin1_swedish_ci,IMPLICIT)"

It looks like your database is using latin1_sweedish but Stardog is using UTF-8. I'm not sure if you can just force UTF-8 on the connection by adding characterEncoding=UTF-8 on the jdbc connection string or if you need to update the collation type in the database.

Here is a good resource I found for addressing the issues and should get you going

Have you added any connections properties to your MySQL connection string? If not, and your database fields are using UTF-8, you can add characterEncoding=UTF-8 as a property on your MySQL JDBC URL.

Are you able to share your SPARQL query and the query plan? Are you using reasoning? Is there a portion of the query apart from the virtual graph block?

Jess

Hi Jess,

Thank you for getting back!
I am not using any conection properties with connection string.
Will check DB for UTF-8
Query looks like :
PREFIX classA:http://api.stardog.com/A#
PREFIX classB:http://api.stardog.com/B#

PREFIX A:http://api.stardog.com/A#
PREFIX mv:http://api.stardog.com/A_version#

select ?Aid ?lastupdate ?Aname where{
GRAPH virtual://AManager{
?A rdf:type :A.
?A A:ID ?Aid.
?Aversion rdf:type :A_version.
?Aversion mv:AID ?Aid.
?Aversion mv:ID ?mvid.
?Aversion mv:VERSION ?version.
?A A:DESCRIPTION ?description.
?A A:A_NAME ?Aname.
}
{
select ?Aid (MAX(?last_update_date) as ?lastupdate) where {
GRAPH virtual://AManager{
?Aversion mv:LAST_UPDATE ?last_update_date.
?Aversion mv:AID ?Aid.
}
}GROUP BY ?Aid
}
}

I am not using any reasoning!
And there is no other part other than virtual graph!

Thank you!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.