|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.fluxion.datasource.utils.QueryUtils
public class QueryUtils
A general utility class for producing filters given an incoming query class.
This should be the first pot of call when trying to obtain the results for a
particular OWL query. In most cases, given an incoming OWL query class, "q",
a client can simply call QueryUtils.createFilters(ontology, q)
and get back a set of filters which, when used to generate and execute a
query, is guaranteed to return at least all instances of the query class.
OWLUtils
,
BeanUtils
Constructor Summary | |
---|---|
QueryUtils()
|
Method Summary | |
---|---|
static boolean |
checkQueryIntegrity(org.semanticweb.owl.model.OWLOntology ontology,
org.semanticweb.owl.model.OWLDescription query)
This method checks the integrity of a query against the supplied ontology. |
static BeanConverter |
createConverterForFilter(ReasonerSession session,
org.semanticweb.owl.model.OWLOntology schemaOntology,
org.semanticweb.owl.model.OWLOntology resultOntology,
org.semanticweb.owl.model.OWLDescription query,
Filter filter)
|
static java.util.Set<Filter> |
createFilters(ReasonerSession session,
org.semanticweb.owl.model.OWLOntology ontology,
org.semanticweb.owl.model.OWLDescription query)
Convert an OWLClass into a Set of filters. |
static Query |
createQuery(java.lang.Class queryManager,
Filter filter)
Creates a new Query using
the given QueryManager class and the Filter supplied. |
static java.util.Set<org.semanticweb.owl.model.OWLEntity> |
getBadlyFormedQueryEntities(org.semanticweb.owl.model.OWLOntology ontology,
org.semanticweb.owl.model.OWLDescription query)
Use this method to recover those entities that cause the query OWLDescription to fail and integrity check. |
static java.lang.Class |
getQueryManagerClass(ReasonerSession session,
org.semanticweb.owl.model.OWLOntology ontology,
org.semanticweb.owl.model.OWLDescription query)
Get the QueryManager object for a given OWL class. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public QueryUtils()
Method Detail |
---|
public static boolean checkQueryIntegrity(org.semanticweb.owl.model.OWLOntology ontology, org.semanticweb.owl.model.OWLDescription query)
ontology
- the ontology to checkquery
- the query being integrity-checked
public static java.util.Set<org.semanticweb.owl.model.OWLEntity> getBadlyFormedQueryEntities(org.semanticweb.owl.model.OWLOntology ontology, org.semanticweb.owl.model.OWLDescription query)
checkQueryIntegrity()
and if this returns false
and you want to obtain extra debugging info, call this method to get a set
of those terms not present in the ontology.
ontology
- the ontology being checkedquery
- the OWLDescription being assessed
public static java.lang.Class getQueryManagerClass(ReasonerSession session, org.semanticweb.owl.model.OWLOntology ontology, org.semanticweb.owl.model.OWLDescription query) throws MissingElementException
ontology
- the ontology being queriedquery
- the OWLDescription describing our query
MissingElementException
- if the QueryManager class can't be discoveredpublic static java.util.Set<Filter> createFilters(ReasonerSession session, org.semanticweb.owl.model.OWLOntology ontology, org.semanticweb.owl.model.OWLDescription query) throws OWLTransformationException
A given query class can be translated into a (set of) filters. In the special case where the query class is a whole class as defined by the ontology, we can use the RelatedBean annotation to get a target bean FooBean, then trivialy get hold of its filter to return all bean instances. However, in all other cases we must obtain the set of superclasses of the query class to determmine those beans we need to query, and any restrictions to set.
Note that the owlClass passed as a parameter must somewhere in its composition contain a described class, containing a "RelatedBean" annotation, to allow us to locate the appropriate bean in the model.
ontology
- the ontology we're querying againstquery
- the incoming query description
OWLTransformationException
- if there is some problem in translating
the owlpublic static Query createQuery(java.lang.Class queryManager, Filter filter) throws OWLTransformationException
Query
using
the given QueryManager
class and the Filter
supplied.
queryManager
- the QueryManager class, which must be on the current
classpathfilter
- the Filter
to use to create this query
OWLTransformationException
- if there is a problem generating the
querypublic static BeanConverter createConverterForFilter(ReasonerSession session, org.semanticweb.owl.model.OWLOntology schemaOntology, org.semanticweb.owl.model.OWLOntology resultOntology, org.semanticweb.owl.model.OWLDescription query, Filter filter) throws OWLTransformationException
OWLTransformationException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |