/** * Writes all key-value properties to a json object and returns it. * * @param entity entity with key-value properties * @return json object containing the properties * @throws JSONException */ protected JSONObject writeProperties(EPGMAttributed entity) throws JSONException { JSONObject data = new JSONObject(); if (entity.getPropertyCount() > 0) { for (String propertyKey : entity.getPropertyKeys()) { data.put( propertyKey, entity.getPropertyValue(propertyKey).getObject()); } } return data; }
/** * Adds the given group properties to the attributed element. * * @param attributed attributed element * @param groupPropertyValues group property values * @param vertexLabelGroup vertex label group */ protected void setGroupProperties(EPGMAttributed attributed, PropertyValueList groupPropertyValues, LabelGroup vertexLabelGroup) { Iterator<PropertyValue> valueIterator = groupPropertyValues.iterator(); for (String groupPropertyKey : vertexLabelGroup.getPropertyKeys()) { attributed.setProperty(groupPropertyKey, valueIterator.next()); } }
/** * Sets the given property values as new properties at the given element. * @param element attributed element * @param values aggregate values * @param valueAggregators aggregate functions */ protected void setAggregateProperties(EPGMAttributed element, PropertyValueList values, List<AggregateFunction> valueAggregators) { if (!valueAggregators.isEmpty()) { Iterator<PropertyValue> valueIt = values.iterator(); for (AggregateFunction valueAggregator : valueAggregators) { element.setProperty(valueAggregator.getAggregatePropertyKey(), valueIt.next()); } } } }
/** * Writes all key-value properties to a json object and returns it. * * @param entity entity with key-value properties * @return json object containing the properties * @throws JSONException */ protected JSONObject writeProperties(EPGMAttributed entity) throws JSONException { JSONObject data = new JSONObject(); if (entity.getPropertyCount() > 0) { for (String propertyKey : entity.getPropertyKeys()) { data.put( propertyKey, entity.getPropertyValue(propertyKey).getObject()); } } return data; }
/** * Adds the given group properties to the attributed element. * * @param attributed attributed element * @param groupPropertyValues group property values * @param vertexLabelGroup vertex label group */ protected void setGroupProperties(EPGMAttributed attributed, PropertyValueList groupPropertyValues, LabelGroup vertexLabelGroup) { Iterator<PropertyValue> valueIterator = groupPropertyValues.iterator(); for (String groupPropertyKey : vertexLabelGroup.getPropertyKeys()) { attributed.setProperty(groupPropertyKey, valueIterator.next()); } }
/** * Sets the given property values as new properties at the given element. * @param element attributed element * @param values aggregate values * @param valueAggregators aggregate functions */ protected void setAggregateProperties(EPGMAttributed element, PropertyValueList values, List<AggregateFunction> valueAggregators) { if (!valueAggregators.isEmpty()) { Iterator<PropertyValue> valueIt = values.iterator(); for (AggregateFunction valueAggregator : valueAggregators) { element.setProperty(valueAggregator.getAggregatePropertyKey(), valueIt.next()); } } } }