All Downloads are FREE. Search and download functionalities are using the official Maven repository.

src.com.hp.hpl.jena.db.impl.DBQuery Maven / Gradle / Ivy

Go to download

Jena is a Java framework for building Semantic Web applications. It provides a programmatic environment for RDF, RDFS and OWL, SPARQL and includes a rule-based inference engine.

There is a newer version: 2.6.4
Show newest version
/*
  (c) Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Hewlett-Packard Development Company, LP
  [See end of file]
  $Id: DBQuery.java,v 1.13 2009/01/16 18:03:18 andy_seaborne Exp $
*/

package com.hp.hpl.jena.db.impl;

import java.util.ArrayList;
import java.util.List;

/**
	@author hedgehog
*/

public class DBQuery 
	{
	int argCnt;         // number of arguments to query
	String argType;     // list of argument types
	List argIndex;		// index of argument in input
	int varCnt;         // number of variables in query
	int aliasCnt;        // number of tables aliases (scans) in from clause
	String stmt;        // query string
	VarDesc[] vars;  // list of VarIndex, variables referenced in this query
	int[] resList;		// indexes of result columns in mapping
	int graphId;        // id of graph to query
	String table;   // name of table to query
	IPSet pset;		// pset to be queried
	IRDBDriver driver;  // driver for store
	boolean qryOnlyStmt; // if true, ignore reified statements
	boolean qryOnlyReif; // if true, ignore asserted statements
	boolean qryFullReif; // if true, ignore partially reified statements
	DriverRDB.GenSQLAnd sqlAnd;

	boolean isMultiModel;   // true if graph is multi-model
	boolean isSingleValued; // true if property table is single-valued
	boolean isCacheable;    // true if it is safe to cache compiled query
	boolean isReifier;      // true if query is over a reifier specialized graph
	boolean isEmpty;		// true if compiler determines query has no results

	
	public DBQuery ( SpecializedGraph sg, List varList,
		boolean queryOnlyStmt,  boolean queryOnlyReif, boolean queryFullReif ) {

		argCnt = 0;
		argType = "";
		argIndex = new ArrayList();	
		aliasCnt = 0;
		stmt = "";
		isMultiModel = true;  // for now
		isSingleValued = false;  // for now
		isCacheable = true;
		if ( sg != null ) {
			pset = sg.getPSet();			
			isReifier = sg instanceof SpecializedGraphReifier;			
			isEmpty = false;
			graphId = sg.getGraphId();
			table = pset.getTblName();
			driver = pset.driver();
		} else {
			pset = null;
			isReifier = false;
			isEmpty = true;
			driver = null;
		}
		sqlAnd = new IRDBDriver.GenSQLAnd();
		qryOnlyStmt = queryOnlyStmt;
		qryOnlyReif = queryOnlyReif;
		qryFullReif = queryFullReif;
		// array of variable bound by query
		vars = new VarDesc[varList.size()];
		for ( varCnt=0; varCnt




© 2015 - 2024 Weber Informatics LLC | Privacy Policy