|
From: Christian W. <cw...@cw...> - 2007-01-23 12:44:29
|
Hello all,
I face a very big problem regarding my SparqlEngineDb implementation:
Sorting.
One can sort by any variable of any type in Sparql. The data type of the
values is stored in statements/l_datatype column and can hardly be
directly used in a SQL query.
Imagine the following query:
----------------------
SELECT ?name ?emp
WHERE { ?x foaf:name ?name ;
ex:empId ?emp
}
ORDER BY ASC(?emp)
----------------------
Now ?emp is an object following an "ex:empId" predicate, making the
datatype of ?emp xsd:integer. Making the SQL query in this case is easy;
just "ORDER BY CAST(emp as INTEGER) ASC" and it's done.
Main problem is that I don't know in advance which data type the column
will have (as there could be statements like "?a ?b ?c .", ordering by
?c) and that, even more serious, there could be multiple data types in
this data.
I don't know what to do here. The only ideas I came up with are:
1) Use a stored procedure which does comparison. This will render the
engine useless for older db systems such as mysql < 5. I also need to
get into stored procedures, but I think it is possible to hook into sorti=
ng.
2) Sort on the client side. I would like to omit this since it would
decrease performance greatly. Further, I couldn't use server-side
LIMITs, making performance even worse.
3) Provide data type hints in the query, which would make the sparql
implementation understand proprietary queries and still wouldn't work
with normal queries.
Anybody an idea what I could do?
Btw, RDQL doesn't even provide ORDER support. I think I know why..
--=20
Regards/Mit freundlichen Gr=C3=BC=C3=9Fen
Christian Weiske
|