Suggestion on Limiting query results to specific vocabulary/ontology/namespace

(Apologies for cross-posting)
Hi, 

I am looking for a generic solution to limit the query results to specific
vocabulary or a set of vocabularies.

A simple query like below is proving to be quite expensive while sending it
to sparql endpoints.
select * where { 
?s ?p ?o.
filter  regex(str(?s),"http://purl.org/vocab/ ","i")
}
limit 1

Virtuoso S1T00 Error SR171: Transaction timed out
(http://dbpedia.org/sparql)

This is required for us since we are dealing with distributing querying of
LOD cloud and  we often need to limit the results to specific
ontology/vocabulary. 
One of the obvious solution would be to query without the filter operator
and perform filter locally if there's any matching triples.  This does not
help because the number of returned results might not include the triples
containing the required vocabulary though the dataset might contain it. 

It would be great if I could receive insights and thoughts on dealing with
it.

1. Does it require extending sparql to include special function/operator ?
(The above query would return results if resource is not limited)

2. Is it a problem with the RDF stores that they don't' maintain the
'prefix-based index' ?

Thanks,
Amit

Received on Tuesday, 1 November 2011 21:31:29 UTC