Skip to content

Commit

Permalink
graph model updates, first steps of applying new graph model in graph…
Browse files Browse the repository at this point in the history
… output transform. apache#3032
  • Loading branch information
bamaer committed Nov 7, 2023
1 parent 35bf5c8 commit ba86833
Show file tree
Hide file tree
Showing 13 changed files with 519 additions and 77 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,18 @@

public abstract class GraphEntity implements IGraphEntity{

private final Map<String, IValueMeta> propertiesMeta;
private List<Object[]> properties;

public GraphEntity(String elementId){
this(Collections.emptyMap());
}

public GraphEntity(Map<String, IValueMeta> propertiesMeta) {
this.propertiesMeta = propertiesMeta;
public GraphEntity(List<Object[]> properties) {
this.properties = properties;
}

@Override
public Map<String, IValueMeta> getPropertiesMeta(){
return propertiesMeta;
public List<Object[]> getProperties(){
return properties;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@

public class GraphNode extends GraphEntity implements IGraphNode{

private final Collection<String> labels;
private List<String> relProps;
private List<String> labels;
// private List<String> relProps;

public GraphNode(Collection<String> labels, Map<String, IValueMeta> propertiesMeta, List<String> relProps) {
super(propertiesMeta);
public GraphNode(List<String> labels, List<Object[]> properties) {
super(properties);
this.labels = labels;
this.relProps = relProps;
// this.relProps = relProps;
}

@Override
Expand All @@ -27,12 +27,12 @@ public boolean hasLabel(String label) {
return labels.contains(label);
}

public List<String> getRelationshipProperties(){
return relProps;
}

public void setRelationshipProperties(List<String> relProps){
this.relProps = relProps;
}
// public List<String> getRelationshipProperties(){
// return relProps;
// }
//
// public void setRelationshipProperties(List<String> relProps){
// this.relProps = relProps;
// }

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package org.apache.hop.graphdatabases.core;

import org.apache.hop.core.row.IValueMeta;
import org.apache.hop.core.variables.IVariables;

import java.util.List;

public class GraphNodePropertiesMeta extends GraphPropertiesMeta implements IGraphProperties{

private List<String> primaryPropertyNames;

public GraphNodePropertiesMeta(String[] propertyNames,
IValueMeta[] propertyTypes,
List<String> primaryPropertyNames ){
super(propertyNames, propertyTypes);
this.primaryPropertyNames = primaryPropertyNames;
}

public List<String> getPrimaryPropertyNames() {
return primaryPropertyNames;
}

public void setPrimaryPropertyNames(List<String> primaryPropertyNames) {
this.primaryPropertyNames = primaryPropertyNames;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package org.apache.hop.graphdatabases.core;

import org.apache.hop.core.row.IValueMeta;
import org.apache.hop.core.variables.IVariables;

public abstract class GraphPropertiesMeta implements IGraphProperties{

public String[] propertyNames;
public IValueMeta[] propertyTypes;
public GraphPropertiesMeta(String[] propertyNames, IValueMeta[] propertyTypes){
this.propertyNames = propertyNames;
this.propertyTypes = propertyTypes;
}

@Override
public String[] getPropertyNames() {
return propertyNames;
}

@Override
public void setPropertyNames(String[] propertyNames) {
this.propertyNames = propertyNames;
}

@Override
public IValueMeta[] getPropertyTypes() {
return propertyTypes;
}

@Override
public void setPropertyTypes(IValueMeta[] propertyTypes) {
this.propertyTypes = propertyTypes;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import org.apache.hop.core.row.IValueMeta;

import java.util.List;
import java.util.Map;

public class GraphRelationship extends GraphEntity implements IGraphRelationship {
Expand All @@ -10,11 +11,13 @@ public class GraphRelationship extends GraphEntity implements IGraphRelationship
private String endElementId;
private final String type;
public GraphRelationship(
String elementId,
String startElementId,
String endElementId,
// String elementId,
// String startElementId,
// String endElementId,
GraphNode fromNode,
GraphNode toNode,
String type,
Map<String, IValueMeta> properties) {
List<Object[]> properties) {
super(properties);
this.startElementId = startElementId;
this.endElementId = endElementId;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package org.apache.hop.graphdatabases.core;

import org.apache.hop.core.row.IValueMeta;

import java.util.List;

public class GraphRelationshipPropertiesMeta extends GraphPropertiesMeta implements IGraphProperties{

private List<String> fromPrimaryPropNames, toPrimaryPropNames;

public GraphRelationshipPropertiesMeta(String[] propertyNames,
IValueMeta[] propertyTypes,
List<String> fromPrimaryPropNames,
List<String> toPrimaryPropNames){
super(propertyNames, propertyTypes);
this.fromPrimaryPropNames = fromPrimaryPropNames;
this.toPrimaryPropNames = toPrimaryPropNames;
}

public List<String> getFromPrimaryPropNames() {
return fromPrimaryPropNames;
}

public void setFromPrimaryPropNames(List<String> fromPrimaryPropNames) {
this.fromPrimaryPropNames = fromPrimaryPropNames;
}

public List<String> getToPrimaryPropNames() {
return toPrimaryPropNames;
}

public void setToPrimaryPropNames(List<String> toPrimaryPropNames) {
this.toPrimaryPropNames = toPrimaryPropNames;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

import org.apache.hop.core.row.IValueMeta;

import java.util.List;
import java.util.Map;

public interface IGraphEntity {

Map<String, IValueMeta> getPropertiesMeta();
List<Object[]> getProperties();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package org.apache.hop.graphdatabases.core;

import java.util.List;

public interface IGraphNodeMeta extends IGraphProperties{

List<String> getLabels();

void setLabels(String[] labels);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package org.apache.hop.graphdatabases.core;

import org.apache.hop.core.row.IValueMeta;

public interface IGraphProperties {

String[] getPropertyNames();

void setPropertyNames(String[] propertyNames);

IValueMeta[] getPropertyTypes();

void setPropertyTypes(IValueMeta[] propertyTypes);

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package org.apache.hop.graphdatabases.core;

public interface IGraphRelationshipMeta extends IGraphProperties{

String getType();

void setType(String relationshipType);
}
Loading

0 comments on commit ba86833

Please sign in to comment.