當前位置: 首頁>>代碼示例>>Java>>正文


Java MalformedQueryException類代碼示例

本文整理匯總了Java中org.openrdf.query.MalformedQueryException的典型用法代碼示例。如果您正苦於以下問題:Java MalformedQueryException類的具體用法?Java MalformedQueryException怎麽用?Java MalformedQueryException使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


MalformedQueryException類屬於org.openrdf.query包,在下文中一共展示了MalformedQueryException類的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: addMapping

import org.openrdf.query.MalformedQueryException; //導入依賴的package包/類
private void addMapping(CaseAnnotationQuery taq, QuestOWLReasonerExt reasoner) 
		throws OWLException, OBDAException, MalformedQueryException{

	//TODO: make a check if reformulateSPARQL2 ada masalah, lanjut ke query berikutnya, jangan mati
	List<SQLWithVarMap> unfoldedQuery = reasoner.reformulateSPARQL2(taq.getQuery());
	Iterator<SQLWithVarMap> it = unfoldedQuery.iterator(); 
	
	while(it.hasNext()){

		SQLWithVarMap sqlWithVarMap = it.next();
		HashMap<String, String> varMap = sqlWithVarMap.getVariableMap();
		
		//TODO: need to check whether taq.getTraceAnsVariable() is null or not before calling varMap.get
		//TODO: need to check whether taq.getNameAnsVariable() is null or not before calling varMap.get
		addTraceMapping(sqlWithVarMap.getSQL(), 
					cleanURI(varMap.get(taq.getTraceAnsVariable())),
					cleanURI(varMap.get(taq.getNameAnsVariable()))
			);
	}
}
 
開發者ID:onprom,項目名稱:onprom,代碼行數:21,代碼來源:EBDAModelImpl2.java

示例2: addMapping

import org.openrdf.query.MalformedQueryException; //導入依賴的package包/類
private void addMapping(CaseAnnotationQuery taq, QuestOWLReasonerExt reasoner) 
		throws OWLException, OBDAException, MalformedQueryException{

	//TODO: make a check if reformulateSPARQL2 ada masalah, lanjut ke query berikutnya, jangan mati
	List<SQLWithVarMap> unfoldedQuery = reasoner.reformulateSPARQL2(taq.getQuery());
	Iterator<SQLWithVarMap> it = unfoldedQuery.iterator(); 
	
	while(it.hasNext()){

		SQLWithVarMap sqlWithVarMap = it.next();
		HashMap<String, String> varMap = sqlWithVarMap.getVariableMap();
		
		//TODO: need to check whether taq.getTraceAnsVariable() is null or not before calling varMap.get
		//TODO: need to check whether taq.getNameAnsVariable() is null or not before calling varMap.get
		addTraceNameMapping(sqlWithVarMap.getSQL(), 
					cleanURI(varMap.get(taq.getTraceAnsVariable())),
					cleanURI(varMap.get(taq.getNameAnsVariable()))
			);
	}
}
 
開發者ID:onprom,項目名稱:onprom,代碼行數:21,代碼來源:EBDAModelImpl3.java

示例3: extractXESLog

import org.openrdf.query.MalformedQueryException; //導入依賴的package包/類
/**
 * Generates XES log based on the given inputs, namely: 
 * Domain Ontology, OBDA Model, and annotation information
 * 
 * @author Ario Santoso ([email protected] / [email protected])
 * @param domainOntology
 * @param obdaModel
 * @param annotation
 * @return event log - XLog
 * @throws InvalidDataSourcesNumberException 
 * @throws OWLException 
 * @throws InvalidAnnotationException 
 * @throws XESLogExtractionFailureException 
 * @deprecated this one is only maintained for backward compatibility with the other OnProm plug in, at some point it should be removed
 */
