Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
305 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,48 @@ | |||
/* | |||
* 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 projects.merge; | |||
|
|||
import com.hp.hpl.jena.sparql.core.Var ; | |||
|
|||
public class MergeAction | |||
{ | |||
public String index1 ; | |||
public String index2 ; | |||
public String prefix1 ; | |||
public String prefix2 ; | |||
public Var joinVar ; // This is the first col after the prefix | |||
|
|||
public MergeAction(String index1, String index2, | |||
String prefix1, String prefix2, | |||
Var joinVar) | |||
{ | |||
super() ; | |||
this.index1 = index1 ; | |||
this.index2 = index2 ; | |||
this.prefix1 = prefix1 ; | |||
this.prefix2 = prefix2 ; | |||
this.joinVar = joinVar ; | |||
} | |||
|
|||
@Override | |||
public String toString() | |||
{ | |||
return "[Join("+index1+","+index2+") ("+prefix1+","+prefix2+") "+joinVar+"]" ; | |||
} | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,32 @@ | |||
/* | |||
* 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 projects.merge; | |||
|
|||
import java.util.Iterator ; | |||
|
|||
import org.openjena.atlas.lib.Tuple ; | |||
|
|||
import com.hp.hpl.jena.tdb.index.TupleIndex ; | |||
import com.hp.hpl.jena.tdb.store.NodeId ; | |||
|
|||
public interface TupleIndexPrefix extends TupleIndex | |||
{ | |||
/** Find all the entries which start with thegiven prefix */ | |||
public Iterator<Tuple<NodeId>> findPrefix(Tuple<NodeId> pattern) ; | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,51 @@ | |||
/* | |||
* 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 projects.merge; | |||
|
|||
import java.util.Arrays ; | |||
import java.util.Iterator ; | |||
|
|||
import org.openjena.atlas.lib.Tuple ; | |||
|
|||
import com.hp.hpl.jena.tdb.index.TupleIndex ; | |||
import com.hp.hpl.jena.tdb.store.NodeId ; | |||
|
|||
public class TupleIndexPrefixSimple extends TupleIndexWrapper implements TupleIndexPrefix | |||
{ | |||
|
|||
public TupleIndexPrefixSimple(TupleIndex index) | |||
{ | |||
super(index) ; | |||
} | |||
|
|||
@Override | |||
public Iterator<Tuple<NodeId>> findPrefix(Tuple<NodeId> pattern) | |||
{ | |||
// Does not exploit the features of the index. | |||
// Extend the Tuple to table width. | |||
int patternLen = getTupleLength() ; | |||
int indexLen = getTupleLength() ; | |||
NodeId[] x = new NodeId[indexLen] ; | |||
System.arraycopy(pattern.tuple(), 0, x, 0, patternLen) ; | |||
Arrays.fill(x, patternLen, indexLen, NodeId.NodeIdAny) ; | |||
return find(Tuple.create(x)) ; | |||
} | |||
|
|||
} | |||
|
Oops, something went wrong.