String propUri = olink.getLabel().getUri();
//this can happen if propertyName is not an Object property; it could be a subclass
if (!ontMgr.isObjectProperty(propUri))
return;
Label inversePropLabel = ontMgr.getInverseProperty(propUri);
Label inverseOfPropLabel = ontMgr.getInverseOfProperty(propUri);
if (inversePropLabel != null) {
TriplesMap inverseTrMap = r2rmlMapping.getTriplesMapIndex().get(poMap.getObject().getId());
// Create the predicate object map
PredicateObjectMap invPoMap = new PredicateObjectMap(PredicateObjectMap.getNewId(),inverseTrMap);
// Create the predicate
Predicate pred = new Predicate(olink.getId()+"+inverse");
pred.getTemplate().addTemplateTermToSet(
new StringTemplateTerm(inversePropLabel.getUri(), true));
invPoMap.setPredicate(pred);
// Create the object using RefObjMap
RefObjectMap refObjMap = new RefObjectMap(RefObjectMap.getNewRefObjectMapId(), subjTrMap);
ObjectMap invObjMap = new ObjectMap(subjMap.getId(), refObjMap);
invPoMap.setObject(invObjMap);
boolean alreadyExists = doesPredicateAlreadyExist(inverseTrMap,
invPoMap, refObjMap);
if(alreadyExists)
{
return;
}
inverseTrMap.addPredicateObjectMap(invPoMap);
// Add the link to the link set
r2rmlMapping.getAuxInfo().getTriplesMapGraph().addLink(new TriplesMapLink(inverseTrMap, subjTrMap, invPoMap));
}
if (inverseOfPropLabel != null) {
// Create the triples map
// Get the object's triples map
TriplesMap inverseOfTrMap = r2rmlMapping.getTriplesMapIndex().get(poMap.getObject().getId());
PredicateObjectMap invOfPoMap = new PredicateObjectMap(PredicateObjectMap.getNewId(),inverseOfTrMap);
// Create the predicate
Predicate pred = new Predicate(olink.getId()+"+inverseOf");
pred.getTemplate().addTemplateTermToSet(
new StringTemplateTerm(inverseOfPropLabel.getUri(), true));
invOfPoMap.setPredicate(pred);
// Create the object using RefObjMap
RefObjectMap refObjMap = new RefObjectMap(RefObjectMap.getNewRefObjectMapId(), subjTrMap);
ObjectMap invOfObjMap = new ObjectMap(subjMap.getId(), refObjMap);
invOfPoMap.setObject(invOfObjMap);