@Deprecated
public static XLog extractXESLog(OWLOntology domainOntology, OBDAModel obdaModel, AnnotationQueries annotation) 
		throws InvalidDataSourcesNumberException, InvalidAnnotationException, OWLException, XESLogExtractionFailureException, OBDAException, MalformedQueryException{

	List<OBDADataSource> odsList = obdaModel.getSources();
	if(odsList.size() > 1)
		throw new InvalidDataSourcesNumberException(odsList.size());
	
	//Construct EBDA Model
	logger.info(String.format(LEConstants.LOG_INFO_TEMPLATE, "Start constucting an EBDA Model"));
	LEObjectFactory leFact = LEObjectFactory.getInstance();
	EBDAModelNaiveImpl ebdaModel = leFact.createEBDAModelNaiveImpl();
	
	//add data source information to the EBDA Model
	ebdaModel.addSource(odsList.get(0));
	
	logger.info(String.format(LEConstants.LOG_INFO_TEMPLATE, "Construct the mappings for the EBDA Model"));
	//add new mapping based on the annotation information
	ebdaModel.addMapping(domainOntology, obdaModel, annotation);
	
	logger.info(String.format(LEConstants.LOG_INFO_TEMPLATE, "Finish constucting an EBDA Model"));

	return extractXESLog(ebdaModel);
}
 
開發者ID:onprom,項目名稱:onprom,代碼行數:40,代碼來源:XESLogExtractorExperimental.java

示例4: createEBDAModelNaiveImpl

import org.openrdf.query.MalformedQueryException; //導入依賴的package包/類
/**
 * Generates EBDA Model based on the given inputs, namely: 
 * Domain Ontology, OBDA Model, and annotation information
 * 
 * @author Ario Santoso ([email protected] / [email protected])
 * @param domainOntology
 * @param obdaModel
 * @param annotation
 * @return EBDA Model
 * @throws InvalidDataSourcesNumberException 
 * @throws OWLException 
 * @throws InvalidAnnotationException 
 * @throws XESLogExtractionFailureException 
 */
public EBDAModelNaiveImpl createEBDAModelNaiveImpl(OWLOntology domainOntology, OBDAModel obdaModel, AnnotationQueries annotation) 
		throws InvalidDataSourcesNumberException, InvalidAnnotationException, OWLException, XESLogExtractionFailureException, OBDAException, MalformedQueryException{
	
	List<OBDADataSource> odsList = obdaModel.getSources();
	if(odsList.size() > 1)
		throw new InvalidDataSourcesNumberException(odsList.size());
	
	//Construct EBDA Model
	logger.info(String.format(LEConstants.LOG_INFO_TEMPLATE, "Start constucting an EBDA Model"));
	LEObjectFactory leFact = LEObjectFactory.getInstance();
	EBDAModelNaiveImpl ebdaModel = leFact.createEBDAModelNaiveImpl();
	
	//add data source information to the EBDA Model
	ebdaModel.addSource(odsList.get(0));
	
	logger.info(String.format(LEConstants.LOG_INFO_TEMPLATE, "Construct the mappings for the EBDA Model"));
	//add new mapping based on the annotation information
	ebdaModel.addMapping(domainOntology, obdaModel, annotation);
	
	logger.info(String.format(LEConstants.LOG_INFO_TEMPLATE, "Finish constucting an EBDA Model"));
	
	return ebdaModel;	
}
 
開發者ID:onprom,項目名稱:onprom,代碼行數:38,代碼來源:XESLogExtractorExperimental.java

示例5: createEBDAModelImpl2

import org.openrdf.query.MalformedQueryException; //導入依賴的package包/類
/**
 * Generates EBDA Model based on the given inputs, namely: 
 * Domain Ontology, OBDA Model, and annotation information
 * 
 * @author Ario Santoso ([email protected] / [email protected])
 * @param domainOntology
 * @param obdaModel
 * @param annotation
 * @return EBDA Model
 * @throws InvalidDataSourcesNumberException 
 * @throws OWLException 
 * @throws InvalidAnnotationException 
 * @throws XESLogExtractionFailureException 
 */
public EBDAModelImpl2 createEBDAModelImpl2(OWLOntology domainOntology, OBDAModel obdaModel, AnnotationQueries annotation) 
		throws InvalidDataSourcesNumberException, InvalidAnnotationException, OWLException, XESLogExtractionFailureException, OBDAException, MalformedQueryException{
	
	List<OBDADataSource> odsList = obdaModel.getSources();
	if(odsList.size() > 1)
		throw new InvalidDataSourcesNumberException(odsList.size());
	
	//Construct EBDA Model
	logger.info(String.format(LEConstants.LOG_INFO_TEMPLATE, "Start constucting an EBDA Model"));
	LEObjectFactory leFact = LEObjectFactory.getInstance();
	EBDAModelImpl2 ebdaModel = leFact.createEBDAModelImpl2();
	
	//add data source information to the EBDA Model
	ebdaModel.addSource(odsList.get(0));
	
	//add new mapping based on the annotation information
	logger.info(String.format(LEConstants.LOG_INFO_TEMPLATE, "Construct the mappings for the EBDA Model"));
	ebdaModel.addMapping(domainOntology, obdaModel, annotation);
	
	logger.info(String.format(LEConstants.LOG_INFO_TEMPLATE, "Finish constucting an EBDA Model"));
	
	return ebdaModel;	
}
 
