You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by rv...@apache.org on 2013/04/05 18:23:57 UTC
svn commit: r1465026 - in
/jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results:
./ metadata/ metadata/columns/
Author: rvesse
Date: Fri Apr 5 16:23:57 2013
New Revision: 1465026
URL: http://svn.apache.org/r1465026
Log:
Better abstraction for reporting result set metadata
Added:
jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/metadata/columns/
jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/metadata/columns/BooleanColumn.java
jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/metadata/columns/ColumnInfo.java
jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/metadata/columns/SparqlColumnInfo.java
jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/metadata/columns/StringColumn.java
Modified:
jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/SelectResults.java
jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/metadata/AskResultsMetadata.java
jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/metadata/JenaResultsMetadata.java
jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/metadata/SelectResultsMetadata.java
jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/metadata/TripleResultsMetadata.java
Modified: jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/SelectResults.java
URL: http://svn.apache.org/viewvc/jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/SelectResults.java?rev=1465026&r1=1465025&r2=1465026&view=diff
==============================================================================
--- jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/SelectResults.java (original)
+++ jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/SelectResults.java Fri Apr 5 16:23:57 2013
@@ -63,7 +63,7 @@ public class SelectResults extends Strea
throw new SQLException("SPARQL Results cannot be null");
this.innerResults = results;
this.columns = new ArrayList<String>(this.innerResults.getResultVars());
- this.metadata = new SelectResultsMetadata(this, this.innerResults, this.columns);
+ this.metadata = new SelectResultsMetadata(this, this.innerResults);
}
@Override
Modified: jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/metadata/AskResultsMetadata.java
URL: http://svn.apache.org/viewvc/jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/metadata/AskResultsMetadata.java?rev=1465026&r1=1465025&r2=1465026&view=diff
==============================================================================
--- jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/metadata/AskResultsMetadata.java (original)
+++ jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/metadata/AskResultsMetadata.java Fri Apr 5 16:23:57 2013
@@ -24,6 +24,8 @@ import java.sql.Types;
import org.apache.jena.jdbc.JdbcCompatibility;
import org.apache.jena.jdbc.results.AskResults;
import org.apache.jena.jdbc.results.JenaResultSet;
+import org.apache.jena.jdbc.results.metadata.columns.BooleanColumn;
+import org.apache.jena.jdbc.results.metadata.columns.ColumnInfo;
/**
* Meta data for {@link AskResults}
@@ -42,13 +44,27 @@ public class AskResultsMetadata extends
*/
public static final String COLUMN_LABEL_ASK = "ASK";
+ private static ColumnInfo[] COLUMNS;
+
+ /**
+ * Gets the columns for ASK results
+ * @return Column Information
+ * @throws SQLException
+ */
+ private static synchronized ColumnInfo[] getColumns() throws SQLException {
+ if (COLUMNS == null) {
+ COLUMNS = new ColumnInfo[] { new BooleanColumn(COLUMN_LABEL_ASK, columnNoNulls) };
+ }
+ return COLUMNS;
+ }
+
/**
* Creates new ASK results metadata
* @param results Results
* @throws SQLException Thrown if the metadata cannot be created
*/
public AskResultsMetadata(JenaResultSet results) throws SQLException {
- super(results);
+ super(results, AskResultsMetadata.getColumns());
}
@Override
@@ -57,13 +73,6 @@ public class AskResultsMetadata extends
}
@Override
- public String getColumnLabel(int column) throws SQLException {
- if (column == 1)
- return COLUMN_LABEL_ASK;
- throw new SQLException("Column Index is out of bounds");
- }
-
- @Override
public int getColumnType(int column) throws SQLException {
if (column == 1)
return Types.BOOLEAN;
@@ -100,4 +109,5 @@ public class AskResultsMetadata extends
throw new SQLException("Column Index is out of bounds");
}
+
}
Modified: jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/metadata/JenaResultsMetadata.java
URL: http://svn.apache.org/viewvc/jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/metadata/JenaResultsMetadata.java?rev=1465026&r1=1465025&r2=1465026&view=diff
==============================================================================
--- jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/metadata/JenaResultsMetadata.java (original)
+++ jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/metadata/JenaResultsMetadata.java Fri Apr 5 16:23:57 2013
@@ -21,11 +21,11 @@ package org.apache.jena.jdbc.results.met
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
-import java.sql.Types;
+import java.util.ArrayList;
+import java.util.List;
import org.apache.jena.jdbc.results.JenaResultSet;
-
-import com.hp.hpl.jena.graph.Node;
+import org.apache.jena.jdbc.results.metadata.columns.ColumnInfo;
/**
* Abstract implementation of result set metadata for Jena JDBC result sets
@@ -34,15 +34,20 @@ import com.hp.hpl.jena.graph.Node;
public abstract class JenaResultsMetadata implements ResultSetMetaData {
private JenaResultSet results;
+ private List<ColumnInfo> columns = new ArrayList<ColumnInfo>();
/**
* Creates new result set metadata
* @param results Result Set
+ * @param columns Column Information
* @throws SQLException
*/
- public JenaResultsMetadata(JenaResultSet results) throws SQLException {
+ public JenaResultsMetadata(JenaResultSet results, ColumnInfo[] columns) throws SQLException {
if (results == null) throw new SQLException("Result Set cannot be null");
this.results = results;
+ for (ColumnInfo column : columns) {
+ this.columns.add(column);
+ }
}
public boolean isWrapperFor(Class<?> iface) throws SQLException {
@@ -56,16 +61,23 @@ public abstract class JenaResultsMetadat
public String getCatalogName(int column) throws SQLException {
return this.results.getStatement().getConnection().getCatalog();
}
+
+ protected final ColumnInfo getColumnInfo(int column) throws SQLException {
+ // Remember JDBC columns use a 1 based index
+ if (column >= 1 && column <= this.columns.size()) {
+ return this.columns.get(column - 1);
+ } else {
+ throw new SQLException("Column Index is out of bounds");
+ }
+ }
public String getColumnClassName(int column) throws SQLException {
- // Call getColumnName to validate the column index
- this.getColumnName(column);
- // All columns are typed as String in order that generic JDBC tools
- // can actually understand our results
- return String.class.getCanonicalName();
+ return this.getColumnInfo(column).getClassName();
}
- public abstract int getColumnCount() throws SQLException;
+ public int getColumnCount() throws SQLException {
+ return this.columns.size();
+ }
/**
* Gets a columns display size
@@ -77,46 +89,31 @@ public abstract class JenaResultsMetadat
* </p>
*/
public int getColumnDisplaySize(int column) throws SQLException {
- // Call getColumnName to validate the column index
- this.getColumnName(column);
- // No max size for columns so return maximum possible
- return Integer.MAX_VALUE;
+ return this.getColumnInfo(column).getDisplaySize();
}
-
- public abstract String getColumnLabel(int column) throws SQLException;
-
+
public String getColumnName(int column) throws SQLException {
- return this.getColumnLabel(column);
+ return this.getColumnInfo(column).getLabel();
+ }
+
+ public String getColumnLabel(int column) throws SQLException {
+ return this.getColumnInfo(column).getLabel();
}
public int getColumnType(int column) throws SQLException {
- // Call getColumnName to validate the column index
- this.getColumnName(column);
- // All columns are typed as Java Object from a JDBC SQL type perspective
- return Types.NVARCHAR;
+ return this.getColumnInfo(column).getType();
}
public String getColumnTypeName(int column) throws SQLException {
- // Call getColumnName to validate the column index
- this.getColumnName(column);
- // The underlying type is actually ARQ Node
- return Node.class.getCanonicalName();
+ return this.getColumnInfo(column).getTypeName();
}
public int getPrecision(int column) throws SQLException {
- // Call getColumnName to validate the column index
- this.getColumnName(column);
- // Precision is not a supported notion in RDF/SPARQL
- // Precision can vary depending on data type
- return 0;
+ return this.getColumnInfo(column).getPrecision();
}
public int getScale(int column) throws SQLException {
- // Call getColumnName to validate the column index
- this.getColumnName(column);
- // Scale is not a supported notion in RDF/SPARQL
- // Scale can vary depending on data type
- return 0;
+ return this.getColumnInfo(column).getScale();
}
public String getSchemaName(int column) throws SQLException {
@@ -130,59 +127,39 @@ public abstract class JenaResultsMetadat
}
public boolean isAutoIncrement(int column) throws SQLException {
- // Call getColumnName to validate the column index
- this.getColumnName(column);
- // SPARQL engines don't have a notion of auto-increment
- return false;
+ return this.getColumnInfo(column).isAutoIncrement();
}
public boolean isCaseSensitive(int column) throws SQLException {
- // Call getColumnName to validate the column index
- this.getColumnName(column);
- // Most types in RDF/SPARQL are subject to case sensitivity especially
- // when talking strict RDF equality semantics
- return true;
+ return this.getColumnInfo(column).isCaseSensitive();
}
public boolean isCurrency(int column) throws SQLException {
- // Call getColumnName to validate the column index
- this.getColumnName(column);
- // No built in currency type in RDF
- return false;
+ return this.getColumnInfo(column).isCurrency();
}
public boolean isDefinitelyWritable(int column) throws SQLException {
return this.isWritable(column);
}
- public abstract int isNullable(int column) throws SQLException;
+ public int isNullable(int column) throws SQLException {
+ return this.getColumnInfo(column).isNullable();
+ }
public boolean isReadOnly(int column) throws SQLException {
- // Call getColumnName to validate the column index
- this.getColumnName(column);
- // All Jena JDBC results are read-only currently
- return true;
+ return this.getColumnInfo(column).isReadOnly();
}
public boolean isSearchable(int column) throws SQLException {
- // Call getColumnName to validate the column index
- this.getColumnName(column);
- // All columns are searchable in RDF/SPARQL
- return true;
+ return this.getColumnInfo(column).isSearchable();
}
public boolean isSigned(int column) throws SQLException {
- // Call getColumnName to validate the column index
- this.getColumnName(column);
- // Most numeric types allow for signs in RDF/SPARQL
- return true;
+ return this.getColumnInfo(column).isSigned();
}
public boolean isWritable(int column) throws SQLException {
- // Call getColumnName to validate the column index
- this.getColumnName(column);
- // All Jena JDBC results are read-only currently
- return false;
+ return this.getColumnInfo(column).isWritable();
}
}
Modified: jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/metadata/SelectResultsMetadata.java
URL: http://svn.apache.org/viewvc/jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/metadata/SelectResultsMetadata.java?rev=1465026&r1=1465025&r2=1465026&view=diff
==============================================================================
--- jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/metadata/SelectResultsMetadata.java (original)
+++ jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/metadata/SelectResultsMetadata.java Fri Apr 5 16:23:57 2013
@@ -23,8 +23,12 @@ import java.util.List;
import org.apache.jena.jdbc.results.JenaResultSet;
import org.apache.jena.jdbc.results.SelectResults;
+import org.apache.jena.jdbc.results.metadata.columns.ColumnInfo;
+import org.apache.jena.jdbc.results.metadata.columns.StringColumn;
import com.hp.hpl.jena.query.ResultSet;
+import com.hp.hpl.jena.query.ResultSetFactory;
+import com.hp.hpl.jena.sparql.resultset.ResultSetPeekable;
/**
* Result Set Metadata for {@link SelectResults} instances
@@ -33,9 +37,8 @@ import com.hp.hpl.jena.query.ResultSet;
public class SelectResultsMetadata extends JenaResultsMetadata {
@SuppressWarnings("unused")
- private ResultSet innerResults;
- private List<String> columns;
-
+ private ResultSetPeekable innerResults;
+
/**
* Creates new SELECT results metadata
* @param results JDBC result set
@@ -43,29 +46,23 @@ public class SelectResultsMetadata exten
* @param columns Columns
* @throws SQLException
*/
- public SelectResultsMetadata(JenaResultSet results, ResultSet rset, List<String> columns) throws SQLException {
- super(results);
+ public SelectResultsMetadata(JenaResultSet results, ResultSetPeekable rset) throws SQLException {
+ super(results, makeColumns(results, rset));
this.innerResults = rset;
- this.columns = columns;
}
-
- @Override
- public int getColumnCount() throws SQLException {
- return this.columns.size();
+
+ public SelectResultsMetadata(JenaResultSet results, ResultSet rset) throws SQLException {
+ this(results, ResultSetFactory.makePeekable(rset));
}
-
- @Override
- public String getColumnLabel(int column) throws SQLException {
- if (column >= 1 && column <= this.columns.size()) {
- return this.columns.get(column - 1);
- } else {
- throw new SQLException("Column Index is out of bounds");
+
+ private static ColumnInfo[] makeColumns(JenaResultSet results, ResultSetPeekable rset) throws SQLException {
+ List<String> vars = rset.getResultVars();
+ ColumnInfo[] columns = new ColumnInfo[vars.size()];
+
+ for (int i = 0; i < columns.length; i++) {
+ columns[i] = new StringColumn(vars.get(i), columnNullable);
}
- }
-
- @Override
- public int isNullable(int column) throws SQLException {
- // Columns of a SELECT are nullable
- return columnNullable;
+
+ return columns;
}
}
Modified: jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/metadata/TripleResultsMetadata.java
URL: http://svn.apache.org/viewvc/jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/metadata/TripleResultsMetadata.java?rev=1465026&r1=1465025&r2=1465026&view=diff
==============================================================================
--- jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/metadata/TripleResultsMetadata.java (original)
+++ jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/metadata/TripleResultsMetadata.java Fri Apr 5 16:23:57 2013
@@ -18,10 +18,13 @@
package org.apache.jena.jdbc.results.metadata;
+import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import org.apache.jena.jdbc.results.JenaResultSet;
import org.apache.jena.jdbc.results.TripleIteratorResults;
+import org.apache.jena.jdbc.results.metadata.columns.ColumnInfo;
+import org.apache.jena.jdbc.results.metadata.columns.StringColumn;
/**
* Result set metadata for {@link TripleIteratorResults} instances
@@ -47,36 +50,25 @@ public class TripleResultsMetadata exten
public static final int NUM_COLUMNS = 3;
/**
+ * Gets the columns for ASK results
+ * @return Column Information
+ * @throws SQLException
+ */
+ private static ColumnInfo[] makeColumns(JenaResultSet results) throws SQLException {
+ ColumnInfo[] columns = new ColumnInfo[NUM_COLUMNS];
+ columns[0] = new StringColumn(COLUMN_LABEL_SUBJECT, ResultSetMetaData.columnNoNulls);
+ columns[1] = new StringColumn(COLUMN_LABEL_PREDICATE, ResultSetMetaData.columnNoNulls);
+ columns[2] = new StringColumn(COLUMN_LABEL_OBJECT, ResultSetMetaData.columnNoNulls);
+ return columns;
+ }
+
+ /**
* Creates new results metadata for triple (CONSTRUCT/DESCRIBE) results
* @param results Result Set
* @throws SQLException Thrown if the metadata cannot be created
*/
public TripleResultsMetadata(JenaResultSet results) throws SQLException {
- super(results);
- }
-
- @Override
- public int getColumnCount() throws SQLException {
- return TripleResultsMetadata.NUM_COLUMNS;
- }
-
- @Override
- public String getColumnLabel(int column) throws SQLException {
- switch (column) {
- case 1:
- return TripleResultsMetadata.COLUMN_LABEL_SUBJECT;
- case 2:
- return TripleResultsMetadata.COLUMN_LABEL_PREDICATE;
- case 3:
- return TripleResultsMetadata.COLUMN_LABEL_OBJECT;
- default:
- throw new SQLException("Column Index is out of bounds");
- }
- }
-
- @Override
- public int isNullable(int column) throws SQLException {
- return columnNoNulls;
+ super(results, makeColumns(results));
}
}
Added: jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/metadata/columns/BooleanColumn.java
URL: http://svn.apache.org/viewvc/jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/metadata/columns/BooleanColumn.java?rev=1465026&view=auto
==============================================================================
--- jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/metadata/columns/BooleanColumn.java (added)
+++ jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/metadata/columns/BooleanColumn.java Fri Apr 5 16:23:57 2013
@@ -0,0 +1,33 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.jdbc.results.metadata.columns;
+
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+import java.sql.Types;
+
+public class BooleanColumn extends SparqlColumnInfo {
+
+ public BooleanColumn(String label, int nullable) throws SQLException {
+ super(label, Types.BOOLEAN, nullable);
+ this.setClassName(Boolean.class.getCanonicalName());
+ this.setTypeName(Boolean.class.getCanonicalName());
+ }
+
+}
Added: jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/metadata/columns/ColumnInfo.java
URL: http://svn.apache.org/viewvc/jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/metadata/columns/ColumnInfo.java?rev=1465026&view=auto
==============================================================================
--- jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/metadata/columns/ColumnInfo.java (added)
+++ jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/metadata/columns/ColumnInfo.java Fri Apr 5 16:23:57 2013
@@ -0,0 +1,146 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.jdbc.results.metadata.columns;
+
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+import java.sql.Types;
+
+import com.hp.hpl.jena.graph.Node;
+
+/**
+ * Helper class for representing column information
+ *
+ */
+public abstract class ColumnInfo {
+
+ private String label, className = Object.class.getCanonicalName(), typeName = Node.class.getCanonicalName();
+ private int displaySize = Integer.MAX_VALUE, type = Types.JAVA_OBJECT, precision = 0, scale = 0,
+ nullable = ResultSetMetaData.columnNoNulls;
+ private boolean signed = false;
+
+ /**
+ * Creates new column information
+ *
+ * @param label
+ * Column Label
+ * @throws SQLException
+ */
+ public ColumnInfo(String label, int type) throws SQLException {
+ if (label == null)
+ throw new SQLException("Column label cannot be null");
+ this.label = label;
+ this.type = type;
+ }
+
+ public final String getLabel() {
+ return this.label;
+ }
+
+ public final String getClassName() {
+ return this.className;
+ }
+
+ protected void setClassName(String className) {
+ this.className = className;
+ }
+
+ public final int getDisplaySize() {
+ return this.displaySize;
+ }
+
+ protected final void setDisplaySize(int size) {
+ this.displaySize = size;
+ }
+
+ public final int getType() {
+ return this.type;
+ }
+
+ public final String getTypeName() {
+ return this.typeName;
+ }
+
+ protected final void setTypeName(String typeName) {
+ this.typeName = typeName;
+ }
+
+ public final int getPrecision() {
+ return this.precision;
+ }
+
+ protected final void setPrecision(int precision) {
+ this.precision = precision;
+ }
+
+ public final int getScale() {
+ return this.scale;
+ }
+
+ protected final void setScale(int scale) {
+ this.scale = scale;
+ }
+
+ public final int isNullable() {
+ return this.nullable;
+ }
+
+ protected final void setNullable(int nullable) {
+ this.nullable = nullable;
+ }
+
+ public boolean isCaseSensitive() {
+ // Most types in RDF/SPARQL are subject to case sensitivity especially
+ // when talking strict RDF equality semantics
+ return true;
+ }
+
+ public boolean isCurrency() {
+ // No specific currency type in RDF/SPARQL
+ return false;
+ }
+
+ public boolean isAutoIncrement() {
+ // SPARQL engines don't have a notion of auto-increment
+ return false;
+ }
+
+ public boolean isWritable() {
+ // All Jena JDBC results are read-only currently
+ return false;
+ }
+
+ public boolean isReadOnly() {
+ // All Jena JDBC results are read-only currently
+ return true;
+ }
+
+ public boolean isSearchable() {
+ // Assume all columns are searchable since the entire RDF dataset is serchable
+ return true;
+ }
+
+ public final boolean isSigned() {
+ return this.signed;
+ }
+
+ protected final void setSigned(boolean signed) {
+ this.signed = signed;
+ }
+}
Added: jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/metadata/columns/SparqlColumnInfo.java
URL: http://svn.apache.org/viewvc/jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/metadata/columns/SparqlColumnInfo.java?rev=1465026&view=auto
==============================================================================
--- jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/metadata/columns/SparqlColumnInfo.java (added)
+++ jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/metadata/columns/SparqlColumnInfo.java Fri Apr 5 16:23:57 2013
@@ -0,0 +1,34 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.jdbc.results.metadata.columns;
+
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+import java.sql.Types;
+
+import com.hp.hpl.jena.graph.Node;
+
+public class SparqlColumnInfo extends ColumnInfo {
+
+ public SparqlColumnInfo(String label, int type, int nullable) throws SQLException {
+ super(label, type);
+ this.setClassName(Node.class.getCanonicalName());
+ this.setNullable(nullable);
+ }
+}
Added: jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/metadata/columns/StringColumn.java
URL: http://svn.apache.org/viewvc/jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/metadata/columns/StringColumn.java?rev=1465026&view=auto
==============================================================================
--- jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/metadata/columns/StringColumn.java (added)
+++ jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/metadata/columns/StringColumn.java Fri Apr 5 16:23:57 2013
@@ -0,0 +1,31 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.jdbc.results.metadata.columns;
+
+import java.sql.SQLException;
+import java.sql.Types;
+
+public class StringColumn extends SparqlColumnInfo {
+
+ public StringColumn(String label, int nullable) throws SQLException {
+ super(label, Types.NVARCHAR, nullable);
+ this.setClassName(String.class.getName());
+ }
+
+}