You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Anthony Ramalho <an...@yahoo.com> on 2012/04/11 14:35:49 UTC
Doubt about SPARQL with Jena
Hello,
I'm performing some queries using SPARQL with Jena in an Ontology created using Protégé, where I wanna receive the name of the element and some characteristics.
My problem is that when I perform my query it always returns me the pieces of information I need, but the table has also the datatype explicit after my results, as I you can see in this example:
----------------------------------------------------------------------------------------------------
| Instancias | Nome |
==================================================================
| dea:B-98540AB | "Elemento B-98540 A e B"^^<http://www.w3.org/2001/XMLSchema#string> |
| dea:B-98541AB | "Elemento B-98541 A e B"^^<http://www.w3.org/2001/XMLSchema#string> |
----------------------------------------------------------------------------------------------------
I've tried to find a way of supressing the datatype and have only the lexical form. Somebody suggested using STR, but it didn't work.
I know that I can use commands in Java to manipulate Strings, but it would be better receiving just the lexical form of the elements directly from SPARQL.
Does anybody know how can I do that or can indicate some documentation about SPARQL, other than the one provided by the W3C (I've already read it and couldn't find an answer)?
Thanks for your help,
Anthony Andrey
Re: Doubt about SPARQL with Jena
Posted by Anthony Ramalho <an...@yahoo.com>.
Andy,
The problem is that researching documentation from W3C, there were just examples using REGEX and STR together, so I couldn't see that it was possible specify in the SELECT command what kind of return I'd desired. Therefore, in all my tests that examples helped me just to restrict results, but with datatype information insisting in appear.
Thank you again,
Anthony
From: Anthony Ramalho <an...@yahoo.com>
To: "jena-users@incubator.apache.org" <je...@incubator.apache.org>
Sent: Wednesday, April 11, 2012 10:28 AM
Subject: Re: Doubt about SPARQL with Jena
Andy,
Thank you very much for your support. It worked!
Sds,
Anthony Andrey
From: Andy Seaborne <an...@apache.org>
To: jena-users@incubator.apache.org
Sent: Wednesday, April 11, 2012 10:01 AM
Subject: Re: Doubt about SPARQL with Jena
On 11/04/12 13:35, Anthony Ramalho wrote:
> Hello,
>
> I'm performing some queries using SPARQL with Jena in an Ontology created using Protégé, where I wanna receive the name of the element and some characteristics.
> My problem is that when I perform my query it always returns me the pieces of information I need, but the table has also the datatype explicit after my results, as I you can see in this example:
>
> ----------------------------------------------------------------------------------------------------
> | Instancias | Nome |
> ==================================================================
> | dea:B-98540AB | "Elemento B-98540 A e B"^^<http://www.w3.org/2001/XMLSchema#string> |
> | dea:B-98541AB | "Elemento B-98541 A e B"^^<http://www.w3.org/2001/XMLSchema#string> |
> ----------------------------------------------------------------------------------------------------
>
> I've tried to find a way of supressing the datatype and have only
> the
lexical form. Somebody suggested using STR, but it didn't work.
What did you try? Please show your query.
> I know that I can use commands in Java to manipulate Strings, but it
would be better receiving just the lexical form of the elements directly
from SPARQL.
> Does anybody know how can I do that or can indicate some
> documentation
about SPARQL, other than the one provided by the W3C (I've already read
it and couldn't find an answer)?
>
> Thanks for your help,
>
> Anthony Andrey
SELECT (STR(?Nome) AS ?NomeNoDT)
{
....
}
or
SELECT ?NomeNoDT
{
....
BIND (STR(?Nome) AS ?NomeNoDT)
}
Andy
Re: Doubt about SPARQL with Jena
Posted by Anthony Ramalho <an...@yahoo.com>.
Andy,
Thank you very much for your support. It worked!
Sds,
Anthony Andrey
From: Andy Seaborne <an...@apache.org>
To: jena-users@incubator.apache.org
Sent: Wednesday, April 11, 2012 10:01 AM
Subject: Re: Doubt about SPARQL with Jena
On 11/04/12 13:35, Anthony Ramalho wrote:
> Hello,
>
> I'm performing some queries using SPARQL with Jena in an Ontology created using Protégé, where I wanna receive the name of the element and some characteristics.
> My problem is that when I perform my query it always returns me the pieces of information I need, but the table has also the datatype explicit after my results, as I you can see in this example:
>
> ----------------------------------------------------------------------------------------------------
> | Instancias | Nome |
> ==================================================================
> | dea:B-98540AB | "Elemento B-98540 A e B"^^<http://www.w3.org/2001/XMLSchema#string> |
> | dea:B-98541AB | "Elemento B-98541 A e B"^^<http://www.w3.org/2001/XMLSchema#string> |
> ----------------------------------------------------------------------------------------------------
>
> I've tried to find a way of supressing the datatype and have only
> the
lexical form. Somebody suggested using STR, but it didn't work.
What did you try? Please show your query.
> I know that I can use commands in Java to manipulate Strings, but it
would be better receiving just the lexical form of the elements directly
from SPARQL.
> Does anybody know how can I do that or can indicate some
> documentation
about SPARQL, other than the one provided by the W3C (I've already read
it and couldn't find an answer)?
>
> Thanks for your help,
>
> Anthony Andrey
SELECT (STR(?Nome) AS ?NomeNoDT)
{
....
}
or
SELECT ?NomeNoDT
{
....
BIND (STR(?Nome) AS ?NomeNoDT)
}
Andy
Re: Doubt about SPARQL with Jena
Posted by Andy Seaborne <an...@apache.org>.
On 11/04/12 13:35, Anthony Ramalho wrote:
> Hello,
>
> I'm performing some queries using SPARQL with Jena in an Ontology created using Protégé, where I wanna receive the name of the element and some characteristics.
> My problem is that when I perform my query it always returns me the pieces of information I need, but the table has also the datatype explicit after my results, as I you can see in this example:
>
> ----------------------------------------------------------------------------------------------------
> | Instancias | Nome |
> ==================================================================
> | dea:B-98540AB | "Elemento B-98540 A e B"^^<http://www.w3.org/2001/XMLSchema#string> |
> | dea:B-98541AB | "Elemento B-98541 A e B"^^<http://www.w3.org/2001/XMLSchema#string> |
> ----------------------------------------------------------------------------------------------------
>
> I've tried to find a way of supressing the datatype and have only
> the
lexical form. Somebody suggested using STR, but it didn't work.
What did you try? Please show your query.
> I know that I can use commands in Java to manipulate Strings, but it
would be better receiving just the lexical form of the elements directly
from SPARQL.
> Does anybody know how can I do that or can indicate some
> documentation
about SPARQL, other than the one provided by the W3C (I've already read
it and couldn't find an answer)?
>
> Thanks for your help,
>
> Anthony Andrey
SELECT (STR(?Nome) AS ?NomeNoDT)
{
....
}
or
SELECT ?NomeNoDT
{
....
BIND (STR(?Nome) AS ?NomeNoDT)
}
Andy