|| olink instanceof DataPropertyOfColumnLink
|| olink instanceof ColumnSubClassLink)
continue;
PredicateObjectMap poMap = new PredicateObjectMap(PredicateObjectMap.getNewId(), subjTrMap);
Node target = olink.getTarget();
// Create an object property map
if (target instanceof InternalNode) {
// Get the RefObjMap object for the objectmap
TriplesMap objTrMap = r2rmlMapping.getTriplesMapIndex().get(target.getId());
RefObjectMap refObjMap = new RefObjectMap(RefObjectMap.getNewRefObjectMapId(), objTrMap);
ObjectMap objMap = new ObjectMap(target.getId(), refObjMap);
poMap.setObject(objMap);
// Create the predicate
Predicate pred = new Predicate(olink.getId());
// Check if a specialization link exists
LabeledLink specializedEdge = getSpecializationLinkIfExists(olink, node);
if (specializedEdge != null) {
Node specializedEdgeTarget = specializedEdge.getTarget();
if (specializedEdgeTarget instanceof ColumnNode) {
String columnName = translator.getColumnNameForHNodeId(((ColumnNode) specializedEdgeTarget).getHNodeId());
ColumnTemplateTerm cnTerm =
new ColumnTemplateTerm(columnName);
pred.getTemplate().addTemplateTermToSet(cnTerm);
}
} else {
pred.getTemplate().addTemplateTermToSet(
new StringTemplateTerm(olink.getLabel().getUri(), true));
}
poMap.setPredicate(pred);
if (generateInverse)
addInversePropertyIfExists(subjMap, poMap, olink, subjTrMap);
// Add the links in the graph links data structure
TriplesMapLink link = new TriplesMapLink(subjTrMap, objTrMap, poMap);
r2rmlMapping.getAuxInfo().getTriplesMapGraph().addLink(link);
}
else if(target instanceof LiteralNode) {
LiteralNode lnode = (LiteralNode) target;
//Create the object
TemplateTermSet termSet = new TemplateTermSet();
StringTemplateTerm literalTerm = new StringTemplateTerm(lnode.getValue(), lnode.isUri());
termSet.addTemplateTermToSet(literalTerm);
StringTemplateTerm rdfLiteralTypeTerm = new StringTemplateTerm(lnode.getLabel().getUri(), true);
TemplateTermSet rdfLiteralTypeTermSet = new TemplateTermSet();
rdfLiteralTypeTermSet.addTemplateTermToSet(rdfLiteralTypeTerm);
ObjectMap objMap = new ObjectMap(target.getId(), termSet, rdfLiteralTypeTermSet);
poMap.setObject(objMap);
// Create the predicate
Predicate pred = new Predicate(olink.getId());
pred.getTemplate().addTemplateTermToSet(
new StringTemplateTerm(olink.getLabel().getUri(), true));
poMap.setPredicate(pred);
if (generateInverse)
addInversePropertyIfExists(subjMap, poMap, olink, subjTrMap);
}
// Create a data property map
else if(target instanceof ColumnNode) {
// Create the object map
ColumnNode cnode = (ColumnNode) target;
String hNodeId = cnode.getHNodeId();
String columnName = translator.getColumnNameForHNodeId(hNodeId);
ColumnTemplateTerm cnTerm = new ColumnTemplateTerm(columnName);
TemplateTermSet termSet = expandColumnTemplateTermForPyTransforms(
hNodeId, cnTerm);
String rdfLiteralUri = cnode.getRdfLiteralType() == null? "" : cnode.getRdfLiteralType().getUri();
StringTemplateTerm rdfLiteralTypeTerm = new StringTemplateTerm(rdfLiteralUri, true);
TemplateTermSet rdfLiteralTypeTermSet = new TemplateTermSet();
rdfLiteralTypeTermSet.addTemplateTermToSet(rdfLiteralTypeTerm);
ObjectMap objMap = new ObjectMap(hNodeId, termSet, rdfLiteralTypeTermSet);
poMap.setObject(objMap);
// Create the predicate
Predicate pred = new Predicate(olink.getId());
// Check if a specialization link exists
LabeledLink specializedEdge = getSpecializationLinkIfExists(olink, node);
if (specializedEdge != null) {
Node specializedEdgeTarget = specializedEdge.getTarget();
if (specializedEdgeTarget instanceof ColumnNode) {
String targetColumnName = translator.getColumnNameForHNodeId(((ColumnNode) specializedEdgeTarget).getHNodeId());
ColumnTemplateTerm cnsplTerm =
new ColumnTemplateTerm(targetColumnName);
pred.getTemplate().addTemplateTermToSet(cnsplTerm);