当前位置: 首页>>代码示例>>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;未经允许,请勿转载。