com.ontology2.bakemono.primitiveTriples.PrimitiveTriplePredicateRewriter Maven / Gradle / Ivy
package com.ontology2.bakemono.primitiveTriples;
import com.google.common.base.Function;
import com.hp.hpl.jena.rdf.model.Model;
public class PrimitiveTriplePredicateRewriter implements Function {
private final String from;
private final String to;
public PrimitiveTriplePredicateRewriter(String from, String to) {
this.from = from;
this.to = to;
}
public PrimitiveTriple apply(PrimitiveTriple obj) {
if(from.equals(obj.getPredicate())) {
return new PrimitiveTriple(
obj.getSubject(),
to,
obj.getObject()
);
} else {
return obj;
}
}
}