開發者ID:onprom,項目名稱:onprom,代碼行數:38,代碼來源:XESLogExtractorExperimental.java

示例6: createEBDAModelImpl3

import org.openrdf.query.MalformedQueryException; //導入依賴的package包/類
/**
 * Generates EBDA Model based on the given inputs, namely: 
 * Domain Ontology, OBDA Model, and annotation information
 * 
 * @author Ario Santoso ([email protected] / [email protected])
 * @param domainOntology
 * @param obdaModel
 * @param annotation
 * @return EBDA Model
 * @throws InvalidDataSourcesNumberException 
 * @throws OWLException 
 * @throws InvalidAnnotationException 
 * @throws XESLogExtractionFailureException 
 */
public EBDAModelImpl3 createEBDAModelImpl3(OWLOntology domainOntology, OBDAModel obdaModel, AnnotationQueries annotation) 
		throws InvalidDataSourcesNumberException, InvalidAnnotationException, OWLException, XESLogExtractionFailureException, OBDAException, MalformedQueryException{
	
	List<OBDADataSource> odsList = obdaModel.getSources();
	if(odsList.size() > 1)
		throw new InvalidDataSourcesNumberException(odsList.size());
	
	//Construct EBDA Model
	logger.info(String.format(LEConstants.LOG_INFO_TEMPLATE, "Start constucting an EBDA Model"));
	LEObjectFactory leFact = LEObjectFactory.getInstance();
	EBDAModelImpl3 ebdaModel = leFact.createEBDAModelImpl3();
	
	//add data source information to the EBDA Model
	ebdaModel.addSource(odsList.get(0));
	
	//add new mapping based on the annotation information
	logger.info(String.format(LEConstants.LOG_INFO_TEMPLATE, "Construct the mappings for the EBDA Model"));
	ebdaModel.addMapping(domainOntology, obdaModel, annotation);
	
	logger.info(String.format(LEConstants.LOG_INFO_TEMPLATE, "Finish constucting an EBDA Model"));
	
	return ebdaModel;	
}
 
開發者ID:onprom,項目名稱:onprom,代碼行數:38,代碼來源:XESLogExtractorExperimental.java

示例7: createEBDAModelWithOptimizedXAttributesEncoding

import org.openrdf.query.MalformedQueryException; //導入依賴的package包/類
/**
 * Generates EBDA Model based on the given inputs, namely: 
 * Domain Ontology, OBDA Model, and annotation information
 * 
 * @author Ario Santoso ([email protected] / [email protected])
 * @param domainOntology
 * @param obdaModel
 * @param annotation
 * @return EBDA Model
 * @throws InvalidDataSourcesNumberException 
 * @throws OWLException 
 * @throws InvalidAnnotationException 
 * @throws XESLogExtractionFailureException 
 */
public EBDAModelWithOptimizedXAttributesEncoding createEBDAModelWithOptimizedXAttributesEncoding(OWLOntology domainOntology, OBDAModel obdaModel, AnnotationQueries annotation) 
		throws InvalidDataSourcesNumberException, InvalidAnnotationException, OWLException, XESLogExtractionFailureException, OBDAException, MalformedQueryException{
	
	List<OBDADataSource> odsList = obdaModel.getSources();
	if(odsList.size() > 1)
		throw new InvalidDataSourcesNumberException(odsList.size());
	
	//Construct EBDA Model
	logger.info(String.format(LEConstants.LOG_INFO_TEMPLATE, "Start constucting an EBDA Model"));
	LEObjectFactory leFact = LEObjectFactory.getInstance();
	EBDAModelWithOptimizedXAttributesEncoding ebdaModel = leFact.createEBDAModelWithOptimizedXAttributesEncoding();
	
	//add data source information to the EBDA Model
	ebdaModel.addSource(odsList.get(0));
	
	//add new mapping based on the annotation information
	logger.info(String.format(LEConstants.LOG_INFO_TEMPLATE, "Construct the mappings for the EBDA Model"));
	ebdaModel.addMapping(domainOntology, obdaModel, annotation);
	
	logger.info(String.format(LEConstants.LOG_INFO_TEMPLATE, "Finish constucting an EBDA Model"));
	
	return ebdaModel;	
}
 
