- From: Jitao Yang <jitao.yang@gmail.com>
- Date: Tue, 4 Oct 2011 19:26:58 +0200
- To: Andy Seaborne <andy.seaborne@epimorphics.com>
- Cc: semantic-web@w3.org
- Message-ID: <CALDmnw-nXo2DLEejisizMcPfr=dDRNb33-Lfx+rTv4jt4f1PGg@mail.gmail.com>
On Fri, Aug 12, 2011 at 18:55, Andy Seaborne
<andy.seaborne@epimorphics.com>wrote:
>
>
> On 12/08/11 17:36, Jitao Yang wrote:
>
>> Dear all,
>>
>> suppose we have DATA:
>>
>> @prefix foaf: <http://xmlns.com/foaf/0.1/> .
>>
>> _:a foaf:name "Johnny Lee Outlaw" .
>> _:a foaf:mbox <mailto:jlow@example.com <mailto:jlow@example.com>> .
>>
>> _:b foaf:name "Peter Goodguy" .
>> _:b foaf:mbox <mailto:peter@example.org <mailto:peter@example.org>> .
>> _:c foaf:mbox <mailto:carol@example.org <mailto:carol@example.org>> .
>>
>>
>>
>> can we write a SPARQL query like:
>>
>> PREFIX foaf: <http://xmlns.com/foaf/0.1/>
>> SELECT *?property*
>>
>> WHERE{
>> ?x foaf:*?property* "Peter Goodguy".
>>
>> }
>>
>> if we can not, can we write an equivalent SPARQL query? Namely, can we
>> decompose schema and Class(or Property) in SPARQL query?
>>
>> Thanks,
>> Jitao
>>
>
> SPARQL 1.1:
>
> PREFIX foaf: <http://xmlns.com/foaf/0.1/>
> SELECT ( substr( str(?p), strlen(str(foaf:))+1 )
> AS ?property)
>
> WHERE{
> ?x ?p "Peter Goodguy".
> }
>
>
>
> In SPARQL 1.0, you can't return anything not already in the graph : in
> SPARQL 1.1 you can do some manipulation of RDF terms.
>
> Because SUBSTR is fn:substring, indexes are 1-based.
>
> Andy
>
>
Dear Andy,
I think that this query:
-------------------------------------------------------------
SPARQL 1.1:
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT ( substr( str(?p), strlen(str(foaf:))+1 )
AS ?property)
WHERE{
?x ?p "Peter Goodguy".
}
-------------------------------------------------------------
can not fix the shema foaf, because it just calculate the length of foaf,
therefore if we have foaf2:
<http://xmlns.com/foaf/0.2/<http://xmlns.com/foaf/0.1/>>,
with the same length as foaf, then, the data in foaf2 can also be queried
out.
Am I right?
If I am right, do we have the method to fix the shema or propery/class?
Thank you!
Best regards,
Jitao
Received on Tuesday, 4 October 2011 17:28:05 UTC