jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [03/51] [partial] jena git commit: Rename com.hp.hpl.jena.* as org.apache.jena.*
Date Thu, 23 Apr 2015 19:56:19 GMT
http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/P_Seq.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/P_Seq.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/P_Seq.java
deleted file mode 100644
index 1a85ec2..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/P_Seq.java
+++ /dev/null
@@ -1,45 +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 com.hp.hpl.jena.sparql.path;
-
-import com.hp.hpl.jena.sparql.util.NodeIsomorphismMap ;
-
-public class P_Seq extends P_Path2
-{
-
-    public P_Seq(Path p1, Path p2)
-    {
-        super(p1, p2) ;
-    }
-
-    @Override
-    public void visit(PathVisitor visitor)
-    { visitor.visit(this) ; }
-    
-    @Override
-    public int hashSeed() { return hashSeq ; }
-
-    @Override
-    public boolean equalTo(Path path2, NodeIsomorphismMap isoMap)
-    {
-        if ( ! ( path2 instanceof P_Seq ) ) return false ;
-        return equalsIso((P_Path2)path2, isoMap) ;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/P_Shortest.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/P_Shortest.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/P_Shortest.java
deleted file mode 100644
index 9058d4f..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/P_Shortest.java
+++ /dev/null
@@ -1,50 +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 com.hp.hpl.jena.sparql.path;
-
-import com.hp.hpl.jena.sparql.util.NodeIsomorphismMap ;
-
-public class P_Shortest extends P_Path1
-{
-    public P_Shortest(Path p)
-    {
-         super(p) ;
-    }
-    
-    @Override
-    public void visit(PathVisitor visitor)
-    { visitor.visit(this) ; }
-    
-    @Override
-    public boolean equalTo(Path path2, NodeIsomorphismMap isoMap)
-    {
-        if ( ! ( path2 instanceof P_Shortest ) ) return false ;
-        P_Shortest other = (P_Shortest)path2 ;
-        return getSubPath().equalTo(other.getSubPath(), isoMap)  ;
-    }
-
-    @Override
-    public int hashCode()
-    {
-        return getSubPath().hashCode() ^ hashShortest ;
-    }
-
-   
-
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/P_ZeroOrMore1.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/P_ZeroOrMore1.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/P_ZeroOrMore1.java
deleted file mode 100644
index 366aab0..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/P_ZeroOrMore1.java
+++ /dev/null
@@ -1,47 +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 com.hp.hpl.jena.sparql.path;
-
-import com.hp.hpl.jena.sparql.util.NodeIsomorphismMap ;
-
-public class P_ZeroOrMore1 extends P_Path1
-{
-    public P_ZeroOrMore1(Path path)
-    {
-        super(path) ;
-    }
-
-    @Override
-    public boolean equalTo(Path path2, NodeIsomorphismMap isoMap)
-    {
-        if ( ! ( path2 instanceof P_ZeroOrMore1 ) ) return false ;
-        P_ZeroOrMore1 other = (P_ZeroOrMore1)path2 ;
-        return getSubPath().equalTo(other.getSubPath(), isoMap)  ;
-    }
-
-    @Override
-    public int hashCode()
-    {
-        return hashZeroOrMoreN ^ getSubPath().hashCode() ;
-    }
-
-    @Override
-    public void visit(PathVisitor visitor)
-    { visitor.visit(this) ; }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/P_ZeroOrMoreN.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/P_ZeroOrMoreN.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/P_ZeroOrMoreN.java
deleted file mode 100644
index 57a8c05..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/P_ZeroOrMoreN.java
+++ /dev/null
@@ -1,47 +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 com.hp.hpl.jena.sparql.path;
-
-import com.hp.hpl.jena.sparql.util.NodeIsomorphismMap ;
-
-public class P_ZeroOrMoreN extends P_Path1
-{
-    public P_ZeroOrMoreN(Path path)
-    {
-        super(path) ;
-    }
-
-    @Override
-    public boolean equalTo(Path path2, NodeIsomorphismMap isoMap)
-    {
-        if ( ! ( path2 instanceof P_ZeroOrMoreN ) ) return false ;
-        P_ZeroOrMoreN other = (P_ZeroOrMoreN)path2 ;
-        return getSubPath().equalTo(other.getSubPath(), isoMap)  ;
-    }
-
-    @Override
-    public int hashCode()
-    {
-        return hashZeroOrMoreN ^ getSubPath().hashCode() ;
-    }
-
-    @Override
-    public void visit(PathVisitor visitor)
-    { visitor.visit(this) ; }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/P_ZeroOrOne.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/P_ZeroOrOne.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/P_ZeroOrOne.java
deleted file mode 100644
index bb6cd6c..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/P_ZeroOrOne.java
+++ /dev/null
@@ -1,47 +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 com.hp.hpl.jena.sparql.path;
-
-import com.hp.hpl.jena.sparql.util.NodeIsomorphismMap ;
-
-public class P_ZeroOrOne extends P_Path1
-{
-    public P_ZeroOrOne(Path path)
-    {
-        super(path) ;
-    }
-
-    @Override
-    public boolean equalTo(Path path2, NodeIsomorphismMap isoMap)
-    {
-        if ( ! ( path2 instanceof P_ZeroOrOne ) ) return false ;
-        P_ZeroOrOne other = (P_ZeroOrOne)path2 ;
-        return getSubPath().equalTo(other.getSubPath(), isoMap)  ;
-    }
-
-    @Override
-    public int hashCode()
-    {
-        return hashZeroOrOne ^ getSubPath().hashCode() ;
-    }
-
-    @Override
-    public void visit(PathVisitor visitor)
-    { visitor.visit(this) ; }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/Path.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/Path.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/Path.java
deleted file mode 100644
index a5735c0..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/Path.java
+++ /dev/null
@@ -1,29 +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 com.hp.hpl.jena.sparql.path;
-
-import com.hp.hpl.jena.sparql.core.Prologue ;
-import com.hp.hpl.jena.sparql.util.NodeIsomorphismMap ;
-
-public interface Path
-{
-    public void visit(PathVisitor visitor) ;
-    public boolean equalTo(Path path2, NodeIsomorphismMap isoMap) ;
-    public String toString(Prologue prolog) ;
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/PathBase.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/PathBase.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/PathBase.java
deleted file mode 100644
index b598d5b..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/PathBase.java
+++ /dev/null
@@ -1,75 +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 com.hp.hpl.jena.sparql.path;
-
-import com.hp.hpl.jena.sparql.core.Prologue ;
-import com.hp.hpl.jena.sparql.util.NodeIsomorphismMap ;
-
-public abstract class PathBase implements Path
-{
-    protected static final int hashAlt          = 0x190 ;
-    protected static final int hashSeq          = 0x191 ;
-    protected static final int hashMod          = 0x192 ;
-    protected static final int hashInverse      = 0x193 ;
-    protected static final int hashNegPropClass = 0x194 ;
-    protected static final int hashLink         = 0x195 ;
-    protected static final int hashRevLink      = 0x196 ;
-    
-    protected static final int hashZeroOrMore1  = 0x197 ;
-    protected static final int hashOneOrMore1   = 0x198 ;
-    protected static final int hashZeroOrMoreN  = 0x199 ;
-    protected static final int hashOneOrMoreN   = 0x200 ;
-    
-    protected static final int hashZeroOrOne    = 0x201 ;
-    protected static final int hashFixedLength  = 0x202 ;
-    protected static final int hashDistinct     = 0x203 ;
-    protected static final int hashMulti        = 0x204 ;
-    protected static final int hashShortest     = 0x205 ;
-
-    
-    @Override
-    public abstract int hashCode() ;
-    
-    // If the labeMap is null, do .equals() on nodes, else map from
-    // bNode varables in one to bNodes variables in the other 
-    @Override
-    public abstract boolean equalTo(Path path2, NodeIsomorphismMap isoMap) ;
-    
-    @Override
-    final public boolean equals(Object path2)
-    { 
-        if ( this == path2 ) return true ;
-
-        if ( ! ( path2 instanceof Path ) )
-            return false ;
-        return equalTo((Path)path2, null) ;
-    }
-    
-    @Override
-    public String toString()
-    {
-        return PathWriter.asString(this) ;
-    }
-    
-    @Override
-    public String toString(Prologue prologue)
-    {
-        return PathWriter.asString(this, prologue) ;
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/PathCompiler.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/PathCompiler.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/PathCompiler.java
deleted file mode 100644
index ef0e193..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/PathCompiler.java
+++ /dev/null
@@ -1,195 +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 com.hp.hpl.jena.sparql.path;
-
-import com.hp.hpl.jena.graph.Node ;
-import com.hp.hpl.jena.graph.Triple ;
-import com.hp.hpl.jena.sparql.ARQConstants ;
-import com.hp.hpl.jena.sparql.core.PathBlock ;
-import com.hp.hpl.jena.sparql.core.TriplePath ;
-import com.hp.hpl.jena.sparql.core.VarAlloc ;
-
-public class PathCompiler
-{
-    // Convert to work on OpPath.
-    // Need pre (and post) BGPs.
-    
-    private static VarAlloc varAlloc = new VarAlloc(ARQConstants.allocVarAnonMarker+"P") ;
-    
-    // Move to AlgebraCompiler and have a per-transaction scoped var generator 
-    
-    // ---- Syntax-based
-    
-    /** Simplify : turns constructs in simple triples and simpler TriplePaths where possible */ 
-    public PathBlock reduce(PathBlock pathBlock)
-    {
-        PathBlock x = new PathBlock() ;
-        // No context during algebra generation time.
-//        VarAlloc varAlloc = VarAlloc.get(context, ARQConstants.sysVarAllocNamed) ;
-//        if ( varAlloc == null )
-//            // Panic
-//            throw new ARQInternalErrorException("No execution-scope allocator for variables") ;
-        
-        // Translate one into another.
-        reduce(x, pathBlock, varAlloc) ;
-        return x ;
-    }
-   
-    void reduce(PathBlock x, PathBlock pathBlock, VarAlloc varAlloc )
-    {
-        for ( TriplePath tp : pathBlock )
-        {
-            if ( tp.isTriple() )
-            {
-                x.add(tp) ;
-                continue ;
-            }
-            reduce(x, varAlloc, tp.getSubject(), tp.getPath(), tp.getObject()) ;
-        }
-    }
-    
-    // ---- Algebra-based transformation.
-    public PathBlock reduce(TriplePath triplePath)
-    {
-        PathBlock x = new PathBlock() ;
-        reduce(x, varAlloc, triplePath.getSubject(), triplePath.getPath(), triplePath.getObject()) ;
-        return x ;
-    }
-    
-    public PathBlock reduce(Node start, Path path, Node finish)
-    {
-        PathBlock x = new PathBlock() ;
-        reduce(x, varAlloc, start, path, finish) ;
-        return x ;
-    }
-    
-    private static void reduce(PathBlock x, VarAlloc varAlloc, Node startNode, Path path, Node endNode)
-    {
-        // V-i-s-i-t-o-r!
-        
-        if ( path instanceof P_Link )
-        {
-            Node pred = ((P_Link)path).getNode() ;
-            Triple t = new Triple(startNode, pred, endNode) ; 
-            x.add(new TriplePath(t)) ;
-            return ;
-        }
-
-        if ( path instanceof P_Seq )
-        {
-            P_Seq ps = (P_Seq)path ;
-            Node v = varAlloc.allocVar() ;
-            reduce(x, varAlloc, startNode, ps.getLeft(), v) ;
-            reduce(x, varAlloc, v, ps.getRight(), endNode) ;
-            return ;
-        }
-
-        if ( path instanceof P_Inverse )
-        {
-            reduce(x, varAlloc, endNode, ((P_Inverse)path).getSubPath(), startNode) ;
-            return ;
-        }
-
-        if ( path instanceof P_FixedLength )
-        {
-            P_FixedLength pFixed = (P_FixedLength)path ;
-            long N = pFixed.getCount() ;
-            if ( N > 0 )
-            {
-                // Don't do {0}
-                Node stepStart = startNode ;
-    
-                for ( long i = 0 ; i < N-1 ; i++ )
-                {
-                    Node v = varAlloc.allocVar() ;
-                    reduce(x, varAlloc, stepStart, pFixed.getSubPath(), v) ;
-                    stepStart = v ;
-                }
-                reduce(x, varAlloc, stepStart, pFixed.getSubPath(), endNode) ;
-                return ;
-            }
-        }
-        
-        if ( path instanceof P_Mod )
-        {
-            P_Mod pMod = (P_Mod)path ;
-            if ( pMod.isFixedLength() && pMod.getFixedLength() > 0 )
-            {
-                long N = pMod.getFixedLength() ;
-                if ( N > 0 )
-                {
-                    Node stepStart = startNode ;
-
-                    for ( long i = 0 ; i < N-1 ; i++ )
-                    {
-                        Node v = varAlloc.allocVar() ;
-                        reduce(x, varAlloc, stepStart, pMod.getSubPath(), v) ;
-                        stepStart = v ;
-                    }
-                    reduce(x, varAlloc, stepStart, pMod.getSubPath(), endNode) ;
-                    return ;
-                }
-            }
-
-            // This is the rewrite of 
-            //    "x {N,} y" to "x :p{N} ?V . ?V :p* y"
-            //    "x {N,M} y" to "x :p{N} ?V . ?V {0,M} y"
-            // The spec defines {n,m} to be 
-            //   {n} union {n+1} union ... union {m}
-            // which leads to a lot of repeated work.
-            
-            if ( pMod.getMin() > 0 )
-            {
-                Path p1 = PathFactory.pathFixedLength(pMod.getSubPath(), pMod.getMin()) ;
-                Path p2 ;
-                
-                if ( pMod.getMax() < 0 )
-                    p2 = PathFactory.pathZeroOrMoreN(pMod.getSubPath()) ;
-                else
-                {
-                    long len2 = pMod.getMax()-pMod.getMin() ;
-                    if ( len2 < 0 ) len2 = 0 ;
-                    p2 = PathFactory.pathMod(pMod.getSubPath(),0, len2) ;
-                }
-                
-                Node v = varAlloc.allocVar() ;
-                
-                // Start at the fixed end.
-                if ( ! startNode.isVariable() || endNode.isVariable() )
-                {
-                    reduce(x, varAlloc, startNode, p1, v) ;
-                    reduce(x, varAlloc, v, p2, endNode) ;
-                }
-                else
-                {
-                    // endNode fixed, start node not.
-                    reduce(x, varAlloc, v, p2, endNode) ;
-                    reduce(x, varAlloc, startNode, p1, v) ;
-                }
-                return ;
-            }
-            
-            
-            // Else drop through
-        }
-        
-        // Nothing can be done.
-        x.add(new TriplePath(startNode, path, endNode)) ;
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/PathFactory.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/PathFactory.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/PathFactory.java
deleted file mode 100644
index d904f2d..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/PathFactory.java
+++ /dev/null
@@ -1,45 +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 com.hp.hpl.jena.sparql.path;
-
-import com.hp.hpl.jena.graph.Node ;
-
-public class PathFactory
-{
-    public static final long UNSET = P_Mod.UNSET ;
-    
-    public static Path pathLink(Node property)          { return new P_Link(property) ; }
-
-    public static Path pathInverse(Path path)           { return new P_Inverse(path) ; }
-    public static Path pathMod(Path path, long min, long max)   { return new P_Mod(path, min, max) ; }
-    public static Path pathFixedLength(Path path, long count)   { return new P_FixedLength(path, count) ; }
-    public static Path pathDistinct(Path path)          { return new P_Distinct(path) ; }
-    public static Path pathMulti(Path path)             { return new P_Multi(path) ; }
-    public static Path pathShortest(Path path)          { return new P_Shortest(path) ; }
-
-    public static Path pathAlt(Path path1, Path path2)  { return new P_Alt(path1, path2) ; }
-    public static Path pathSeq(Path path1, Path path2)  { return new P_Seq(path1, path2) ; }
-    
-    public static Path pathZeroOrOne(Path path)         { return new P_ZeroOrOne(path) ; }
-
-    public static Path pathZeroOrMore1(Path path)       { return new P_ZeroOrMore1(path) ; }
-    public static Path pathOneOrMore1(Path path)        { return new P_OneOrMore1(path) ; }
-    public static Path pathZeroOrMoreN(Path path)       { return new P_ZeroOrMoreN(path) ; }
-    public static Path pathOneOrMoreN(Path path)        { return new P_OneOrMoreN(path) ; }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/PathLib.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/PathLib.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/PathLib.java
deleted file mode 100644
index 856b1e6..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/PathLib.java
+++ /dev/null
@@ -1,257 +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 com.hp.hpl.jena.sparql.path;
-
-import java.util.ArrayList ;
-import java.util.Iterator ;
-import java.util.List ;
-
-import org.apache.jena.atlas.iterator.Filter ;
-import org.apache.jena.atlas.iterator.Iter ;
-import org.apache.jena.atlas.lib.Lib ;
-
-import com.hp.hpl.jena.graph.Graph ;
-import com.hp.hpl.jena.graph.Node ;
-import com.hp.hpl.jena.sparql.ARQInternalErrorException ;
-import com.hp.hpl.jena.sparql.algebra.Op ;
-import com.hp.hpl.jena.sparql.algebra.op.OpBGP ;
-import com.hp.hpl.jena.sparql.algebra.op.OpPath ;
-import com.hp.hpl.jena.sparql.algebra.op.OpSequence ;
-import com.hp.hpl.jena.sparql.core.BasicPattern ;
-import com.hp.hpl.jena.sparql.core.PathBlock ;
-import com.hp.hpl.jena.sparql.core.TriplePath ;
-import com.hp.hpl.jena.sparql.core.Var ;
-import com.hp.hpl.jena.sparql.engine.ExecutionContext ;
-import com.hp.hpl.jena.sparql.engine.QueryIterator ;
-import com.hp.hpl.jena.sparql.engine.binding.Binding ;
-import com.hp.hpl.jena.sparql.engine.binding.BindingFactory ;
-import com.hp.hpl.jena.sparql.engine.iterator.QueryIterConcat ;
-import com.hp.hpl.jena.sparql.engine.iterator.QueryIterPlainWrapper ;
-import com.hp.hpl.jena.sparql.engine.iterator.QueryIterYieldN ;
-import com.hp.hpl.jena.sparql.mgt.Explain ;
-import com.hp.hpl.jena.sparql.path.eval.PathEval ;
-import com.hp.hpl.jena.sparql.pfunction.PropertyFunction ;
-import com.hp.hpl.jena.sparql.pfunction.PropertyFunctionFactory ;
-import com.hp.hpl.jena.sparql.pfunction.PropertyFunctionRegistry ;
-import com.hp.hpl.jena.sparql.util.graph.GraphUtils ;
-
-public class PathLib
-{
-    /** Convert any paths of exactly one predicate to a triple pattern */ 
-    public static Op pathToTriples(PathBlock pattern)
-    {
-        BasicPattern bp = null ;
-        Op op = null ;
-
-        for ( TriplePath tp : pattern )
-        {
-            if ( tp.isTriple() )
-            {
-                if ( bp == null )
-                    bp = new BasicPattern() ;
-                bp.add(tp.asTriple()) ;
-                continue ;
-            }
-            // Path form.
-            op = flush(bp, op) ;
-            bp = null ;
-
-            OpPath opPath2 = new OpPath(tp) ;
-            op = OpSequence.create(op, opPath2) ;
-            continue ;
-        }
-
-        // End.  Finish off any outstanding BGP.
-        op = flush(bp, op) ;
-        return op ;
-    }
-    
-    static private Op flush(BasicPattern bp, Op op)
-    {
-        if ( bp == null || bp.isEmpty() )
-            return op ;
-        
-        OpBGP opBGP = new OpBGP(bp) ;
-        op = OpSequence.create(op, opBGP) ;
-        return op ;
-    }
-    
-    /** Install a path as a property function in the global property function registry */
-    public static void install(String uri, Path path)
-    { install(uri, path, PropertyFunctionRegistry.get()) ; }
-
-    /** Install a path as a property function in a given registry */
-    public static void install(String uri, final Path path, PropertyFunctionRegistry registry)
-    {
-        PropertyFunctionFactory pathPropFuncFactory = new PropertyFunctionFactory()
-        {
-            @Override
-            public PropertyFunction create(String uri)
-            {
-                return new PathPropertyFunction(path) ;
-            }
-        }; 
-        
-        registry.put(uri, pathPropFuncFactory) ;
-    }
-
-    public static QueryIterator execTriplePath(Binding binding, TriplePath triplePath, ExecutionContext execCxt)
-    {
-        if ( triplePath.isTriple() )
-        {
-            // Fake it.  This happens only for API constructed situations. 
-            Path path = new P_Link(triplePath.getPredicate()) ;
-            triplePath = new TriplePath(triplePath.getSubject(),
-                                        path,
-                                        triplePath.getObject()) ;
-        }
-        
-        return execTriplePath(binding, 
-                              triplePath.getSubject(),
-                              triplePath.getPath(),
-                              triplePath.getObject(),
-                              execCxt) ;
-    }
-    
-    public static QueryIterator execTriplePath(Binding binding, 
-                                               Node s, Path path, Node o,
-                                               ExecutionContext execCxt)
-    {
-        Explain.explain(s, path, o, execCxt.getContext()) ;
-        
-        s = Var.lookup(binding, s) ;
-        o = Var.lookup(binding, o) ;
-        Iterator<Node> iter = null ;
-        Node endNode = null ;
-        Graph graph = execCxt.getActiveGraph() ;
-        
-        if ( Var.isVar(s) && Var.isVar(o) )
-        {
-            if ( s.equals(o) )
-                return ungroundedPathSameVar(binding, graph, Var.alloc(s), path, execCxt) ;
-            else
-                return ungroundedPath(binding, graph, Var.alloc(s), path, Var.alloc(o), execCxt) ;
-        }
-
-        if ( ! Var.isVar(s) && ! Var.isVar(o) )
-            return groundedPath(binding, graph, s, path, o, execCxt) ;
-        
-        if ( Var.isVar(s) )
-        {
-            // Var subject, concrete object - do backwards.
-            iter = PathEval.evalReverse(graph, o, path, execCxt.getContext()) ;
-            endNode = s ;
-        } 
-        else
-        {
-            iter = PathEval.eval(graph, s, path, execCxt.getContext()) ;
-            endNode = o ;
-        }
-        return _execTriplePath(binding, iter, endNode, execCxt) ;
-    }
-    
-    private static QueryIterator _execTriplePath(Binding binding, 
-                                                 Iterator<Node> iter,
-                                                 Node endNode,
-                                                 ExecutionContext execCxt)
-    {
-        List<Binding> results = new ArrayList<>() ;
-        
-        if (! Var.isVar(endNode))
-            throw new ARQInternalErrorException("Non-variable endnode in _execTriplePath") ;
-        
-        Var var = Var.alloc(endNode) ;
-        // Assign.
-        for (; iter.hasNext();)
-        {
-            Node n = iter.next() ;
-            results.add(BindingFactory.binding(binding, var, n)) ;
-        }
-        return new QueryIterPlainWrapper(results.iterator(), execCxt) ;
-    }
-
-    // Subject and object are nodes.
-    private static QueryIterator groundedPath(Binding binding, Graph graph, Node subject, Path path, Node object,
-                                              ExecutionContext execCxt)
-    {
-        Iterator<Node> iter = PathEval.eval(graph, subject, path, execCxt.getContext()) ;
-        // Now count the number of matches.
-        
-        int count = 0 ;
-        for ( ; iter.hasNext() ; )
-        {
-            Node n = iter.next() ;
-            if ( n.sameValueAs(object) )
-                count++ ;
-        }
-        
-        return new QueryIterYieldN(count, binding, execCxt) ;
-    }
-
-    // Brute force evaluation of a TriplePath where neither subject nor object are bound 
-    private static QueryIterator ungroundedPath(Binding binding, Graph graph, Var sVar, Path path, Var oVar,
-                                                ExecutionContext execCxt)
-    {
-        Iterator<Node> iter = GraphUtils.allNodes(graph) ;
-        QueryIterConcat qIterCat = new QueryIterConcat(execCxt) ;
-        
-        for ( ; iter.hasNext() ; )
-        {
-            Node n = iter.next() ;
-            Binding b2 = BindingFactory.binding(binding, sVar, n) ;
-            Iterator<Node> pathIter = PathEval.eval(graph, n, path, execCxt.getContext()) ;
-            QueryIterator qIter = _execTriplePath(b2, pathIter, oVar, execCxt) ;
-            qIterCat.add(qIter) ;
-        }
-        return qIterCat ;
-    }
-    
-    private static QueryIterator ungroundedPathSameVar(Binding binding, Graph graph, Var var, Path path, ExecutionContext execCxt)
-    {
-        // Try each end, grounded  
-        // Slightly more efficient would be to add a per-engine to do this.
-        Iterator<Node> iter = GraphUtils.allNodes(graph) ;
-        QueryIterConcat qIterCat = new QueryIterConcat(execCxt) ;
-        
-        for ( ; iter.hasNext() ; )
-        {
-            Node n = iter.next() ;
-            Binding b2 = BindingFactory.binding(binding, var, n) ;
-            int x = existsPath(graph, n, path, n, execCxt) ;
-            if ( x > 0 )
-            {
-                QueryIterator qIter = new QueryIterYieldN(x, b2, execCxt) ;
-                qIterCat.add(qIter) ;
-            }
-        }
-        return qIterCat ; 
-    }
-    
-    private static int existsPath(Graph graph, Node subject, Path path, final Node object, ExecutionContext execCxt)
-    {
-        if ( ! subject.isConcrete() || !object.isConcrete() )
-            throw new ARQInternalErrorException("Non concrete node for existsPath evaluation") ;
-        Iterator<Node> iter = PathEval.eval(graph, subject, path, execCxt.getContext()) ;
-        Filter<Node> filter = new Filter<Node>() { @Override public boolean accept(Node node) { return Lib.equal(node,  object) ; } } ; 
-        // See if we got to the node we're interested in finishing at.
-        iter = Iter.filter(iter, filter) ;
-        long x = Iter.count(iter) ; 
-        return (int)x ;
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/PathParser.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/PathParser.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/PathParser.java
deleted file mode 100644
index 0472e9d..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/PathParser.java
+++ /dev/null
@@ -1,75 +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 com.hp.hpl.jena.sparql.path;
-
-import java.io.Reader ;
-import java.io.StringReader ;
-
-import com.hp.hpl.jena.query.Query ;
-import com.hp.hpl.jena.query.QueryException ;
-import com.hp.hpl.jena.query.QueryParseException ;
-import com.hp.hpl.jena.shared.JenaException ;
-import com.hp.hpl.jena.shared.PrefixMapping ;
-import com.hp.hpl.jena.sparql.core.Prologue ;
-import com.hp.hpl.jena.sparql.lang.arq.ARQParser ;
-
-import org.apache.jena.atlas.logging.Log ;
-
-public class PathParser
-{
-    public static Path parse(String str, PrefixMapping pmap)
-    { return parse(str, new Prologue(pmap)) ; }
-    
-    public static Path parse(String str, Prologue prologue)
-    {
-        Query query = new Query(prologue) ;
-        Reader in = new StringReader(str) ;
-        ARQParser parser = new ARQParser(in) ;
-
-        try {
-            query.setStrict(true) ;
-            parser.setQuery(query) ;
-            return parser.PathUnit() ;
-        } catch (com.hp.hpl.jena.sparql.lang.arq.ParseException ex)
-        {
-            throw new QueryParseException(ex.getMessage(),
-                                          ex.currentToken.beginLine,
-                                          ex.currentToken.beginColumn
-                                          ) ; }
-        catch (com.hp.hpl.jena.sparql.lang.arq.TokenMgrError tErr)
-        {
-            // Last valid token : not the same as token error message - but this should not happen
-            int col = parser.token.endColumn ;
-            int line = parser.token.endLine ;
-            throw new QueryParseException(tErr.getMessage(), line, col) ;
-        }
-        catch (QueryException ex) { throw ex ; }
-        catch (JenaException ex)  { throw new QueryException(ex.getMessage(), ex) ; }
-        catch (Error err)
-        {
-            // The token stream can throw errors.
-            throw new QueryParseException(err.getMessage(), err, -1, -1) ;
-        }
-        catch (Throwable th)
-        {
-            Log.warn(PathParser.class, "Unexpected throwable: ",th) ;
-            throw new QueryException(th.getMessage(), th) ;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/PathPropertyFunction.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/PathPropertyFunction.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/PathPropertyFunction.java
deleted file mode 100644
index 560fc84..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/PathPropertyFunction.java
+++ /dev/null
@@ -1,49 +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 com.hp.hpl.jena.sparql.path;
-
-import com.hp.hpl.jena.graph.Node ;
-import com.hp.hpl.jena.sparql.core.TriplePath ;
-import com.hp.hpl.jena.sparql.engine.ExecutionContext ;
-import com.hp.hpl.jena.sparql.engine.QueryIterator ;
-import com.hp.hpl.jena.sparql.engine.binding.Binding ;
-import com.hp.hpl.jena.sparql.engine.iterator.QueryIterPath ;
-import com.hp.hpl.jena.sparql.engine.iterator.QueryIterSingleton ;
-import com.hp.hpl.jena.sparql.pfunction.PFuncSimple ;
-
-public class PathPropertyFunction extends PFuncSimple
-{
-    private Path path ;
-    public PathPropertyFunction(Path path)
-    {
-        super() ;
-        this.path = path ;
-    }
-
-    @Override
-    public QueryIterator execEvaluated(Binding binding,
-                                       Node subject, Node predicate, Node object,
-                                       ExecutionContext execCxt)
-    {
-        return new QueryIterPath(new TriplePath(subject, path, object),
-                                 QueryIterSingleton.create(binding, execCxt),
-                                 execCxt) ;
-    }
- 
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/PathVisitor.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/PathVisitor.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/PathVisitor.java
deleted file mode 100644
index d2f4722..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/PathVisitor.java
+++ /dev/null
@@ -1,44 +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 com.hp.hpl.jena.sparql.path;
-
-public interface PathVisitor
-{
-    public void visit(P_Link pathNode) ;
-    public void visit(P_ReverseLink pathNode) ;
-    
-    public void visit(P_NegPropSet pathNotOneOf) ;
-
-    public void visit(P_Inverse inversePath) ;
-    public void visit(P_Mod pathMod) ;
-    public void visit(P_FixedLength pFixedLength) ;
-    public void visit(P_Distinct pathDistinct) ;
-    public void visit(P_Multi pathMulti) ;
-    public void visit(P_Shortest pathShortest) ;
-    public void visit(P_ZeroOrOne path) ;
-    
-    public void visit(P_ZeroOrMore1 path) ;
-    public void visit(P_ZeroOrMoreN path) ;
-    
-    public void visit(P_OneOrMore1 path) ;
-    public void visit(P_OneOrMoreN path) ;
-
-    public void visit(P_Alt pathAlt) ;
-    public void visit(P_Seq pathSeq) ;
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/PathVisitorBase.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/PathVisitorBase.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/PathVisitorBase.java
deleted file mode 100644
index a7de406..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/PathVisitorBase.java
+++ /dev/null
@@ -1,44 +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 com.hp.hpl.jena.sparql.path;
-
-public class PathVisitorBase implements PathVisitor
-{
-    @Override public void visit(P_Link pathNode)              {}
-    @Override public void visit(P_ReverseLink pathNode)       {}
-    
-    @Override public void visit(P_NegPropSet pathNotOneOf)    {}
-
-    @Override public void visit(P_Inverse inversePath)        {}
-    @Override public void visit(P_Mod pathMod)                {}
-    @Override public void visit(P_FixedLength pFixedLength)   {}
-    @Override public void visit(P_Distinct pathDistinct)      {}
-    @Override public void visit(P_Multi pathMulti)            {}
-    @Override public void visit(P_Shortest pathShortest)      {}
-    @Override public void visit(P_ZeroOrOne path)             {}
-    
-    @Override public void visit(P_ZeroOrMore1 path)           {}
-    @Override public void visit(P_ZeroOrMoreN path)           {}
-    
-    @Override public void visit(P_OneOrMore1 path)            {}
-    @Override public void visit(P_OneOrMoreN path)            {}
-
-    @Override public void visit(P_Alt pathAlt)                {}
-    @Override public void visit(P_Seq pathSeq)                {}
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/PathVisitorByType.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/PathVisitorByType.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/PathVisitorByType.java
deleted file mode 100644
index def1c1c..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/PathVisitorByType.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.
- */
-
-package com.hp.hpl.jena.sparql.path;
-
-
-public abstract class PathVisitorByType implements PathVisitor
-{
-    public abstract void visitNegPS(P_NegPropSet path) ;
-    public abstract void visit0(P_Path0 path) ;
-    public abstract void visit1(P_Path1 path) ;
-    public abstract void visit2(P_Path2 path) ;
-
-    @Override
-    public void visit(P_Link pathNode)              { visit0(pathNode) ; }
-
-    @Override
-    public void visit(P_ReverseLink pathNode)       { visit0(pathNode) ; }
-
-    @Override
-    public void visit(P_NegPropSet pathNotOneOf)    { visitNegPS(pathNotOneOf) ; }
-
-    @Override
-    public void visit(P_Inverse inversePath)        { visit1(inversePath) ; }
-
-    @Override
-    public void visit(P_Mod pathMod)                { visit1(pathMod) ; }
-    
-    @Override
-    public void visit(P_Distinct path)              { visit1(path) ; }
-    
-    @Override
-    public void visit(P_Multi pathMod)              { visit1(pathMod) ; }
-    
-    @Override
-    public void visit(P_Shortest pathMod)           { visit1(pathMod) ; }
-    
-    @Override
-    public void visit(P_FixedLength pFixedLength)   { visit1(pFixedLength) ; }
-
-    @Override
-    public void visit(P_ZeroOrOne path)             { visit1(path) ; }
-
-    @Override
-    public void visit(P_ZeroOrMore1 path)           { visit1(path) ; }
-
-    @Override
-    public void visit(P_ZeroOrMoreN path)           { visit1(path) ; }
-
-    @Override
-    public void visit(P_OneOrMore1 path)            { visit1(path) ; }
-
-    @Override
-    public void visit(P_OneOrMoreN path)            { visit1(path) ; }
-
-    @Override
-    public void visit(P_Alt pathAlt)                { visit2(pathAlt) ; }
-
-    @Override
-    public void visit(P_Seq pathSeq)                { visit2(pathSeq) ; }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/PathWriter.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/PathWriter.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/PathWriter.java
deleted file mode 100644
index 1ce82e3..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/PathWriter.java
+++ /dev/null
@@ -1,311 +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 com.hp.hpl.jena.sparql.path;
-
-import static com.hp.hpl.jena.sparql.path.P_Mod.UNSET ;
-
-import java.util.List ;
-
-import org.apache.jena.atlas.io.IndentedLineBuffer ;
-import org.apache.jena.atlas.io.IndentedWriter ;
-
-import com.hp.hpl.jena.graph.Node ;
-import com.hp.hpl.jena.sparql.ARQException ;
-import com.hp.hpl.jena.sparql.core.Prologue ;
-import com.hp.hpl.jena.sparql.util.FmtUtils ;
-
-public class PathWriter
-{
-
-    public static void write(Path path, Prologue prologue)
-    {
-        write(IndentedWriter.stdout, path, prologue) ;
-    }
-    
-    public static void write(IndentedWriter out, Path path, Prologue prologue)
-    {
-        PathWriterWorker w = new PathWriterWorker(out, prologue) ;
-        path.visit(w) ;
-        out.flush();
-    }
-    
-    public static String asString(Path path) { return asString(path, null) ; }
-    
-    public static String asString(Path path, Prologue prologue)
-    {
-        IndentedLineBuffer buff = new IndentedLineBuffer() ;
-        PathWriterWorker w = new PathWriterWorker(buff, prologue) ;
-        path.visit(w) ;
-        w.out.flush();
-        return buff.asString() ;
-    }
-
-    static class PathWriterWorker implements PathVisitor
-    {
-        private IndentedWriter out ;
-        private Prologue prologue ;
-        private static boolean alwaysInnerParens = true ;
-        private boolean needParens = false ;
-
-        PathWriterWorker(IndentedWriter indentedWriter, Prologue prologue)
-        { 
-            this.out = indentedWriter ; 
-            this.prologue = prologue ;
-        }
-
-        private void visitPath(Path path)
-        { visitPath(path, true) ; }
-        
-        private void visitPath(Path path, boolean needParensThisTime)
-        {
-            if ( alwaysInnerParens )
-                needParensThisTime = true ;
-            boolean b = needParens ;
-            needParens = needParensThisTime ;
-            path.visit(this) ;
-            needParens = b ;
-        }
-        
-        private void output(Node node)
-        {
-            out.print(FmtUtils.stringForNode(node, prologue)) ;
-        }
-        
-        private void output(P_Path0 path0)
-        {
-            if ( ! path0.isForward() )
-                out.print("^") ;
-            out.print(FmtUtils.stringForNode(path0.getNode(), prologue)) ;
-        }
-        
-        @Override
-        public void visit(P_Link pathNode)
-        {
-            output(pathNode.getNode()) ;
-        }
-        
-        @Override
-        public void visit(P_ReverseLink pathNode)
-        {
-            out.println("^") ;
-            output(pathNode.getNode()) ;
-        }
-
-        @Override
-        public void visit(P_NegPropSet pathNotOneOf)
-        {
-            List<P_Path0> props = pathNotOneOf.getNodes() ;
-            if ( props.size() == 0 )
-                throw new ARQException("Bad path element: NotOneOf found with no elements") ;
-            out.print("!") ;
-            if ( props.size() == 1 )
-                output(props.get(0)) ;
-            else
-            {
-                out.print("(") ;
-                boolean first = true ;
-                for (P_Path0 p : props)
-                {
-                    if (!first) out.print("|") ;
-                    first = false ;
-                    output(p) ;
-                }
-                out.print(")") ;
-            }
-
-//            List<P_Path0> props = pathNotOneOf.getNodes()  ;
-//            if ( props.size() == 0 )
-//                throw new ARQException("Bad path element: NotOneOf found with no elements") ;
-//            out.print("!") ;
-//            if ( props.size() == 1 )
-//                output(props.get(0)) ;
-//            else
-//            {
-//                out.print("(") ;
-//                boolean first = true ;
-//                for (P_Path0 p : props)
-//                {
-//                    if (!first) out.print("|") ;
-//                    first = false ;
-//                    output(p) ;
-//                }
-//                out.print(")") ;
-//            }
-        }
-
-        
-        
-        @Override
-        public void visit(P_Alt pathAlt)
-        {
-            visit2(pathAlt, "|", true) ;
-        }
-
-        @Override
-        public void visit(P_Seq pathSeq)
-        {
-            visit2(pathSeq, "/", false) ;
-        }
-
-        // Should pass around precedence numbers.
-        private void visit2(P_Path2 path2, String sep, boolean isSeq)
-        {
-            if ( needParens ) out.print("(") ;
-            visitPath(path2.getLeft()) ;
-            out.print(sep) ;
-            // Don't need parens if same as before.
-            if ( isSeq )
-            {
-                // Make / and ^ chains look nice
-                if ( path2.getRight() instanceof P_Seq )
-                    visitPath(path2.getRight(), needParens) ;
-                else
-                    visitPath(path2.getRight(), true) ;
-            }
-            else
-                visitPath(path2.getRight(), true) ;
-            
-            if ( needParens ) out.print(")") ;
-        }
-
-        @Override
-        public void visit(P_Mod pathMod)
-        {
-            if ( needParens )
-                out.print("(") ;
-            if ( alwaysInnerParens )
-                out.print("(") ;
-            pathMod.getSubPath().visit(this) ;
-            if ( alwaysInnerParens )
-                out.print(")") ;
-
-            out.print("{") ;
-            if ( pathMod.getMin() != UNSET )
-                out.print(Long.toString(pathMod.getMin())) ;
-            out.print(",") ;
-            if ( pathMod.getMax() != UNSET )
-                out.print(Long.toString(pathMod.getMax())) ;
-            out.print("}") ;
-            
-//            if ( pathMod.isZeroOrMore() )
-//                out.print("*") ;
-//            else if ( pathMod.isOneOrMore() )
-//                out.print("+") ;
-//            else if ( pathMod.isZeroOrOne() )
-//                out.print("?") ;
-//            else
-//            {
-//                out.print("{") ;
-//                if ( pathMod.getMin() != UNSET )
-//                    out.print(Long.toString(pathMod.getMin())) ;
-//                out.print(",") ;
-//                if ( pathMod.getMax() != UNSET )
-//                    out.print(Long.toString(pathMod.getMax())) ;
-//                out.print("}") ;
-//            }
-            if ( needParens )
-                out.print(")") ;
-        }
-
-        @Override
-        public void visit(P_FixedLength pFixedLength)
-        {
-            if ( needParens )
-                out.print("(") ;
-            if ( alwaysInnerParens )
-                out.print("(") ;
-            pFixedLength.getSubPath().visit(this) ;
-            if ( alwaysInnerParens )
-                out.print(")") ;
-
-            out.print("{") ;
-            out.print(Long.toString(pFixedLength.getCount())) ;
-            out.print("}") ;
-            if ( needParens )
-                out.print(")") ;
-        }
-
-        @Override
-        public void visit(P_Distinct pathDistinct)
-        {
-            out.print("DISTINCT(") ;
-            pathDistinct.getSubPath().visit(this) ;
-            out.print(")") ;
-        }
-
-        @Override
-        public void visit(P_Multi pathMulti)
-        {
-            out.print("MULTI(") ;
-            pathMulti.getSubPath().visit(this) ;
-            out.print(")") ;
-        }
-
-        @Override
-        public void visit(P_Shortest path)
-        {
-            out.print("SHORTEST(") ;
-            path.getSubPath().visit(this) ;
-            out.print(")") ;
-        }
-
-        @Override
-        public void visit(P_ZeroOrOne path)
-        { printPathMod("?", path.getSubPath()) ; }
-
-        @Override
-        public void visit(P_ZeroOrMore1 path)
-        { printPathMod("*", path.getSubPath()) ; }
-
-        @Override
-        public void visit(P_ZeroOrMoreN path)
-        { printPathMod("{*}", path.getSubPath()) ; }
-
-        @Override
-        public void visit(P_OneOrMore1 path)
-        { printPathMod("+", path.getSubPath()) ; }
-
-        @Override
-        public void visit(P_OneOrMoreN path)
-        { printPathMod("{+}", path.getSubPath()) ; }
-
-        private void printPathMod(String mod, Path path)
-        {
-            boolean doParens = ( needParens || alwaysInnerParens ) ;
-            if ( doParens )
-                out.print("(") ;
-            path.visit(this) ;
-            if ( doParens )
-                out.print(")") ;
-            out.print(mod) ;
-        }
-        
-        // Need to consider binary ^
-        @Override
-        public void visit(P_Inverse inversePath)
-        {
-            out.print("^") ;
-            Path p = inversePath.getSubPath() ;
-            boolean parens = true ; 
-            if ( p instanceof P_Link )
-                parens = false ;
-            visitPath(p, parens) ;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/eval/PathEngine.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/eval/PathEngine.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/eval/PathEngine.java
deleted file mode 100644
index 5319e5c..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/eval/PathEngine.java
+++ /dev/null
@@ -1,266 +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 com.hp.hpl.jena.sparql.path.eval ;
-
-import java.util.ArrayList ;
-import java.util.Collection ;
-import java.util.Iterator ;
-import java.util.List ;
-
-import org.apache.jena.atlas.iterator.Iter ;
-import org.apache.jena.atlas.iterator.Transform ;
-
-import com.hp.hpl.jena.graph.Graph ;
-import com.hp.hpl.jena.graph.Node ;
-import com.hp.hpl.jena.graph.Triple ;
-import com.hp.hpl.jena.query.ARQ ;
-import com.hp.hpl.jena.sparql.core.Var ;
-import com.hp.hpl.jena.sparql.engine.ExecutionContext ;
-import com.hp.hpl.jena.sparql.engine.QueryIterator ;
-import com.hp.hpl.jena.sparql.engine.binding.Binding ;
-import com.hp.hpl.jena.sparql.engine.binding.BindingFactory ;
-import com.hp.hpl.jena.sparql.engine.iterator.QueryIterRoot ;
-import com.hp.hpl.jena.sparql.path.P_NegPropSet ;
-import com.hp.hpl.jena.sparql.path.Path ;
-import com.hp.hpl.jena.sparql.path.eval.PathEvaluator.FilterExclude ;
-import com.hp.hpl.jena.sparql.pfunction.* ;
-import com.hp.hpl.jena.sparql.util.Context ;
-import com.hp.hpl.jena.sparql.util.graph.GraphContainerUtils ;
-import com.hp.hpl.jena.sparql.util.graph.GraphList ;
-import com.hp.hpl.jena.sparql.vocabulary.ListPFunction ;
-import com.hp.hpl.jena.vocabulary.RDFS ;
-
-abstract public class PathEngine
-{
-    private final boolean doingRDFSmember ;
-    private final boolean doingListMember ;
-    private final Graph   graph ;
-    private final Context context ;
-    private final PropertyFunctionRegistry registry ; 
-
-    protected PathEngine(Graph graph, Context context) {
-        boolean doingRDFSmember$ = false ;
-        boolean doingListMember$ = false ;
-        PropertyFunctionRegistry registry$ = null ;
-
-        if ( context == null || context.isTrueOrUndef(ARQ.propertyFunctions) ) {
-            registry$ = PropertyFunctionRegistry.chooseRegistry(context) ;
-            if ( registry$ != null ) {
-                doingRDFSmember$ = ( registry$.get(RDFSmember.getURI()) != null ) ;
-                doingRDFSmember$ = ( registry$.get(ListMember.getURI()) != null ) ;
-            }
-        }
-        
-        this.registry = registry$ ;
-        this.doingRDFSmember = doingRDFSmember$ ;
-        this.doingListMember = doingListMember$ ;
-        this.graph = graph ;
-        this.context = context ;
-    }
-    
-    protected final Iter<Node> eval(Path path, Node node) {
-        return PathEval.eval$(graph, node, path, this) ;
-    }
-
-    protected final void eval(Path path, Node node, Collection<Node> output) {
-        PathEval.eval$(graph, node, path, this, output) ;
-    }
-
-    // protected final void eval(Path path, Node node, Collection<Node> output)
-
-    protected abstract void flipDirection() ;
-
-    protected abstract boolean direction() ;
-
-    protected abstract Collection<Node> collector() ;
-
-    // protected abstract void doZero(Path pathStep, Node node, Collection<Node>
-    // output) ;
-    // protected abstract void doOne(Path pathStep, Node node, Collection<Node>
-    // output) ;
-
-    // --- Where we touch the graph
-    // Because for SP? or ?PO, no duplicates occur, so works for both strategies.
-    protected final Iterator<Node> doOne(Node node, Node property) {
-        Iterator<Node> iter2 = null ;
-        if ( direction() ) {
-            Iter<Triple> iter1 = Iter.iter(graphFind(node, property, Node.ANY)) ;
-            iter2 = iter1.map(PathEngine.selectObject) ;
-        } else {
-            Iter<Triple> iter1 = Iter.iter(graphFind(Node.ANY, property, node)) ;
-            iter2 = iter1.map(PathEngine.selectSubject) ;
-        }
-
-        return iter2 ;
-    }
-
-    protected abstract void doSeq(Path pathStepLeft, Path pathStepRight, Node node, Collection<Node> output) ;
-
-    protected abstract void doAlt(Path pathStepLeft, Path pathStepRight, Node node, Collection<Node> output) ;
-
-    // path*
-    protected abstract void doZeroOrMore(Path pathStep, Node node, Collection<Node> output) ;
-
-    // path+
-    protected abstract void doOneOrMore(Path pathStep, Node node, Collection<Node> output) ;
-
-    // path?
-    protected abstract void doZeroOrOne(Path pathStep, Node node, Collection<Node> output) ;
-
-    protected abstract void doNegatedPropertySet(P_NegPropSet pathNotOneOf, Node node, Collection<Node> output) ;
-
-    // path{*} : default implementation
-    protected void doZeroOrMoreN(Path pathStep, Node node, Collection<Node> output) {
-        doZeroOrMore(pathStep, node, output) ;
-    }
-
-    // path{+} : default implementation
-    protected void doOneOrMoreN(Path pathStep, Node node, Collection<Node> output) {
-        doOneOrMore(pathStep, node, output) ;
-    }
-
-    protected abstract void doZero(Path path, Node node, Collection<Node> output) ;
-
-    // {N,M} and variations
-
-    protected abstract void doFixedLengthPath(Path pathStep, Node node, long fixedLength, Collection<Node> output) ;
-
-    protected abstract void doMultiLengthPath(Path pathStep, Node node, long min, long max, Collection<Node> output) ;
-
-    protected final void fill(Iterator<Node> iter, Collection<Node> output) {
-        for (; iter.hasNext();)
-            output.add(iter.next()) ;
-    }
-
-    protected static long dec(long x) {
-        return (x <= 0) ? x : x - 1 ;
-    }
-
-    protected static Transform<Triple, Node> selectSubject = new Transform<Triple, Node>() {
-        @Override
-        public Node convert(Triple triple) { return triple.getSubject() ; }
-    } ;
-    
-    protected static Transform<Triple, Node> selectPredicate = new Transform<Triple, Node>() {
-        @Override
-        public Node convert(Triple triple) { return triple.getPredicate() ; }
-    } ;
-    
-    protected static Transform<Triple, Node> selectObject = new Transform<Triple, Node>() {
-        @Override
-        public Node convert(Triple triple) { return triple.getObject() ; }
-    } ;
-
-    protected Iterator<Node> stepExcludeForwards(Node node, List<Node> excludedNodes) {
-        Iter<Triple> iter1 = forwardLinks(node, excludedNodes) ;
-        Iter<Node> r1 = iter1.map(selectObject) ;
-        return r1 ;
-    }
-
-    protected Iterator<Node> stepExcludeBackwards(Node node, List<Node> excludedNodes) {
-        Iter<Triple> iter1 = backwardLinks(node, excludedNodes) ;
-        Iter<Node> r1 = iter1.map(selectSubject) ;
-        return r1 ;
-    }
-
-    protected Iter<Triple> forwardLinks(Node x, Collection<Node> excludeProperties) {
-        Iter<Triple> iter1 = Iter.iter(graphFind(x, Node.ANY, Node.ANY)) ;
-        if ( excludeProperties != null )
-            iter1 = iter1.filter(new FilterExclude(excludeProperties)) ;
-        return iter1 ;
-    }
-
-    protected Iter<Triple> backwardLinks(Node x, Collection<Node> excludeProperties) {
-        Iter<Triple> iter1 = Iter.iter(graphFind(Node.ANY, Node.ANY, x)) ;
-        if ( excludeProperties != null )
-            iter1 = iter1.filter(new FilterExclude(excludeProperties)) ;
-        return iter1 ;
-    }
-
-    protected Iterator<Triple> graphFind(Node s, Node p, Node o) {
-        return graphFind(graph, s, p, o, context) ;
-    }
-
-    private static Binding binding = BindingFactory.binding() ;
-    private static Node RDFSmember = RDFS.Nodes.member ;
-    private static Node ListMember = ListPFunction.nListMember ;
-    
-    private /*static*/ Iterator<Triple> graphFind(Graph graph, Node s, Node p, Node o, Context context) {
-        // This is the only place this is called.
-        // It means we can add property functions here.
-
-        // Fast-path common cases.
-        if ( doingRDFSmember && RDFSmember.equals(p) )
-            return GraphContainerUtils.rdfsMember(graph, s, o) ;
-        if ( doingListMember && ListMember.equals(p) )
-            return GraphList.listMember(graph, s, o) ;
-        // Potentially just allow the cases above.
-        //return graph.find(s, p, o) ;
-        return graphFind2(graph, s, p, o, context) ;
-    }
-
-    /* As general as possible property function inclusion */ 
-    private Iterator<Triple> graphFind2(Graph graph, Node s, Node p, Node o, Context context) {
-        // Not all property functions make sense in property path
-        // For example, ones taking list arguments only make sense at
-        // the start or finish, and then only in simple paths
-        // (e.g. ?x .../propertyFunction ?z) 
-        // which would have been packaged by the optimizer.
-        if ( p != null && p.isURI() && registry != null ) {
-            PropertyFunctionFactory f = registry.get(p.getURI()) ;
-            if ( f != null )
-                return graphFindWorker(graph, s, f, p, o, context) ;
-        }
-
-        return graph.find(s, p, o) ;
-    }
-
-    private Iterator<Triple> graphFindWorker(Graph graph, Node s, PropertyFunctionFactory f, Node p, Node o, Context context) {
-        // Expensive?
-        PropertyFunction pf = f.create(p.getURI()) ;
-        PropFuncArg sv = arg(s, "S") ;
-        PropFuncArg ov = arg(o, "O") ;
-        QueryIterator r = QueryIterRoot.create(new ExecutionContext(context, graph, null, null)) ;
-        QueryIterator qIter = pf.exec(r, sv, p, ov, new ExecutionContext(ARQ.getContext(), graph, null, null)) ;
-        if ( ! qIter.hasNext() )
-            return Iter.nullIterator() ;
-        List<Triple> array = new ArrayList<>() ;
-        for ( ; qIter.hasNext() ; ) {
-            Binding b = qIter.next() ;
-            Node st = value(sv, b) ;
-            Node ot = value(ov, b) ;
-            array.add(Triple.create(st, p, ot)) ;
-        }
-        // Materialise so the inner QueryIterators are used up. 
-        return array.iterator() ; 
-    }
-
-    private static PropFuncArg arg(Node x, String name) {
-        if ( x == null || Node.ANY.equals(x) ) 
-        { return new PropFuncArg(Var.alloc(name)) ; }
-        return new PropFuncArg(x) ;
-    }
-
-    private static Node value(PropFuncArg arg, Binding b) {
-        Node x = arg.getArg() ;
-        if ( !Var.isVar(x) )
-            return x ;
-        return b.get(Var.alloc(x)) ;
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/eval/PathEngine1.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/eval/PathEngine1.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/eval/PathEngine1.java
deleted file mode 100644
index 03c97f6..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/eval/PathEngine1.java
+++ /dev/null
@@ -1,246 +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 com.hp.hpl.jena.sparql.path.eval ;
-
-import java.util.* ;
-
-import org.apache.jena.atlas.iterator.Iter ;
-
-import com.hp.hpl.jena.graph.Graph ;
-import com.hp.hpl.jena.graph.Node ;
-import com.hp.hpl.jena.sparql.path.P_Mod ;
-import com.hp.hpl.jena.sparql.path.P_NegPropSet ;
-import com.hp.hpl.jena.sparql.path.Path ;
-
-/** Path evaluation visitor that provide distinct nodes visited only.
- * This is NOT SPARQL semantics.
- * This class exists for experimentation.
- * It is written to get the right results - not necessarily with maximum efficiency.
- */
-
-final class PathEngine1 extends PathEngine
-{
-    private boolean forwardMode ;
-
-    public PathEngine1(Graph graph, boolean forward) {
-        super(graph, null) ;
-        this.forwardMode = forward ;
-    }
-
-    // Choose the underlying impl - different choice for debugging.
-    @Override
-    protected Collection<Node> collector() {
-        return new ArrayList<>() ;
-        // { return new HashSet<Node>() ; }
-    }
-
-
-    @Override
-    protected void flipDirection() {
-        forwardMode = !forwardMode ;
-    }
-
-    @Override
-    protected boolean direction() {
-        return forwardMode ;
-    }
-
-    @Override
-    protected void doAlt(Path pathStepLeft, Path pathStepRight, Node node, Collection<Node> output) {
-        // Must be duplicate supressing.
-        Collection<Node> nodes = new HashSet<>() ;
-        // Insert directly.
-        eval(pathStepLeft, node, nodes) ;
-        // Need to reduce/check other side.
-        eval(pathStepRight, node, nodes) ;
-        output.addAll(nodes) ;
-    }
-
-    @Override
-    protected void doSeq(Path pathStepLeft, Path pathStepRight, Node node, Collection<Node> output) {
-        Path part1 = forwardMode ? pathStepLeft : pathStepRight ;
-        Path part2 = forwardMode ? pathStepRight : pathStepLeft ;
-
-        Collection<Node> nodes = collector() ;
-        eval(part1, node, nodes) ;
-        Collection<Node> nodes2 = new HashSet<>() ;
-        for (Node n : nodes)
-            eval(part2, n, nodes2) ;
-        output.addAll(nodes2) ;
-    }
-
-    // Can use .addAll if collector is set-like.
-    private static void fillUnique(Iterator<Node> nodes, Collection<Node> acc) {
-        for (; nodes.hasNext();) {
-            Node n = nodes.next() ;
-            if ( !acc.contains(n) )
-                acc.add(n) ;
-        }
-    }
-
-    @Override
-    protected void doMultiLengthPath(Path pathStep, Node node, long min1, long max1, Collection<Node> output) {
-        // This algrothim can be used for counting {n,m}
-        // abstract ALP(=>rename?) , doFixedLength
-
-        if ( min1 == P_Mod.UNSET )
-            // {,N}
-            min1 = 0 ;
-
-        // do 0-min1 steps, not collecting.
-        Collection<Node> collectStartPoints = collector() ;
-
-        if ( min1 > 0 )
-            doFixedLengthPath(pathStep, node, min1, collectStartPoints) ;
-        else
-            collectStartPoints.add(node) ;
-
-        // System.out.println("Start points: "+collectStartPoints) ;
-
-        // {N,M} = {N} then {0,M-N}
-        int length = (int)(max1 - min1) ;
-
-        Collection<Node> visited = collector() ;
-
-        for (Node n : collectStartPoints)
-            doMultiLengthPath(pathStep, n, length, visited, output) ;
-    }
-
-    // {0,length}
-    protected void doMultiLengthPath(Path pathStep, Node node, long length, Collection<Node> visited, Collection<Node> output) {
-        if ( visited.contains(node) )
-            return ;
-        visited.add(node) ;
-        output.add(node) ;
-
-        if ( length == 0 )
-            return ;
-
-        // One step.
-        Iterator<Node> iter = eval(pathStep, node) ;
-        for (; iter.hasNext();) {
-            Node m = iter.next() ;
-            if ( visited.contains(m) )
-                continue ;
-            doMultiLengthPath(pathStep, m, length - 1, visited, output) ;
-        }
-    }
-
-//    // Do {0,length}
-//    private void doFixedLengthPath(Path path, Node node, int length, Collection<Node> visited) {
-//        System.out.printf("doModPath (%d) %s\n", length, node) ;
-//        ALP1(forwardMode, 0, length, node, path, visited) ;
-//    }
-
-    @Override
-    protected void doFixedLengthPath(Path pathStep, Node node, long fixedLength, Collection<Node> output) {
-        // Special for small?
-        // if ( fixedLength < 3 )
-        // {}
-        Collection<Node> visited = collector() ;
-
-        if ( fixedLength == 0 ) {
-            doZero(pathStep, node, output) ;
-            return ;
-        }
-        if ( fixedLength == 1 ) {
-            Iter<Node> iter = eval(pathStep, node) ;
-            for (Node n : iter) {
-                if ( !output.contains(n) )
-                    output.add(n) ;
-            }
-            return ;
-        }
-        // Loop, not recurse.
-        Iter<Node> iter = eval(pathStep, node) ;
-        for (Node n : iter)
-            doFixedLengthPath(pathStep, n, fixedLength - 1, output) ;
-        return ;
-    }
-
-    @Override
-    protected void doZeroOrMore(Path path, Node node, Collection<Node> output) {
-        // Reuse "output"
-        Collection<Node> visited = new LinkedList<>() ; // new
-                                                            // HashSet<Node>() ;
-        ALP1(forwardMode, 0, -1, node, path, visited) ;
-        output.addAll(visited) ;
-    }
-
-    @Override
-    protected void doOneOrMore(Path path, Node node, Collection<Node> output) {
-        // Reuse "output"
-        Collection<Node> visited = new LinkedList<>() ; // new
-                                                            // HashSet<Node>() ;
-        // Do one step without including.
-        Iter<Node> iter1 = eval(path, node) ;
-        for (; iter1.hasNext();) {
-            Node n1 = iter1.next() ;
-            ALP1(forwardMode, 0, -1, n1, path, visited) ;
-        }
-        output.addAll(visited) ;
-    }
-
-    private void ALP1(boolean forwardMode, int stepCount, int maxStepCount, Node node, Path path, Collection<Node> visited) {
-        if ( false )
-            System.out.printf("ALP1 node=%s\n   visited=%s\n   output=%s\n", node, visited) ;
-        if ( maxStepCount >= 0 && stepCount > maxStepCount )
-            return ;
-        if ( visited.contains(node) )
-            return ;
-
-        if ( !visited.add(node) )
-            return ;
-
-        Iter<Node> iter1 = eval(path, node) ;
-        // For each step, add to results and recurse.
-        for (; iter1.hasNext();) {
-            Node n1 = iter1.next() ;
-            ALP1(forwardMode, stepCount + 1, maxStepCount, n1, path, visited) ;
-        }
-        // Different from ALP-counting.
-        // visited.remove(node) ;
-    }
-
-    @Override
-    protected void doNegatedPropertySet(P_NegPropSet pathNotOneOf, Node node, Collection<Node> output) {
-        // X !(:a|:b|^:c|^:d) Y = { X !(:a|:b) Y } UNION { Y !(:c|:d) X }
-        if ( pathNotOneOf.getFwdNodes().size() > 0 ) {
-            Iterator<Node> nodes1 = stepExcludeForwards(node, pathNotOneOf.getFwdNodes()) ;
-            fillUnique(nodes1, output) ;
-        }
-        if ( pathNotOneOf.getBwdNodes().size() > 0 ) {
-            Iterator<Node> nodes2 = stepExcludeBackwards(node, pathNotOneOf.getBwdNodes()) ;
-            fillUnique(nodes2, output) ;
-        }
-    }
-
-    @Override
-    protected void doZeroOrOne(Path pathStep, Node node, Collection<Node> output) {
-        eval(pathStep, node, output) ;
-        if ( !output.contains(node) )
-            output.add(node) ;
-    }
-
-    @Override
-    protected void doZero(Path path, Node node, Collection<Node> output) {
-        if ( !output.contains(node) )
-            output.add(node) ;
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/eval/PathEngineN.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/eval/PathEngineN.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/eval/PathEngineN.java
deleted file mode 100644
index f1991c5..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/path/eval/PathEngineN.java
+++ /dev/null
@@ -1,227 +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 com.hp.hpl.jena.sparql.path.eval ;
-
-import java.util.* ;
-
-import org.apache.jena.atlas.iterator.Iter ;
-
-import com.hp.hpl.jena.graph.Graph ;
-import com.hp.hpl.jena.graph.Node ;
-import com.hp.hpl.jena.sparql.path.P_FixedLength ;
-import com.hp.hpl.jena.sparql.path.P_Mod ;
-import com.hp.hpl.jena.sparql.path.P_NegPropSet ;
-import com.hp.hpl.jena.sparql.path.Path ;
-
-/** Path evaluator that produces duplicates.
- * This is NOT SPARQL semantics.
- * This class exists for experimentation.
- * It is written to get the right results - not necessarily with maximum efficiency.
- */
-
-final class PathEngineN extends PathEngine
-{
-    private boolean forwardMode ;
-
-    public PathEngineN(Graph graph, boolean forward) {
-        super(graph, null) ;
-        this.forwardMode = forward ;
-    }
-
-    @Override
-    protected Collection<Node> collector() {
-        return new ArrayList<>() ;
-    }
-
-    @Override
-    protected void flipDirection() {
-        forwardMode = !forwardMode ;
-    }
-
-    @Override
-    protected boolean direction() {
-        return forwardMode ;
-    }
-
-    @Override
-    protected void doNegatedPropertySet(P_NegPropSet pathNotOneOf, Node node, Collection<Node> output) {
-        // X !(:a|:b|^:c|^:d) Y = { X !(:a|:b) Y } UNION { Y !(:c|:d) X }
-        if ( pathNotOneOf.getFwdNodes().size() > 0 ) {
-            Iterator<Node> nodes1 = stepExcludeForwards(node, pathNotOneOf.getFwdNodes()) ;
-            fill(nodes1, output) ;
-        }
-        if ( pathNotOneOf.getBwdNodes().size() > 0 ) {
-            Iterator<Node> nodes2 = stepExcludeBackwards(node, pathNotOneOf.getBwdNodes()) ;
-            fill(nodes2, output) ;
-        }
-    }
-
-    @Override
-    protected void doAlt(Path pathStepLeft, Path pathStepRight, Node node, Collection<Node> output) {
-        // Try both sizes, accumulate into output.
-        Iterator<Node> iter = eval(pathStepLeft, node) ;
-        fill(iter, output) ;
-        iter = eval(pathStepRight, node) ;
-        fill(iter, output) ;
-    }
-
-    @Override
-    protected void doSeq(Path pathStepLeft, Path pathStepRight, Node node, Collection<Node> output) {
-        Path part1 = forwardMode ? pathStepLeft : pathStepRight ;
-        Path part2 = forwardMode ? pathStepRight : pathStepLeft ;
-
-        // Feed one side into the other
-        Iter<Node> iter = eval(part1, node) ;
-        for (Node n : iter)
-            eval(part2, n, output) ;
-    }
-
-    @Override
-    protected void doMultiLengthPath(Path pathStep, Node node, long min1, long max1, Collection<Node> output) {
-        // Why not always reduce {N,M} to {N} and {0,M-N}
-        // Why not iterate, not recurse, for {N,}
-        // -- optimizer wil have expanded this so only in unoptimized mode.
-
-        if ( min1 == P_Mod.UNSET )
-            // {,N}
-            min1 = 0 ;
-
-        // ----------------
-        // This code is for p{n,m} and :p{,n} inc :p{0,n}
-        // and for :p{N,}
-
-        // if ( max1 == P_Mod.UNSET ) max1 = 0 ;
-
-        if ( min1 == 0 )
-            output.add(node) ;
-
-        if ( max1 == 0 )
-            return ;
-
-        // The next step
-        long min2 = dec(min1) ;
-        long max2 = dec(max1) ;
-
-        // TODO Rewrite
-        Path p1 = pathStep ;
-        Path p2 = new P_Mod(pathStep, min2, max2) ;
-
-        if ( !forwardMode ) {
-            // Reverse order. Do the second bit first.
-            Path tmp = p1 ;
-            p1 = p2 ;
-            p2 = tmp ;
-            // This forces execution to be in the order that it's written, when
-            // working backwards.
-            // {N,*} is {*} then {N} backwards != do {N} then do {*} as
-            // cardinality of the
-            // two operations is different.
-        }
-        // ****
-
-        // One step.
-        Iterator<Node> iter = eval(p1, node) ;
-
-        // Moved on one step
-        for (; iter.hasNext();) {
-            Node n2 = iter.next() ;
-            Iterator<Node> iter2 = eval(p2, n2) ;
-            fill(iter2, output) ;
-        }
-
-        // If no matches, will not call eval and we drop out.
-    }
-
-    @Override
-    protected void doFixedLengthPath(Path pathStep, Node node, long fixedLength, Collection<Node> output) {
-        if ( fixedLength == 0 ) {
-            output.add(node) ;
-            return ;
-        }
-        // P_Mod(path, count, count)
-        // One step.
-        Iterator<Node> iter = eval(pathStep, node) ;
-        // Build a path for all remaining steps.
-        long count2 = dec(fixedLength) ;
-        P_FixedLength nextPath = new P_FixedLength(pathStep, count2) ;
-        // For each element in the first step, do remaining step
-        // Accumulate across everything from first step.
-        for (; iter.hasNext();) {
-            Node n2 = iter.next() ;
-            Iterator<Node> iter2 = eval(nextPath, n2) ;
-            fill(iter2, output) ;
-        }
-    }
-
-    @Override
-    protected void doZeroOrOne(Path pathStep, Node node, Collection<Node> output) {
-        doZero(pathStep, node, output) ;
-        doOne(pathStep, node, output) ;
-    }
-
-    private void doOne(Path path, Node node, Collection<Node> output) {
-        Iterator<Node> iter = eval(path, node) ;
-        fill(iter, output) ;
-    }
-
-    @Override
-    protected void doZero(Path path, Node node, Collection<Node> output) {
-        output.add(node) ;
-    }
-
-    @Override
-    protected void doZeroOrMore(Path path, Node node, Collection<Node> output) {
-        Set<Node> visited = new HashSet<>() ;
-        ALP(node, path, visited, output) ;
-    }
-
-    @Override
-    protected void doOneOrMore(Path path, Node node, Collection<Node> output) {
-        Set<Node> visited = new HashSet<>() ;
-        // Do one step without including.
-        Iterator<Node> iter1 = eval(path, node) ;
-        for (; iter1.hasNext();) {
-            Node n1 = iter1.next() ;
-            ALP(n1, path, visited, output) ;
-        }
-    }
-
-    // This is the worker function for path*
-    private void ALP(Node node, Path path, Collection<Node> visited, Collection<Node> output) {
-        if ( visited.contains(node) )
-            return ;
-
-        // If output is a set, then no point going on if node has been added to
-        // the results.
-        // If output includes duplicates, more solutions are generated
-        // "visited" is nodes on this path (see the matching .remove).
-        if ( !output.add(node) )
-            return ;
-
-        visited.add(node) ;
-
-        Iterator<Node> iter1 = eval(path, node) ;
-        // For each step, add to results and recurse.
-        for (; iter1.hasNext();) {
-            Node n1 = iter1.next() ;
-            ALP(n1, path, visited, output) ;
-        }
-        visited.remove(node) ;
-    }
-}


Mime
View raw message