開發者ID:onprom,項目名稱:onprom,代碼行數:38,代碼來源:XESLogExtractorExperimental.java

示例8: reformulateSPARQL2

import org.openrdf.query.MalformedQueryException; //導入依賴的package包/類
public List<SQLWithVarMap> reformulateSPARQL2(String sparqlQuery) throws OWLException, OBDAException, MalformedQueryException {

		QuestQueryProcessor qqueryProcessor = this.getQueryProcessor();

		//parse the given SPARQL query
		ParsedQuery parsedSparql = qqueryProcessor.getParsedQuery(sparqlQuery);
		
		//applying the reformulation algorithm to the parsed SPARQL query, 
		//the resulting reformulated query is in the form of DatalogProgram
		DatalogProgram reformulatedQuery = qqueryProcessor.reformulateSPARQL(parsedSparql);
		List<String> qs = qqueryProcessor.getQuerySignature(parsedSparql);

		
		if(qs == null)
			throw new OBDAException("\nA problem occurred while reformulating the query: \n\n"+
				sparqlQuery+"\n\nthe signature of the reformulated query can't be obtained. Please check the Ontop configuration.\n");
		
		//translate the reformulated query (which is in the form of DatalogProgram) into (a list of) SQL
		return this.sqlGeneratorExt.generateSourceQueries(reformulatedQuery, qs);
	}
 
開發者ID:onprom,項目名稱:onprom,代碼行數:21,代碼來源:QuestOWLReasonerExt.java

示例9: rewrite

import org.openrdf.query.MalformedQueryException; //導入依賴的package包/類
/**
 * Rewrite a given query to add inference.
 *
 * @param ql the query language used for the query
 * @param query the query to rewrite
 * @param baseuri a base URI to use for the query
 * @return rewritten query that includes inference
 * @throws MalformedQueryException if the query is malformed
 * @throws RepositoryException if there was a problem while rewriting
 */
public Query rewrite(QueryLanguage ql, String query, String baseuri)
		throws MalformedQueryException, RepositoryException {
	// parse query using Sesame
	QueryParserFactory f = QueryParserRegistry.getInstance().get(ql);
	QueryParser parser = f.getParser();
	ParsedQuery parsed = parser.parseQuery(query, baseuri);
	// get SPARQL algebra expression from parsed query
	TupleExpr expr = parsed.getTupleExpr();
	// rewrite query using visitor pattern
	RuleTransformationVisitor visitor
			= new RuleTransformationVisitor(rules);
	expr.visit(visitor);
	// return new query based on rewritten algebra expression
	return getExprQuery(parsed, expr);
}
 
開發者ID:lszeremeta,項目名稱:neo4j-sparql-extension-yars,代碼行數:26,代碼來源:QueryRewriter.java

示例10: before

import org.openrdf.query.MalformedQueryException; //導入依賴的package包/類
@Before
public void before()
		throws RepositoryException, IOException, RDFParseException,
		       MalformedQueryException, QueryResultParseException,
			   QueryResultHandlerException {
	repo = new SailRepository(new MemoryStore());
	repo.initialize();
	conn = repo.getConnection();
	vf = conn.getValueFactory();
	conn.add(getResource(data), "file://", RDFFormat.TURTLE);
	SPARQLResultsXMLParserFactory factory =
			new SPARQLResultsXMLParserFactory();
	parser = factory.getParser();
	parser.setValueFactory(vf);
	List<Rule> rules;
	rules = Rules.fromOntology(getResource(data));
	QueryRewriter rewriter = new QueryRewriter(conn, rules);
	query = (TupleQuery) rewriter.rewrite(QueryLanguage.SPARQL, queryString);
	nonInfQuery = conn.prepareTupleQuery(QueryLanguage.SPARQL, queryString);
	System.out.println("== QUERY (" + this.name + ") ==");
	System.out.println(nonInfQuery);
	System.out.println("== REWRITTEN QUERY (" + this.name + ") ==");
	System.out.println(query);
}
 
