private void createSignatureType(OSchema schema) { OClass signatures = schema.createClass("Signatures"); signatures.createProperty(String.valueOf(DocumentAttributes.SHA1), OType.STRING).setNotNull(true); signatures.createIndex("sha1Idx", OClass.INDEX_TYPE.UNIQUE, DocumentAttributes.SHA1.toString()); }
private void createDocType(final OSchema schema, final String docType) { logger.debug("Create document class '{}'", docType); OClass page = schema.createClass(docType); // Primary key String attribName = DocumentAttributes.SOURCE_URI.toString(); page.createProperty(attribName, OType.STRING).setNotNull(true); page.createIndex(docType + "sourceUriIndex", OClass.INDEX_TYPE.UNIQUE, attribName); attribName = DocumentAttributes.SHA1.toString(); page.createProperty(attribName, OType.STRING).setNotNull(true); page.createIndex(docType + "sha1Index", OClass.INDEX_TYPE.NOTUNIQUE, attribName); attribName = DocumentAttributes.CACHED.toString(); page.createProperty(attribName, OType.BOOLEAN).setNotNull(true); page.createIndex(docType + "cachedIndex", OClass.INDEX_TYPE.NOTUNIQUE, attribName); attribName = DocumentAttributes.RENDERED.toString(); page.createProperty(attribName, OType.BOOLEAN).setNotNull(true); page.createIndex(docType + "renderedIndex", OClass.INDEX_TYPE.NOTUNIQUE, attribName); attribName = DocumentAttributes.STATUS.toString(); page.createProperty(attribName, OType.STRING).setNotNull(true); page.createIndex(docType + "statusIndex", OClass.INDEX_TYPE.NOTUNIQUE, attribName); }
@Override protected void defineType(final OClass type) { type.createProperty(P_VERSION, OType.INTEGER); type.createProperty(P_TYPE, OType.STRING); type.createProperty(P_ENABLED, OType.BOOLEAN); type.createProperty(P_NOTES, OType.STRING); type.createProperty(P_PROPERTIES, OType.EMBEDDEDMAP); }
private void maybeCreateProperty(final OClass oClass, final String property, final OType oType) { if (!oClass.existsProperty(property)) { oClass.createProperty(property, oType); } } }
@Override protected void defineType(final OClass type) { type.createProperty(P_USER_ID, OType.STRING) .setNotNull(true); type.createProperty(P_SOURCE, OType.STRING) .setNotNull(true); type.createProperty(P_ROLES, OType.EMBEDDEDSET); type.createIndex(I_USER_ID_SOURCE, INDEX_TYPE.UNIQUE, P_USER_ID, P_SOURCE); }
@Override protected void defineType(final OClass type) { type.createProperty(P_NAME, OType.STRING).setNotNull(true); type.createProperty(P_TYPE, OType.STRING).setNotNull(true); type.createProperty(P_CONTENT, OType.STRING).setNotNull(true); //ensure name is unique as it serves as the ID for a script type.createIndex(I_NAME, INDEX_TYPE.UNIQUE, P_NAME); }
@Override protected void defineType(final OClass type) { type.createProperty(P_REPOSITORY_NAME, OType.STRING) .setMandatory(true) .setNotNull(true); type.createProperty(P_ATTRIBUTES, OType.EMBEDDEDMAP) .setNotNull(true); type.createIndex(I_REPOSITORY_NAME, INDEX_TYPE.UNIQUE, P_REPOSITORY_NAME); }
OrientGraphFactory ogf = new OrientGraphFactory( "plocal:/home/paulkalkbrenner/Dokumente/odb/databases/ConnectER", "admin", "admin"); OrientGraph og = ogf.getTx(); OClass cl=og.createVertexType("Person", "V"); cl.createProperty("LastName", OType.STRING); OrientVertex v1=og.addVertex("class:Person"); v1.setProperties("Lastname","Alessandro"); for (Vertex v : og.getVertices()) { System.out.println(v.getProperty("Lastname")); } og.shutdown();
private void createSignatureType(OSchema schema) { OClass signatures = schema.createClass("Signatures"); signatures.createProperty(String.valueOf(DocumentAttributes.SHA1), OType.STRING).setNotNull(true); signatures.createIndex("sha1Idx", OClass.INDEX_TYPE.UNIQUE, DocumentAttributes.SHA1.toString()); }
@Override protected void defineType(final OClass type) { type.createProperty(P_NODE_ID, OType.STRING) .setCollate(new OCaseInsensitiveCollate()) .setMandatory(true) .setNotNull(true); type.createProperty(P_LAST_HEALTHCHECK, OType.DATETIME) .setMandatory(true) .setNotNull(true); type.createIndex(I_NODE_ID, INDEX_TYPE.UNIQUE, P_NODE_ID); }
private void createCaseInsensitiveNameField(final OClass type) { log.info("Creating case-insensitive name field on component"); if (!type.existsProperty(P_CI_NAME)) { type.createProperty(P_CI_NAME, OType.STRING) .setCollate(new OCaseInsensitiveCollate()) .setMandatory(false) .setNotNull(false); } }
@Override public OrientVertexProperty call(OrientBaseGraph iArgument) { final String clsName = OrientBaseGraph.encodeClassName(iEdgeClassName); final boolean useVertexFieldsForEdgeLabels = graph.isUseVertexFieldsForEdgeLabels(); final String fieldName = OrientVertex.getConnectionFieldName(iDirection, clsName, useVertexFieldsForEdgeLabels); return new OrientVertexProperty(graph, delegate.createProperty(fieldName, iType)); } });
@Override public void initClazz(ODatabaseInternal db) { OSchema schema = db.getMetadata().getSchema(); OClass polygon = schema.createAbstractClass(getName(), superClass(db)); polygon.createProperty("coordinates", OType.EMBEDDEDLIST, OType.EMBEDDEDLIST); }
@Override public void initClazz(ODatabaseInternal db) { OSchema schema = db.getMetadata().getSchema(); OClass polygon = schema.createAbstractClass(getName(), superClass(db)); polygon.createProperty("coordinates", OType.EMBEDDEDLIST, OType.EMBEDDEDLIST); }
@Override public void initClazz(ODatabaseInternal db) { OSchema schema = db.getMetadata().getSchema(); OClass lineString = schema.createAbstractClass(getName(), superClass(db)); lineString.createProperty(COORDINATES, OType.EMBEDDEDLIST, OType.EMBEDDEDLIST); }
@Override public void initClazz(ODatabaseInternal db) { OSchema schema = db.getMetadata().getSchema(); OClass lineString = schema.createAbstractClass(getName(), superClass(db)); lineString.createProperty(COORDINATES, OType.EMBEDDEDLIST, OType.EMBEDDEDLIST); }
@Override protected OProperty createInstance(OProperty proxy) { OSchema schema = OrientDbWebSession.get().getDatabase().getMetadata().getSchema(); OClass oClass = schema.getClass(className); return oClass.createProperty(proxy.getName(), proxy.getType()); }
@Override public void initClazz(ODatabaseInternal db) { OSchema schema = db.getMetadata().getSchema(); OClass point = schema.createAbstractClass(getName(), superClass(db)); OProperty coordinates = point.createProperty(COORDINATES, OType.EMBEDDEDLIST, OType.DOUBLE); coordinates.setMin("2"); coordinates.setMin("2"); }
@Override public void initClazz(ODatabaseInternal db) { OSchema schema = db.getMetadata().getSchema(); OClass rectangle = schema.createAbstractClass(getName(), superClass(db)); OProperty coordinates = rectangle.createProperty(COORDINATES, OType.EMBEDDEDLIST, OType.DOUBLE); coordinates.setMin("4"); coordinates.setMin("4"); }
@Override protected OProperty createInstance(OProperty proxy) { OSchema schema = OrientDbWebSession.get().getDatabase().getMetadata().getSchema(); OClass oClass = schema.getClass(className); return oClass.createProperty(proxy.getName(), proxy.getType()); }