예제 #1
0
    public Vertex addVertex(final Value value) {
      Vertex v = graph.addVertex(null);

      if (value instanceof URI) {
        v.setProperty(KIND, URI);
        v.setProperty(VALUE, value.stringValue());
      } else if (value instanceof Literal) {
        Literal l = (Literal) value;
        v.setProperty(KIND, LITERAL);
        v.setProperty(VALUE, l.getLabel());
        if (null != l.getDatatype()) {
          v.setProperty(TYPE, l.getDatatype().stringValue());
        }
        if (null != l.getLanguage()) {
          v.setProperty(LANG, l.getLanguage());
        }
      } else if (value instanceof BNode) {
        BNode b = (BNode) value;
        v.setProperty(KIND, BNODE);
        v.setProperty(VALUE, b.getID());
      } else {
        throw new IllegalStateException("value of unexpected type: " + value);
      }

      return v;
    }
예제 #2
0
 public Vertex addVertex(final String id) {
   Vertex v = graph.addVertex(null);
   // vertices.put(VALUE, id, store.namespaces);
   v.setProperty(VALUE, id);
   return v;
 }