開發者ID:lszeremeta,項目名稱:neo4j-sparql-extension-yars,代碼行數:25,代碼來源:SPARQLInferenceTest.java

示例11: getAstQueryContainerObjectFor

import org.openrdf.query.MalformedQueryException; //導入依賴的package包/類
/**
 * @param queryString the queryString which should be converted to an ASTQueryContainer
 * @return ASTQueryContainer object
 */
public ASTQueryContainer getAstQueryContainerObjectFor(String queryString) throws MalformedQueryException
{
  //check if requested object already exists in cache
  if (!astQueryContainerLRUMap.containsKey(queryString)) {
    //if not create a new one
    try {
      astQueryContainerLRUMap.put(queryString, SyntaxTreeBuilder.parseQuery(queryString));
    } catch (TokenMgrError | ParseException e) {
      throw new MalformedQueryException(e.getMessage(), e);
    }
  }

  //and return it
  return astQueryContainerLRUMap.get(queryString);
}
 
開發者ID:Wikidata,項目名稱:QueryAnalysis,代碼行數:20,代碼來源:Cache.java

示例12: clear

import org.openrdf.query.MalformedQueryException; //導入依賴的package包/類
public static void clear( IEngine engine ) throws RepositoryException {
	try {
		final Map<URI, Value> metas = engine.query( new MetadataQuery() );
		metas.remove( SEMTOOL.Database );

		engine.execute( new ModificationExecutorAdapter( true ) {

			@Override
			public void exec( RepositoryConnection conn ) throws RepositoryException {
				conn.remove( (Resource) null, null, null );
				ValueFactory vf = conn.getValueFactory();

				// re-add the metadata
				for ( Map.Entry<URI, Value> en : metas.entrySet() ) {
					conn.add( engine.getBaseUri(),
							URI.class.cast( EngineLoader.cleanValue( en.getKey(), vf ) ),
							EngineLoader.cleanValue( en.getValue(), vf ) );
				}
			}
		} );
	}
	catch ( MalformedQueryException | QueryEvaluationException e ) {
		log.error( e, e );
	}
}
 
開發者ID:Ostrich-Emulators,項目名稱:semtool,代碼行數:26,代碼來源:EngineUtil2.java

示例13: getReificationStyle

import org.openrdf.query.MalformedQueryException; //導入依賴的package包/類
/**
 * Gets the reification model URI from the given engine
 *
 * @param engine
 * @return return the reification model, or {@link Constants#NONODE} if none
 * is defined
 */
public static ReificationStyle getReificationStyle( IEngine engine ) {
	URI reif = Constants.NONODE;
	if ( null != engine ) {
		MetadataQuery mq = new MetadataQuery( SEMTOOL.ReificationModel );
		try {
			engine.query( mq );
			Value str = mq.getOne();
			reif = ( null == str ? Constants.NONODE : URI.class.cast( str ) );
		}
		catch ( RepositoryException | MalformedQueryException | QueryEvaluationException e ) {
			// don't care
		}
	}

	return ReificationStyle.fromUri( reif );
}
 
開發者ID:Ostrich-Emulators,項目名稱:semtool,代碼行數:24,代碼來源:EngineUtil2.java

示例14: doUpdate

import org.openrdf.query.MalformedQueryException; //導入依賴的package包/類
public static final void doUpdate( UpdateExecutor query,
		RepositoryConnection rc, boolean dobindings ) throws RepositoryException,
		MalformedQueryException, UpdateExecutionException {

	String sparql = processNamespaces( dobindings ? query.getSparql()
			: query.bindAndGetSparql(), query.getNamespaces() );

	ValueFactory vfac = new ValueFactoryImpl();
	Update upd = rc.prepareUpdate( QueryLanguage.SPARQL, sparql );

	if ( dobindings ) {
		upd.setIncludeInferred( query.usesInferred() );
		query.setBindings( upd, vfac );
	}

	upd.execute();
	query.done();
}
 
開發者ID:Ostrich-Emulators,項目名稱:semtool,代碼行數:19,代碼來源:AbstractSesameEngine.java


注:本文中的org.openrdf.query.MalformedQueryException類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。