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 2014/05/22 17:06:19 UTC

svn commit: r1596898 - in /jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/function: StandardFunctions.java library/FN_StrAfter.java library/FN_StrBefore.java

Author: andy
Date: Thu May 22 15:06:19 2014
New Revision: 1596898

URL: http://svn.apache.org/r1596898
Log:
Missing fn:string-after/string-before named functions

Added:
    jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/function/library/FN_StrAfter.java
    jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/function/library/FN_StrBefore.java
Modified:
    jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/function/StandardFunctions.java

Modified: jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/function/StandardFunctions.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/function/StandardFunctions.java?rev=1596898&r1=1596897&r2=1596898&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/function/StandardFunctions.java (original)
+++ jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/function/StandardFunctions.java Thu May 22 15:06:19 2014
@@ -87,6 +87,9 @@ public class StandardFunctions
         
         add(registry, xfn+"contains",       FN_StrContains.class) ;
         add(registry, xfn+"ends-with",      FN_StrEndsWith.class) ;
+
+        add(registry, xfn+"substring-before",   FN_StrBefore.class) ;
+        add(registry, xfn+"substring-after",    FN_StrAfter.class) ;
         
         add(registry, xfn+"abs",            FN_Abs.class) ;
         add(registry, xfn+"ceiling",        FN_Ceiling.class) ;

Added: jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/function/library/FN_StrAfter.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/function/library/FN_StrAfter.java?rev=1596898&view=auto
==============================================================================
--- jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/function/library/FN_StrAfter.java (added)
+++ jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/function/library/FN_StrAfter.java Thu May 22 15:06:19 2014
@@ -0,0 +1,36 @@
+/*
+ * 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 com.hp.hpl.jena.sparql.function.library;
+
+import com.hp.hpl.jena.sparql.expr.NodeValue ;
+import com.hp.hpl.jena.sparql.expr.nodevalue.XSDFuncOp ;
+import com.hp.hpl.jena.sparql.function.FunctionBase2 ;
+
+/** fn:substring-after */
+
+public class FN_StrAfter extends FunctionBase2
+{
+    public FN_StrAfter() { super() ; }
+
+    @Override
+    public NodeValue exec(NodeValue str, NodeValue match)
+    {
+        return XSDFuncOp.strAfter(str, match) ;
+    }
+}

Added: jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/function/library/FN_StrBefore.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/function/library/FN_StrBefore.java?rev=1596898&view=auto
==============================================================================
--- jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/function/library/FN_StrBefore.java (added)
+++ jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/function/library/FN_StrBefore.java Thu May 22 15:06:19 2014
@@ -0,0 +1,36 @@
+/*
+ * 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 com.hp.hpl.jena.sparql.function.library;
+
+import com.hp.hpl.jena.sparql.expr.NodeValue ;
+import com.hp.hpl.jena.sparql.expr.nodevalue.XSDFuncOp ;
+import com.hp.hpl.jena.sparql.function.FunctionBase2 ;
+
+/** fn:substring-before */
+
+public class FN_StrBefore extends FunctionBase2
+{
+    public FN_StrBefore() { super() ; }
+
+    @Override
+    public NodeValue exec(NodeValue str, NodeValue match)
+    {
+        return XSDFuncOp.strBefore(str, match) ;
+    }
+}