You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2016/07/12 09:07:23 UTC

[1/2] jena git commit: Remove the old RDB vocabulary.

Repository: jena
Updated Branches:
  refs/heads/master 10284133f -> 3bbe2d8d7


Remove the old RDB vocabulary.

RDB has not been supported for quite some time.

Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/4507109d
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/4507109d
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/4507109d

Branch: refs/heads/master
Commit: 4507109d2cc5c7fa21dc675fc7271e0d841f9d5e
Parents: 1028413
Author: Andy Seaborne <an...@apache.org>
Authored: Mon Jul 11 16:56:53 2016 +0100
Committer: Andy Seaborne <an...@apache.org>
Committed: Mon Jul 11 16:56:53 2016 +0100

----------------------------------------------------------------------
 .../java/org/apache/jena/vocabulary/DB.java     | 76 --------------------
 .../jena/vocabulary/test/TestVocabDB.java       | 65 -----------------
 .../jena/vocabulary/test/TestVocabularies.java  |  1 -
 3 files changed, 142 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/4507109d/jena-core/src/main/java/org/apache/jena/vocabulary/DB.java
----------------------------------------------------------------------
diff --git a/jena-core/src/main/java/org/apache/jena/vocabulary/DB.java b/jena-core/src/main/java/org/apache/jena/vocabulary/DB.java
deleted file mode 100644
index 2d5aabc..0000000
--- a/jena-core/src/main/java/org/apache/jena/vocabulary/DB.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * 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.
- */
-
-/* Vocabulary Class for DB.
- */
-
-package org.apache.jena.vocabulary;
-
-import org.apache.jena.rdf.model.* ;
-
-/**
- * Vocabulary for Database properties.
- */
-public class DB {
-
-    public static final String uri = "http://jena.hpl.hp.com/2003/04/DB#";
-
-    /** returns the URI for this schema
-     * @return the URI for this schema
-     */
-    public static String getURI() {
-          return uri;
-    }
-
-    public static final Resource systemGraphName = ResourceFactory.createResource(uri + "SystemGraph" );
-    public static final Resource layoutVersion = ResourceFactory.createResource( uri + "LayoutVersion" );
-    public static final Property engineType = ResourceFactory.createProperty(uri + "EngineType" );
-    public static final Property driverVersion = ResourceFactory.createProperty(uri + "DriverVersion" );
-    public static final Property formatDate = ResourceFactory.createProperty(uri + "FormatDate" );
-    public static final Property graph = ResourceFactory.createProperty(uri + "Graph" );
-    
-	public static final Property longObjectLength = ResourceFactory.createProperty(uri + "LongObjectLength" );
-	public static final Property indexKeyLength = ResourceFactory.createProperty(uri + "IndexKeyLength" );
-	public static final Property isTransactionDb = ResourceFactory.createProperty(uri + "IsTransactionDb" );
-	public static final Property doCompressURI = ResourceFactory.createProperty(uri + "DoCompressURI" );
-	public static final Property compressURILength = ResourceFactory.createProperty(uri + "CompressURILength" );
-	public static final Property tableNamePrefix = ResourceFactory.createProperty(uri + "TableNamePrefix" );
-
-    public static final Property graphName = ResourceFactory.createProperty(uri + "GraphName" );
-    public static final Property graphType = ResourceFactory.createProperty(uri + "GraphType" );
-    public static final Property graphLSet = ResourceFactory.createProperty(uri + "GraphLSet" );
-    public static final Property graphPrefix = ResourceFactory.createProperty(uri + "GraphPrefix" );
-    public static final Property graphId = ResourceFactory.createProperty(uri + "GraphId" );
-    public static final Property graphDBSchema = ResourceFactory.createProperty(uri + "GraphDBSchema" );
-    public static final Property stmtTable = ResourceFactory.createProperty(uri + "StmtTable" );
-    public static final Property reifTable = ResourceFactory.createProperty(uri + "ReifTable" );
-
-
-    public static final Property prefixValue = ResourceFactory.createProperty(uri + "PrefixValue" );
-    public static final Property prefixURI = ResourceFactory.createProperty(uri + "PrefixURI" );
-
-    public static final Property lSetName = ResourceFactory.createProperty(uri + "LSetName" );
-    public static final Property lSetType = ResourceFactory.createProperty(uri + "LSetType" );
-    public static final Property lSetPSet = ResourceFactory.createProperty(uri + "LSetPSet" );
-
-    public static final Property pSetName = ResourceFactory.createProperty(uri + "PSetName" );
-    public static final Property pSetType = ResourceFactory.createProperty(uri + "PSetType" );
-    public static final Property pSetTable = ResourceFactory.createProperty(uri + "PSetTable" );
-
-    public static final Resource undefined = ResourceFactory.createResource(uri + "undefined" ) ;
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/4507109d/jena-core/src/test/java/org/apache/jena/vocabulary/test/TestVocabDB.java
----------------------------------------------------------------------
diff --git a/jena-core/src/test/java/org/apache/jena/vocabulary/test/TestVocabDB.java b/jena-core/src/test/java/org/apache/jena/vocabulary/test/TestVocabDB.java
deleted file mode 100644
index 7dfd104..0000000
--- a/jena-core/src/test/java/org/apache/jena/vocabulary/test/TestVocabDB.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * 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.vocabulary.test;
-
-import junit.framework.*;
-import org.apache.jena.vocabulary.* ;
-
-public class TestVocabDB extends VocabTestBase
-    {
-    public TestVocabDB(String name)
-        { super(name); }
-
-    public static TestSuite suite()
-        { return new TestSuite( TestVocabDB.class ); }
-
-    public void testXX()
-        {
-		String ns = "http://jena.hpl.hp.com/2003/04/DB#";
-    /* */
-        assertResource( ns + "SystemGraph", DB.systemGraphName );
-        assertProperty( ns + "EngineType", DB.engineType );
-        assertProperty( ns + "DriverVersion", DB.driverVersion );
-        assertProperty( ns + "FormatDate", DB.formatDate );
-        assertProperty( ns + "Graph", DB.graph );
-        // assertProperty( ns + "MaxLiteral", DB.maxLiteral );
-    /* */
-        assertProperty( ns + "GraphName", DB.graphName );
-        assertProperty( ns + "GraphType", DB.graphType );
-        assertProperty( ns + "GraphLSet", DB.graphLSet );
-        assertProperty( ns + "GraphPrefix", DB.graphPrefix );
-        assertProperty( ns + "GraphId", DB.graphId );
-        assertProperty( ns + "GraphDBSchema", DB.graphDBSchema );
-        assertProperty( ns + "StmtTable", DB.stmtTable );
-        assertProperty( ns + "ReifTable", DB.reifTable );
-    /* */
-        assertProperty( ns + "PrefixValue", DB.prefixValue );
-        assertProperty( ns + "PrefixURI", DB.prefixURI );
-    /* */
-        assertProperty( ns + "LSetName", DB.lSetName );
-        assertProperty( ns + "LSetType", DB.lSetType );
-        assertProperty( ns + "LSetPSet", DB.lSetPSet );
-    /* */
-        assertProperty( ns + "PSetName", DB.pSetName );
-        assertProperty( ns + "PSetType", DB.pSetType );
-        assertProperty( ns + "PSetTable", DB.pSetTable );
-    /* */
-        assertResource( ns + "undefined", DB.undefined );
-        }
-    }

http://git-wip-us.apache.org/repos/asf/jena/blob/4507109d/jena-core/src/test/java/org/apache/jena/vocabulary/test/TestVocabularies.java
----------------------------------------------------------------------
diff --git a/jena-core/src/test/java/org/apache/jena/vocabulary/test/TestVocabularies.java b/jena-core/src/test/java/org/apache/jena/vocabulary/test/TestVocabularies.java
index 63bd7e2..dce0fd0 100644
--- a/jena-core/src/test/java/org/apache/jena/vocabulary/test/TestVocabularies.java
+++ b/jena-core/src/test/java/org/apache/jena/vocabulary/test/TestVocabularies.java
@@ -34,7 +34,6 @@ public class TestVocabularies extends TestCase
         result.addTest( TestVocabRDF.suite() );
         result.addTest( TestVocabRDFS.suite() );
         result.addTest( TestVocabVCARD.suite() );
-        result.addTest( TestVocabDB.suite() );
         result.addTest( TestVocabRSS.suite() );
         result.addTest( TestVocabDC10.suite() );
         result.addTestSuite( TestOWL2Vocabulary.class );


[2/2] jena git commit: Update comments. Reformat. Simplify.

Posted by an...@apache.org.
Update comments. Reformat. Simplify.

Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/3bbe2d8d
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/3bbe2d8d
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/3bbe2d8d

Branch: refs/heads/master
Commit: 3bbe2d8d7b6f6b47740b68df244e25cbb8473779
Parents: 4507109
Author: Andy Seaborne <an...@apache.org>
Authored: Tue Jul 12 10:06:52 2016 +0100
Committer: Andy Seaborne <an...@apache.org>
Committed: Tue Jul 12 10:06:52 2016 +0100

----------------------------------------------------------------------
 .../org/apache/jena/sparql/expr/E_Function.java | 58 +++++++-------------
 .../jena/sparql/function/FunctionBase.java      | 37 ++-----------
 .../jena/sparql/function/library/SystemVar.java | 28 ++++++----
 3 files changed, 41 insertions(+), 82 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/3bbe2d8d/jena-arq/src/main/java/org/apache/jena/sparql/expr/E_Function.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/E_Function.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/E_Function.java
index 63ddc67..7b1501e 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/E_Function.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/E_Function.java
@@ -39,99 +39,81 @@ public class E_Function extends ExprFunctionN
     public static boolean WarnOnUnknownFunction = true ;
     private String functionIRI ;
     
-    // Only set after a copySubstitute has been done by PlanFilter.
-    // at which point this instance if not part of the query abstract syntax.  
     private Function function = null ;
     private boolean functionBound = false ;
 
-    public E_Function(String functionIRI, ExprList args)
-    {
+    public E_Function(String functionIRI, ExprList args) {
         super(name, args) ;
-        this.functionIRI = functionIRI ; 
+        this.functionIRI = functionIRI ;
     }
 
     @Override
     public String getFunctionIRI() { return functionIRI ; }
     
     // The Function subsystem takes over evaluation via SpecialForms.
-    // This is merely to allow "function" to behave as special forms
-    // (this is discouraged).
-    // Doing the function call in evalSpecial maintains the old 
-    // interface to functions.
+    // This allows a "function" to behave as special forms (this is discouraged).
     
     @Override
-    public NodeValue evalSpecial(Binding binding, FunctionEnv env)
-    {
+    public NodeValue evalSpecial(Binding binding, FunctionEnv env) {
         // Only needed because some tests call straight in.
         // Otherwise, the buildFunction() calls should have done everything
-        if ( ! functionBound  )
+        if ( !functionBound )
             buildFunction(env.getContext()) ;
         if ( function == null )
-            throw new ExprEvalException("URI <"+getFunctionIRI()+"> not bound") ;
+            throw new ExprEvalException("URI <" + getFunctionIRI() + "> not bound") ;
         NodeValue r = function.exec(binding, args, getFunctionIRI(), env) ;
         return r ;
     }
     
     @Override
-    public NodeValue eval(List<NodeValue> args)
-    {
-        // For functions, we delay argument evaluation to the "Function" heierarchy
-        // so applications can add their own functional forms.
+    public NodeValue eval(List<NodeValue> args) {
+        // evalSpecial hands over function evaluation to the "Function" hierarchy
         throw new ARQInternalErrorException() ;
     }
 
-    public void buildFunction(Context cxt)
-    {
+    public void buildFunction(Context cxt) {
         try { bindFunction(cxt) ; }
-        catch (ExprException ex)
-        {
+        catch (ExprException ex) {
             if ( WarnOnUnknownFunction )
                 ARQ.getExecLogger().warn("URI <"+functionIRI+"> has no registered function factory") ;
         }
     }
     
-    private void bindFunction(Context cxt)
-    {
+    private void bindFunction(Context cxt) {
         if ( functionBound )
             return ;
-        
+
         FunctionRegistry registry = chooseRegistry(cxt) ;
         FunctionFactory ff = registry.get(functionIRI) ;
-        
-        if ( ff == null )
-        {
+
+        if ( ff == null ) {
             functionBound = true ;
-            throw new ExprEvalException("URI <"+functionIRI+"> not found as a function") ;
+            throw new ExprEvalException("URI <" + functionIRI + "> not found as a function") ;
         }
         function = ff.create(functionIRI) ;
         function.build(functionIRI, args) ;
         functionBound = true ;
     }
     
-    private FunctionRegistry chooseRegistry(Context context)
-    {
+    private FunctionRegistry chooseRegistry(Context context) {
         FunctionRegistry registry = FunctionRegistry.get(context) ;
         if ( registry == null )
             registry = FunctionRegistry.get() ;
         return registry ;
     }
-    
+
     @Override
-    public String getFunctionPrintName(SerializationContext cxt)
-    {
+    public String getFunctionPrintName(SerializationContext cxt) {
         return FmtUtils.stringForURI(functionIRI, cxt) ;
     }
 
     @Override
-    public String getFunctionName(SerializationContext cxt)
-    {
+    public String getFunctionName(SerializationContext cxt) {
         return FmtUtils.stringForURI(functionIRI, cxt) ;
     }
 
-
     @Override
-    public Expr copy(ExprList newArgs)
-    {
+    public Expr copy(ExprList newArgs) {
         return new E_Function(getFunctionIRI(), newArgs) ;
     }
 }

http://git-wip-us.apache.org/repos/asf/jena/blob/3bbe2d8d/jena-arq/src/main/java/org/apache/jena/sparql/function/FunctionBase.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/FunctionBase.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/FunctionBase.java
index c2c54be..c55a988 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/function/FunctionBase.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/FunctionBase.java
@@ -26,32 +26,18 @@ import org.apache.jena.sparql.engine.binding.Binding ;
 import org.apache.jena.sparql.expr.Expr ;
 import org.apache.jena.sparql.expr.ExprList ;
 import org.apache.jena.sparql.expr.NodeValue ;
-import org.apache.jena.sparql.util.Context ;
 
-/** Interface to value-testing extensions to the expression evaluator. */
+/** Impleemntation root for custom function evaluation. */  
+public abstract class FunctionBase implements Function {
 
-public abstract class FunctionBase implements Function
-{
-    String uri = null ;
-    protected ExprList arguments = null ;
-    private FunctionEnv env ;
-    
     @Override
-    public final void build(String uri, ExprList args)
-    {
-        this.uri = uri ;
-        arguments = args ;
+    public final void build(String uri, ExprList args) {
+        // Rename for legacy reasons.
         checkBuild(uri, args) ;
     }
 
     @Override
-    public NodeValue exec(Binding binding, ExprList args, String uri, FunctionEnv env)
-    {
-        // This is merely to allow functions to be 
-        // It duplicates code in E_Function/ExprFunctionN.
-        
-        this.env = env ;
-        
+    public NodeValue exec(Binding binding, ExprList args, String uri, FunctionEnv env) {
         if ( args == null )
             // The contract on the function interface is that this should not happen.
             throw new ARQInternalErrorException("FunctionBase: Null args list") ;
@@ -64,24 +50,11 @@ public abstract class FunctionBase implements Function
         }
         
         NodeValue nv =  exec(evalArgs) ;
-        arguments = null ;
         return nv ;
     }
     
-    /** Return the Context object for this execution */
-    public Context getContext() { return env.getContext() ; }
-    
     /** Function call to a list of evaluated argument values */ 
     public abstract NodeValue exec(List<NodeValue> args) ;
 
     public abstract void checkBuild(String uri, ExprList args) ;
-    
-//    /** Get argument, indexing from 1 **/
-//    public NodeValue getArg(int i)
-//    {
-//        i = i-1 ;
-//        if ( i < 0 || i >= arguments.size()  )
-//            return null ;
-//        return (NodeValue)arguments.get(i) ;
-//    }
 }

http://git-wip-us.apache.org/repos/asf/jena/blob/3bbe2d8d/jena-arq/src/main/java/org/apache/jena/sparql/function/library/SystemVar.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/SystemVar.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/SystemVar.java
index 7baf105..97c7431 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/SystemVar.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/SystemVar.java
@@ -18,21 +18,23 @@
 
 package org.apache.jena.sparql.function.library;
 
-//import org.apache.commons.logging.*;
-
 import org.apache.jena.atlas.lib.Lib ;
 import org.apache.jena.graph.Node ;
+import org.apache.jena.sparql.engine.binding.Binding ;
 import org.apache.jena.sparql.expr.ExprEvalException ;
 import org.apache.jena.sparql.expr.ExprException ;
+import org.apache.jena.sparql.expr.ExprList ;
 import org.apache.jena.sparql.expr.NodeValue ;
-import org.apache.jena.sparql.function.FunctionBase0 ;
+import org.apache.jena.sparql.function.Function ;
+import org.apache.jena.sparql.function.FunctionEnv ;
 import org.apache.jena.sparql.util.Symbol ;
 
-/** Function that returns the value of a system variable. */
-
-public class SystemVar extends FunctionBase0
+/**
+ * Function that returns the value of a system variable.
+ */
+public class SystemVar implements Function
 {
-    Symbol systemSymbol ;
+    private Symbol systemSymbol ;
     protected SystemVar(Symbol systemSymbol)
     {
         if ( systemSymbol == null )
@@ -40,12 +42,11 @@ public class SystemVar extends FunctionBase0
         this.systemSymbol = systemSymbol ;
     }
     
-    /** Processes evaluated args */
+    // Need to intercept exec so we can get to the FunctionEnv
     @Override
-    public NodeValue exec()
-    {
-        Object obj = getContext().get(systemSymbol) ;
-        
+    public NodeValue exec(Binding binding, ExprList args, String uri, FunctionEnv env) {
+        // Ignore arguments.
+        Object obj = env.getContext().get(systemSymbol) ;
         if ( obj == null )
             throw new ExprEvalException("null for system symbol: "+systemSymbol) ;
         if ( ! ( obj instanceof Node ) )
@@ -58,4 +59,7 @@ public class SystemVar extends FunctionBase0
         NodeValue nv = NodeValue.makeNode(n) ;
         return nv ;
     }
+
+    @Override
+    public void build(String uri, ExprList args) {}
 }