Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,21 @@ public LinkEdgeImpl(
this.initContext = RunnerUtil.getKgGraphInitContext(kgGraphSchema);
}

private boolean isTargetVertexTypeEmpty(List<String> targetVertexTypes) {
if (null == targetVertexTypes || targetVertexTypes.isEmpty()) {
return true;
}
for (String type : targetVertexTypes) {
if ("RdfProperty".equals(type)) {
continue;
}
if (StringUtils.isNotEmpty(type)) {
return false;
}
}
return true;
}

public List<KgGraph<IVertexId>> link(KgGraph<IVertexId> kgGraph) {
Iterator<KgGraph<IVertexId>> it = kgGraph.getPath(staticParameters, null);
List<KgGraph<IVertexId>> mergeList = new ArrayList<>();
Expand Down Expand Up @@ -143,9 +158,12 @@ public List<KgGraph<IVertexId>> link(KgGraph<IVertexId> kgGraph) {
String targetAlias = targetVertexMeta.alias();
List<String> targetVertexTypes =
new ArrayList<>(JavaConversions.setAsJavaSet(targetVertexMeta.typeNames()));
if (targetVertexTypes.size() == 0) {
throw new RuntimeException(
"Linked edge target vertex type must contains at least one type");
if (isTargetVertexTypeEmpty(targetVertexTypes)) {
targetVertexTypes = Lists.newArrayList(linkedUdtfResult.getVertexType());
if (isTargetVertexTypeEmpty(targetVertexTypes)) {
throw new RuntimeException(
"Linked edge target vertex type must contains at least one type");
}
}
for (String targetVertexType : targetVertexTypes) {
IVertexId targetId = new VertexId(targetIdStr, targetVertexType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,7 @@ public class LinkedUdtfResult {

/** edge type */
private String edgeType = null;

/** vertex type */
private String vertexType = null;
}
Loading