@Test @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES) @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES) @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_PROPERTY) @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = VertexFeatures.FEATURE_META_PROPERTIES, supported = false) @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = VertexFeatures.FEATURE_META_PROPERTIES) public void shouldSupportMetaPropertyIfPropertiesCanBePutOnProperties() throws Exception { try { final Vertex v = graph.addVertex(); v.property(VertexProperty.Cardinality.single, "name", "stephen", "p", "on-property"); fail(String.format(INVALID_FEATURE_SPECIFICATION, VertexFeatures.class.getSimpleName(), VertexFeatures.FEATURE_META_PROPERTIES)); } catch (Exception ex) { validateException(VertexProperty.Exceptions.metaPropertiesNotSupported(), ex); } }
@Test @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES) @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES) @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_PROPERTY) @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = VertexFeatures.FEATURE_META_PROPERTIES, supported = false) @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = VertexFeatures.FEATURE_META_PROPERTIES) public void shouldSupportMetaPropertyIfPropertiesCanBePutOnPropertiesViaVertexProperty() throws Exception { try { final Vertex v = graph.addVertex("name", "stephen"); v.property("name").property("p", "on-property"); fail(String.format(INVALID_FEATURE_SPECIFICATION, VertexFeatures.class.getSimpleName(), VertexFeatures.FEATURE_META_PROPERTIES)); } catch (Exception ex) { validateException(VertexProperty.Exceptions.metaPropertiesNotSupported(), ex); } }
@Test @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES) @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES) @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_PROPERTY) @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = VertexFeatures.FEATURE_META_PROPERTIES, supported = false) @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = VertexFeatures.FEATURE_META_PROPERTIES) public void shouldSupportMetaPropertyIfPropertiesHaveAnIteratorViaVertexProperty() throws Exception { try { final Vertex v = graph.addVertex("name", "stephen"); v.property("name").properties(); fail(String.format(INVALID_FEATURE_SPECIFICATION, VertexFeatures.class.getSimpleName(), VertexFeatures.FEATURE_META_PROPERTIES)); } catch (Exception ex) { validateException(VertexProperty.Exceptions.metaPropertiesNotSupported(), ex); } } }
@Override public <V> VertexProperty<V> property(String key, V value, Object... keyValues) { throw VertexProperty.Exceptions.metaPropertiesNotSupported(); }
@Override public <V> Property<V> property(String key, V value) { throw VertexProperty.Exceptions.metaPropertiesNotSupported(); }
@Override public <U> Iterator<Property<U>> properties(String... propertyKeys) { throw VertexProperty.Exceptions.metaPropertiesNotSupported(); }
@Override public <U> Iterator<Property<U>> properties(String... propertyKeys) { throw VertexProperty.Exceptions.metaPropertiesNotSupported(); }
@Override public <U> Iterator<Property<U>> properties(String... propertyKeys) { throw VertexProperty.Exceptions.metaPropertiesNotSupported(); }
@Override public <V> Property<V> setProperty(final Neo4jVertexProperty vertexProperty, final String key, final V value) { throw VertexProperty.Exceptions.metaPropertiesNotSupported(); }
@Override public <U> Property<U> property(String key, U value) { throw VertexProperty.Exceptions.metaPropertiesNotSupported(); }
@Override public <V> Iterator<Property<V>> getProperties(final Neo4jVertexProperty vertexProperty, final String... keys) { throw VertexProperty.Exceptions.metaPropertiesNotSupported(); }
@Override public <V> VertexProperty<V> setVertexProperty(final Neo4jVertex vertex, final VertexProperty.Cardinality cardinality, final String key, final V value, final Object... keyValues) { if (cardinality != VertexProperty.Cardinality.single) throw VertexProperty.Exceptions.multiPropertiesNotSupported(); if (keyValues.length > 0) throw VertexProperty.Exceptions.metaPropertiesNotSupported(); try { vertex.getBaseVertex().setProperty(key, value); return new Neo4jVertexProperty<>(vertex, key, value); } catch (final IllegalArgumentException iae) { throw Property.Exceptions.dataTypeOfPropertyValueNotSupported(value, iae); } }
@Override public <V> VertexProperty<V> property(VertexProperty.Cardinality cardinality, String key, V value, Object... keyValues) { if (keyValues.length > 0) throw VertexProperty.Exceptions.metaPropertiesNotSupported(); return property(key, value); }
@Override public <V> VertexProperty<V> property(final VertexProperty.Cardinality cardinality, final String key, final V value, final Object... keyValues) { if (cardinality != VertexProperty.Cardinality.single) throw VertexProperty.Exceptions.multiPropertiesNotSupported(); if (keyValues.length > 0) throw VertexProperty.Exceptions.metaPropertiesNotSupported(); setProperty(key, value); return new HBaseVertexProperty<>(graph, this, key, value); }
@Override public <V> VertexProperty<V> property(VertexProperty.Cardinality cardinality, String key, V value, Object... keyValues) { if (keyValues.length > 0) throw VertexProperty.Exceptions.metaPropertiesNotSupported(); return property(key, value); }
@Watched(prefix = "vertex") @Override @SuppressWarnings("unchecked") // (VertexProperty<V>) prop public <V> VertexProperty<V> property( VertexProperty.Cardinality cardinality, String key, V value, Object... objects) { if (objects.length != 0 && objects[0].equals(T.id)) { throw VertexProperty.Exceptions.userSuppliedIdsNotSupported(); } // TODO: extra props: objects if (objects.length != 0) { throw VertexProperty.Exceptions.metaPropertiesNotSupported(); } PropertyKey propertyKey = this.graph().propertyKey(key); // Check key in vertex label E.checkArgument(this.label.properties().contains(propertyKey.id()), "Invalid property '%s' for vertex label '%s'", key, this.label()); // Primary-Keys can only be set once if (this.schemaLabel().primaryKeys().contains(propertyKey.id())) { E.checkArgument(!this.hasProperty(propertyKey.id()), "Can't update primary key: '%s'", key); } return (VertexProperty<V>) this.addProperty(propertyKey, value, true); }
@Override public <V> Iterator<Property<V>> getProperties(final Neo4jVertexProperty vertexProperty, final String... keys) { throw VertexProperty.Exceptions.metaPropertiesNotSupported(); }
@Override public <V> VertexProperty<V> setVertexProperty(final Neo4jVertex vertex, final VertexProperty.Cardinality cardinality, final String key, final V value, final Object... keyValues) { if (cardinality != VertexProperty.Cardinality.single) throw VertexProperty.Exceptions.multiPropertiesNotSupported(); if (keyValues.length > 0) throw VertexProperty.Exceptions.metaPropertiesNotSupported(); try { vertex.getBaseVertex().setProperty(key, value); return new Neo4jVertexProperty<>(vertex, key, value); } catch (final IllegalArgumentException iae) { throw Property.Exceptions.dataTypeOfPropertyValueNotSupported(value, iae); } }
@Override public <V> Property<V> getProperty(final Neo4jVertexProperty vertexProperty, final String key) { throw VertexProperty.Exceptions.metaPropertiesNotSupported(); }
@Override public <V> Property<V> setProperty(final Neo4jVertexProperty vertexProperty, final String key, final V value) { throw VertexProperty.Exceptions.metaPropertiesNotSupported(); }