stanbol-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrea Giovanni Nuzzolese <nuzzo...@cs.unibo.it>
Subject SPARQL serialization of FieldQuery
Date Wed, 08 Jun 2011 17:20:06 GMT
Hi,

I am trying to use the query service provided by the EntityHub.
The JSON field query I wrote is the following

{
"selected": ["http:\/\/www.w3.org\/2000\/01\/rdf-schema#label",
"http:\/\/www.w3.org\/1999\/02\/22-rdf-syntax-ns#type"],
"offset": "0",
"limit": "3",
"constraints": [
{
"type": "reference",
"field": "http:\/\/www.w3.org\/2002\/07\/owl#sameAs",
"value": "http:\/\/www4.wiwiss.fu-berlin.de\/factbook\/resource\/United_States",
}]
}

and aims to find all the owl:sameAs entities of the entity <http://www4.wiwiss.fu-berlin.de/factbook/resource/United_States>
in DBpedia.
But instead of the graph with the expected results I always receive the error 
	javax.ws.rs.WebApplicationException: org.apache.stanbol.entityhub.servicesapi.site.ReferencedSiteException:
Unable execute Query on remote site http://dbpedia.org/sparql

The sparql construct serialized by the EntityHub is the following

CONSTRUCT {      
	?id <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?v_1 .     
	?id <http://www.w3.org/2000/01/rdf-schema#label> ?v_2 .     
	<http://www.iks-project.eu/ontology/rick/query/QueryResultSet> <http://www.iks-project.eu/ontology/rick/query/queryResult>
?id .  
}  
WHERE {     
	{ {?id <http://www.w3.org/2002/07/owl#sameAs> <http://www4.wiwiss.fu-berlin.de/factbook/resource/United_States>
}}    
	 { OPTIONAL { ?id <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?v_1 . } }   
	 { OPTIONAL { ?id <http://www.w3.org/2000/01/rdf-schema#label> ?v_2 . } } 
}  
ORDER BY DESC ( <LONG::IRI_RANK> (?id) )  LIMIT 3 

If you try to run this construct directly on the SPARQL endpoint of dbpedia the response is
always "Virtuoso 42000 Error The estimated execution time 0 (sec) exceeds the limit of 1500
(sec)."
It seems that the problem is in the graph patterns containing optional as they are bound to
the whole default graph ( {OPTIONAL{triple pattern} } is equivalent to { {} OPTIONAL {triple
pattern} }. 
In fact the query works properly both if you substitute the three graph patterns into one
graph pattern as follows

...  
WHERE {     
	?id <http://www.w3.org/2002/07/owl#sameAs> <http://www4.wiwiss.fu-berlin.de/factbook/resource/United_States>
. 
	 OPTIONAL { ?id <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?v_1 . }
	 OPTIONAL { ?id <http://www.w3.org/2000/01/rdf-schema#label> ?v_2 . }
}  
...


and if you bind the optional to the global solution of the WHERE clause, i.e.

...  
WHERE {     
	{{?id <http://www.w3.org/2002/07/owl#sameAs> <http://www4.wiwiss.fu-berlin.de/factbook/resource/United_States>
. }}
	 OPTIONAL { ?id <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?v_1 . } .
	 OPTIONAL { ?id <http://www.w3.org/2000/01/rdf-schema#label> ?v_2 . }
}  
...



Regards.
--
Andrea Giovanni Nuzzolese
Semantic Technology Laboratory (STLab)
Institute for Cognitive Science and Technology (ISTC)
National Research Council  (CNR)
Via Nomentana 56, Roma - Itay







Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message