predicateStr = getUri(predicateStr);
objStr = getUri(objStr);
if (predicateStr.equalsIgnoreCase(typePredicate)) {
Node classNode = new InternalNode(objStr, new Label(objStr));
uri2Classes.put(subjStr, classNode);
graph.addVertex(classNode);
}
}
// int countOfLiterals = 0;
String id;
for (Statement st : statements) {
String subjStr = st.getSubject();
String predicateStr = st.getPredicate();
String objStr = st.getObject();
subjStr = getUri(subjStr);
predicateStr = getUri(predicateStr);
objStr = getUri(objStr);
if (predicateStr.equalsIgnoreCase(typePredicate))
continue;
Node subj = uri2Classes.get(subjStr);
if (subj == null) {
subj = new InternalNode(subjStr, new Label(subjStr));
graph.addVertex(subj);
}
Node obj = uri2Classes.get(objStr);
if (obj == null) {
if (objStr.startsWith(attPrefix)) {
id = new RandomGUID().toString();
obj = new ColumnNode(id, objStr, objStr, null);
SemanticType semanticType = new SemanticType(((ColumnNode)obj).getHNodeId(),
new Label(predicateStr),
subj.getLabel(),
Origin.User,
1.0);
((ColumnNode)obj).setUserSelectedSemanticType(semanticType);
} else if (objStr.indexOf(":") == -1 && objStr.indexOf("\"") != -1) {
// String literalId = "lit:" + serviceId + "_l" + String.valueOf(countOfLiterals);
obj = new LiteralNode(objStr, objStr, null, false);
// countOfLiterals ++;
} else
obj = new InternalNode(objStr, new Label(objStr));
graph.addVertex(obj);
}
LabeledLink e;
if (obj instanceof InternalNode)
e = new ObjectPropertyLink(LinkIdFactory.getLinkId(predicateStr, subj.getId(), obj.getId()), new Label(predicateStr), ObjectPropertyType.None);
else
e = new DataPropertyLink(LinkIdFactory.getLinkId(predicateStr, subj.getId(), obj.getId()), new Label(predicateStr));
graph.addEdge(subj, obj, e);
}
return graph;