fr.inrialpes.exmo.align.service
Class QueryMediator
java.lang.Object
fr.inrialpes.exmo.align.service.QueryMediator
- All Implemented Interfaces:
- QueryProcessor
public class QueryMediator
- extends Object
- implements QueryProcessor
QueryMediator
A query processor that mediates queries through an ontology alignment.
This implementation rely on an embedded QueryProcessor.
Another possible implementation would be to subclass a query processor.
This would however provide few benefits (speed gained by no indirection)
against loss in generality.
- Author:
- Arun Sharma, Jérôme Euzenat
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
alignment
private Alignment alignment
processor
private QueryProcessor processor
QueryMediator
public QueryMediator(QueryProcessor proc,
Alignment a)
QueryMediator
public QueryMediator(QueryProcessor proc,
String alignmentURI)
throws SAXException,
ParserConfigurationException,
IOException
- Throws:
SAXException
ParserConfigurationException
IOException
QueryMediator
public QueryMediator(Alignment a)
QueryMediator
public QueryMediator(String alignmentURI)
throws SAXException,
ParserConfigurationException,
IOException
- Throws:
SAXException
ParserConfigurationException
IOException
query
public Result query(String query,
Type type)
- Specified by:
query
in interface QueryProcessor
- Parameters:
query
- -- The query stringtype
- -- The query type, can be one of SELECT, ASK, CONSTRUCT, or DESCRIBE
- Returns:
- Result, result form depends on type
query
public Result query(String query)
- Specified by:
query
in interface QueryProcessor
- Parameters:
query
- -- The query string
queryWithStringResults
public String queryWithStringResults(String query)
- Specified by:
queryWithStringResults
in interface QueryProcessor
- Parameters:
query
- -- The query string
- Returns:
- query results as string
getType
public int getType(String query)
- Specified by:
getType
in interface QueryProcessor
- Parameters:
query
- -- the query string
- Returns:
- the type of the query
loadOntology
public void loadOntology(String uri)
- Specified by:
loadOntology
in interface QueryProcessor
rewriteQuery
public String rewriteQuery(String aQuery)
throws AlignmentException
- Parameters:
aQuery
- -- query to be re-written
- Returns:
- -- rewritten query:
- replaces all the prefix namespaces, if present, in the query by actual IRIs
- replaces all entity IRI by their counterpart in the ontology
Caveats:
- This does only work for alignments with =
- This does not care for the *:x status of alignments
- This does work from ontology1 to ontology2, not the otherway round
(use invert() in this case).
- Throws:
AlignmentException
rewriteSPARQLQuery
public static String rewriteSPARQLQuery(String aQuery,
Alignment align)
throws AlignmentException
- Throws:
AlignmentException
(C) INRIA & friends, 2003-2010