You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Charles Li <ch...@gmail.com> on 2013/08/29 03:32:12 UTC

SPARQL Query to retrieve a particular RdfId

I want to query a Jena model loaded by TDB from an RDF/XML file to get all subjects whose objects each contains one particular RDFID. I tried the following SPARQL query and it didn't return any result.
 
select ?s  WHERE
{
   ?s  ?p  ?o .
   FILTER(CONTAINS(?o, "_{9F750A5B-F02E-4B64-8D78-D0F527ACB900}>"))
}
 
I guess ?o is a Resource, and there should be some SPARQL function to apply to "?o" first to extract the RDFID string and then do the "CONTAINS" function, but I just couldn't find such a function.
 
Please help!

Thanks a lot!!
- Charles
 

Re: SPARQL Query to retrieve a particular RdfId

Posted by Charles Li <ch...@gmail.com>.
Never mind, figured out - str() function.

Sorry for bothering!

Thanks!
- Charles

On Aug 28, 2013, at 6:32 PM, Charles Li <ch...@gmail.com> wrote:

> I want to query a Jena model loaded by TDB from an RDF/XML file to get all subjects whose objects each contains one particular RDFID. I tried the following SPARQL query and it didn't return any result.
>  
> select ?s  WHERE
> {
>    ?s  ?p  ?o .
>    FILTER(CONTAINS(?o, "_{9F750A5B-F02E-4B64-8D78-D0F527ACB900}>"))
> }
>  
> I guess ?o is a Resource, and there should be some SPARQL function to apply to "?o" first to extract the RDFID string and then do the "CONTAINS" function, but I just couldn't find such a function.
>  
> Please help!
> 
> Thanks a lot!!
> - Charles
>