for (Pair<String, Resource> cp : cps) {
Variable component = cp.first == null ? procedural : procedural.getChild(graph, cp.first);
Variable cp2 = component.getPossibleProperty(graph, cp.second);
- if (cp2 != null)
+ if (cp2 != null) {
for (VariableConnectionPointDescriptor desc : ConnectionBrowser.flatten(graph, component, cp.second,
relationType)) {
result.add(desc.getURI(graph));
}
- else
- LOGGER.warn("no cp " + cp.first + " for " + component.getURI(graph));
+ } else {
+ logWarn(graph, cp, component, procedural);
+ }
}
return result;
}
@Override
public Collection<VariableConnectionPointDescriptor> getConnectionPointDescriptors(ReadGraph graph,
Resource relationType) throws DatabaseException {
- Set<VariableConnectionPointDescriptor> result = new THashSet<VariableConnectionPointDescriptor>();
+ Set<VariableConnectionPointDescriptor> result = new THashSet<>();
for (Pair<String, Resource> cp : cps) {
Variable component = cp.first == null ? procedural : procedural.getChild(graph, cp.first);
Variable cp2 = component.getPossibleProperty(graph, cp.second);
- if (cp2 != null)
+ if (cp2 != null) {
result.addAll(ConnectionBrowser.flatten(graph, component, cp.second, relationType));
- else
- LOGGER.warn("no cp " + cp.first + " for " + component.getURI(graph));
+ } else {
+ logWarn(graph, cp, component, procedural);
+ }
}
return result;
}
@Override
public Collection<VariableConnectionPointDescriptor> getConnectionPointDescriptors(ReadGraph graph,
Variable component, Resource relationType) throws DatabaseException {
- Set<VariableConnectionPointDescriptor> result = new THashSet<VariableConnectionPointDescriptor>();
+ Set<VariableConnectionPointDescriptor> result = new THashSet<>();
+ Variable procedural = component.getParent(graph);
for (Pair<String, Resource> cp : cps) {
- Variable base = cp.first == null ? component.getParent(graph) : component;
+ Variable base = cp.first == null ? procedural : procedural.getChild(graph, cp.first);
Variable cp2 = base.getPossibleProperty(graph, cp.second);
- if (cp2 != null)
+ if (cp2 != null) {
result.addAll(ConnectionBrowser.flatten(graph, base, cp.second, relationType));
- else
- LOGGER.warn("no cp " + cp.first + " for " + base.getURI(graph));
+ } else {
+ logWarn(graph, cp, base, procedural);
+ }
}
return result;
}
@Override
public Collection<Variable> getConnectionPoints(ReadGraph graph, Variable component, Resource relationType)
throws DatabaseException {
- Set<Variable> result = new THashSet<Variable>();
+ Set<Variable> result = new THashSet<>();
+ Variable procedural = component.getParent(graph);
for (Pair<String, Resource> cp : cps) {
- Variable base = cp.first == null ? component.getParent(graph) : component;
+ Variable base = cp.first == null ? procedural : procedural.getChild(graph, cp.first);
Variable cp2 = base.getPossibleProperty(graph, cp.second);
- if (cp2 != null)
+ if (cp2 != null) {
for (VariableConnectionPointDescriptor desc : ConnectionBrowser.flatten(graph, base, cp.second,
relationType)) {
result.add(desc.getVariable(graph));
}
- else
- LOGGER.warn("no cp " + cp.first + " for " + base.getURI(graph));
+ } else {
+ logWarn(graph, cp, base, procedural);
+ }
}
return result;
}
@Override
public Collection<String> getConnectionPointURIs(ReadGraph graph, Variable component, Resource relationType)
throws DatabaseException {
- Set<String> result = new THashSet<String>();
+ Set<String> result = new THashSet<>();
+ Variable procedural = component.getParent(graph);
for (Pair<String, Resource> cp : cps) {
- Variable base = cp.first == null ? component.getParent(graph) : component;
+ Variable base = cp.first == null ? procedural : procedural.getChild(graph, cp.first);
Variable cp2 = base.getPossibleProperty(graph, cp.second);
- if (cp2 != null)
+ if (cp2 != null) {
for (VariableConnectionPointDescriptor desc : ConnectionBrowser.flatten(graph, base, cp.second,
relationType)) {
result.add(desc.getURI(graph));
}
- else
- LOGGER.warn("no cp " + cp.first + " for " + base.getURI(graph));
+ } else {
+ logWarn(graph, cp, base, procedural);
+ }
}
return result;
}
return this;
}
+ private static void logWarn(ReadGraph graph, Pair<String, Resource> cp, Variable base, Variable procedural) throws DatabaseException {
+ LOGGER.warn("no cp " + cp.first + " for " + base.getURI(graph));
+ LOGGER.warn(" proc: " + procedural.getURI(graph));
+ LOGGER.warn(" rel: " + graph.getURI(cp.second));
+ LOGGER.warn(" base: " + base.getURI(graph));
+ }
+
}
\ No newline at end of file