public static InternalRelationType getType(StandardTitanTx tx, String typeName) { RelationType t = tx.getRelationType(typeName); if (t == null && !tx.getConfiguration().getAutoSchemaMaker().ignoreUndefinedQueryTypes()) { throw new IllegalArgumentException("Undefined type used in query: " + typeName); } return (InternalRelationType) t; }
@Override public EdgeLabel getOrCreateEdgeLabel(String name) { RelationType et = getRelationType(name); if (et == null) { return config.getAutoSchemaMaker().makeEdgeLabel(makeEdgeLabel(name)); } else if (et.isEdgeLabel()) { return (EdgeLabel) et; } else throw new IllegalArgumentException("The type of given name is not a label: " + name); }
@Override public PropertyKey getOrCreatePropertyKey(String name) { RelationType et = getRelationType(name); if (et == null) { return config.getAutoSchemaMaker().makePropertyKey(makePropertyKey(name)); } else if (et.isPropertyKey()) { return (PropertyKey) et; } else throw new IllegalArgumentException("The type of given name is not a key: " + name); }
@Override public VertexLabel getOrCreateVertexLabel(String name) { VertexLabel vlabel = getVertexLabel(name); if (vlabel==null) { vlabel = config.getAutoSchemaMaker().makeVertexLabel(makeVertexLabel(name)); } return vlabel; }
/** * Creates a new property key with default settings against the provided {@link PropertyKeyMaker}. * * @param factory PropertyKeyMaker through which the property key is created * @return A new property key * @throws IllegalArgumentException if the name is already in use or if other configured values are invalid. */ public default PropertyKey makePropertyKey(PropertyKeyMaker factory) { return factory.cardinality(defaultPropertyCardinality(factory.getName())).dataType(Object.class).make(); }
@Override public VertexLabel getOrCreateVertexLabel(String name) { VertexLabel vlabel = getVertexLabel(name); if (vlabel==null) { vlabel = config.getAutoSchemaMaker().makeVertexLabel(makeVertexLabel(name)); } return vlabel; }
@Override public VertexProperty.Cardinality getCardinality(final String key) { StandardTitanTx tx = (StandardTitanTx)TitanFeatures.this.graph.newTransaction(); try { if (!tx.containsPropertyKey(key)) return tx.getConfiguration().getAutoSchemaMaker().defaultPropertyCardinality(key).convert(); return tx.getPropertyKey(key).cardinality().convert(); } finally { tx.rollback(); } }
@Override public PropertyKey getOrCreatePropertyKey(String name) { RelationType et = getRelationType(name); if (et == null) { return config.getAutoSchemaMaker().makePropertyKey(makePropertyKey(name)); } else if (et.isPropertyKey()) { return (PropertyKey) et; } else throw new IllegalArgumentException("The type of given name is not a key: " + name); }
@Override public EdgeLabel getOrCreateEdgeLabel(String name) { RelationType et = getRelationType(name); if (et == null) { return config.getAutoSchemaMaker().makeEdgeLabel(makeEdgeLabel(name)); } else if (et.isEdgeLabel()) { return (EdgeLabel) et; } else throw new IllegalArgumentException("The type of given name is not a label: " + name); }
@Override public VertexLabel getVertexLabel(String name) { verifyOpen(); if (BaseVertexLabel.DEFAULT_VERTEXLABEL.getName().equals(name)) return BaseVertexLabel.DEFAULT_VERTEXLABEL; VertexLabel vlabel = (VertexLabel)getSchemaVertex(TitanSchemaCategory.VERTEXLABEL.getSchemaName(name)); if (vlabel==null) { vlabel = config.getAutoSchemaMaker().makeVertexLabel(makeVertexLabel(name)); } return vlabel; }
public static InternalRelationType getType(StandardTitanTx tx, String typeName) { RelationType t = tx.getRelationType(typeName); if (t == null && !tx.getConfiguration().getAutoSchemaMaker().ignoreUndefinedQueryTypes()) { throw new IllegalArgumentException("Undefined type used in query: " + typeName); } return (InternalRelationType) t; }
/** * Creates a new property key with default settings against the provided {@link PropertyKeyMaker}. * * @param factory PropertyKeyMaker through which the property key is created * @return A new property key * @throws IllegalArgumentException if the name is already in use or if other configured values are invalid. */ public default PropertyKey makePropertyKey(PropertyKeyMaker factory) { return factory.cardinality(defaultPropertyCardinality(factory.getName())).dataType(Object.class).make(); }
@Override public PropertyKey getOrCreatePropertyKey(String name) { RelationType et = getRelationType(name); if (et == null) { return config.getAutoSchemaMaker().makePropertyKey(makePropertyKey(name)); } else if (et.isPropertyKey()) { return (PropertyKey) et; } else throw new IllegalArgumentException("The type of given name is not a key: " + name); }
@Override public EdgeLabel getOrCreateEdgeLabel(String name) { RelationType et = getRelationType(name); if (et == null) { return config.getAutoSchemaMaker().makeEdgeLabel(makeEdgeLabel(name)); } else if (et.isEdgeLabel()) { return (EdgeLabel) et; } else throw new IllegalArgumentException("The type of given name is not a label: " + name); }
public static InternalRelationType getType(StandardTitanTx tx, String typeName) { RelationType t = tx.getRelationType(typeName); if (t == null && !tx.getConfiguration().getAutoSchemaMaker().ignoreUndefinedQueryTypes()) { throw new IllegalArgumentException("Undefined type used in query: " + typeName); } return (InternalRelationType) t; }
@Override public VertexProperty.Cardinality getCardinality(final String key) { StandardTitanTx tx = (StandardTitanTx)TitanFeatures.this.graph.newTransaction(); try { if (!tx.containsPropertyKey(key)) return tx.getConfiguration().getAutoSchemaMaker().defaultPropertyCardinality(key).convert(); return tx.getPropertyKey(key).cardinality().convert(); } finally { tx.rollback(); } }