mirror of
https://github.com/JHUAPL/AccumuloGraph.git
synced 2026-01-09 12:47:56 -05:00
More documentation cleanup and cruft removal
This commit is contained in:
@@ -50,6 +50,7 @@ public class AccumuloEdge extends AccumuloElement implements Edge {
|
||||
this.outId = outVertex;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vertex getVertex(Direction direction) throws IllegalArgumentException {
|
||||
switch (direction) {
|
||||
case IN:
|
||||
@@ -79,6 +80,7 @@ public class AccumuloEdge extends AccumuloElement implements Edge {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLabel() {
|
||||
// TODO less special treatment for "LABEL" property...
|
||||
if (label != null) {
|
||||
@@ -87,6 +89,7 @@ public class AccumuloEdge extends AccumuloElement implements Edge {
|
||||
return getProperty(StringFactory.LABEL);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
parent.removeEdge(this);
|
||||
}
|
||||
@@ -111,6 +114,7 @@ public class AccumuloEdge extends AccumuloElement implements Edge {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "[" + getId() + ":" + getVertex(Direction.OUT) + " -> " + getLabel() + " -> " + getVertex(Direction.IN) + "]";
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ public abstract class AccumuloElement implements Element {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getProperty(String key) {
|
||||
if (propertiesCache == null) {
|
||||
// lazily create the properties cache...
|
||||
@@ -71,11 +72,13 @@ public abstract class AccumuloElement implements Element {
|
||||
return parent.getPropertyKeys(type, id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setProperty(String key, Object value) {
|
||||
Integer timeout = parent.setProperty(type, id, key, value);
|
||||
cacheProperty(key, value, timeout);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T removeProperty(String key) {
|
||||
if (propertiesCache != null) {
|
||||
// we have the cached value but we still need to pass this on to the
|
||||
@@ -88,10 +91,12 @@ public abstract class AccumuloElement implements Element {
|
||||
return parent.removeProperty(type, id, key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
|
||||
@@ -81,7 +81,7 @@ import com.tinkerpop.blueprints.util.StringFactory;
|
||||
* <tr><td>VertexID</td><td>LABEL</td><td>EXISTS</td><td>[empty]</td></tr>
|
||||
* <tr><td>VertexID</td><td>INEDGE</td><td>InVertexID_EdgeID</td><td>EdgeLabel</td></tr>
|
||||
* <tr><td>VertexID</td><td>OUTEDGE</td><td>OutVertexID_EdgeID</td><td>EdgeLabel</td></tr>
|
||||
* <tr><td>VertexID</td><td>PropertyKey</td><td>[empty]</td><td>PropertyValue</td></tr>
|
||||
* <tr><td>VertexID</td><td>PropertyKey</td><td>[empty]</td><td>Encoded Value</td></tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
@@ -106,7 +106,7 @@ import com.tinkerpop.blueprints.util.StringFactory;
|
||||
* <tr><th>ROWID</th><th>COLFAM</th><th>COLQUAL</th><th>VALUE</th></tr>
|
||||
* </thead>
|
||||
* <tbody>
|
||||
* <tr><td>Encoded PropertyValue</td><td>PropertyKey</td><td>ElementID</td><td>[empty]</td></tr>
|
||||
* <tr><td>Encoded Value</td><td>PropertyKey</td><td>ElementID</td><td>[empty]</td></tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
|
||||
@@ -14,37 +14,13 @@
|
||||
*/
|
||||
package edu.jhuapl.tinkerpop;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.SortedSet;
|
||||
|
||||
import org.apache.accumulo.core.client.AccumuloException;
|
||||
import org.apache.accumulo.core.client.AccumuloSecurityException;
|
||||
import org.apache.accumulo.core.client.TableExistsException;
|
||||
import org.apache.accumulo.core.client.TableNotFoundException;
|
||||
import org.apache.accumulo.core.client.admin.TableOperations;
|
||||
import org.apache.accumulo.core.data.Value;
|
||||
import org.apache.hadoop.io.Text;
|
||||
|
||||
import com.tinkerpop.blueprints.util.StringFactory;
|
||||
|
||||
final class AccumuloGraphUtils {
|
||||
|
||||
public static final Value EMPTY_VALUE = new Value(new byte[0]);
|
||||
public static final Text EMPTY_TEXT = new Text("");
|
||||
|
||||
public static final Text ID = new Text(StringFactory.ID);
|
||||
|
||||
public static final Text IN = new Text("I");
|
||||
public static final Text OUT = new Text("O");
|
||||
|
||||
public static final String toId(Object obj) {
|
||||
return obj.toString();
|
||||
}
|
||||
|
||||
public static Value toValue(String val) {
|
||||
return new Value(val.getBytes());
|
||||
}
|
||||
|
||||
/**
|
||||
* Create and/or clear existing graph tables for the given configuration.
|
||||
*
|
||||
@@ -96,17 +72,7 @@ final class AccumuloGraphUtils {
|
||||
}
|
||||
}
|
||||
|
||||
} catch (AccumuloException e) {
|
||||
throw new IllegalArgumentException(e);
|
||||
} catch (AccumuloSecurityException e) {
|
||||
throw new IllegalArgumentException(e);
|
||||
} catch (IOException e) {
|
||||
throw new IllegalArgumentException(e);
|
||||
} catch (InterruptedException e) {
|
||||
throw new IllegalArgumentException(e);
|
||||
} catch (TableNotFoundException e) {
|
||||
throw new IllegalArgumentException(e);
|
||||
} catch (TableExistsException e) {
|
||||
} catch (Exception e) {
|
||||
throw new IllegalArgumentException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,26 +26,32 @@ public class AccumuloVertex extends AccumuloElement implements Vertex {
|
||||
super(parent, id, Vertex.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<Edge> getEdges(Direction direction, String... labels) {
|
||||
return parent.getEdges(id, direction, labels);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<Vertex> getVertices(Direction direction, String... labels) {
|
||||
return parent.getVertices(id, direction, labels);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VertexQuery query() {
|
||||
return new DefaultVertexQuery(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Edge addEdge(String label, Vertex inVertex) {
|
||||
return parent.addEdge(null, this, inVertex, label);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
parent.removeVertex(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "[" + getId() + "]";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user