Mercurial > hg > ismi-richfaces
view src/main/java/de/mpiwg/itgroup/dm2e/AddAgents.java @ 68:aa8a0578fbc6
Merge with 34d0f1187b0f3a315c1d83bb0ec9c1b70c83df39
author | casties |
---|---|
date | Fri, 11 Dec 2015 12:09:37 -0500 |
parents | 2e911857a759 |
children |
line wrap: on
line source
package de.mpiwg.itgroup.dm2e; import java.util.List; import org.mpi.openmind.cache.WrapperService; import org.mpi.openmind.repository.bo.Entity; import org.openrdf.model.Model; import org.openrdf.model.URI; import org.openrdf.model.ValueFactory; import de.mpiwg.itgroup.ismi.utils.templates.WitnessTemplate; public class AddAgents { public static void execute(Model g, ValueFactory f, URI providedCHO, WitnessTemplate witness, WrapperService wrapper) throws Exception { List<Entity> list = wrapper.getTargetsForSourceRelation(witness.titleId, "was_created_by", "PERSON", 1); if(list.size() > 0){ Entity author = list.get(0); URI uriPerson = f.createURI("http://data.dm2e.eu/data/agent/mpiwg/" + NameSpaces.mpiwgCollection + "/" + author.getId()); g.add(f.createStatement(uriPerson, URIUtils.skosPrefLabel, f.createLiteral(author.getOwnValue()))); g.add(f.createStatement(uriPerson, URIUtils.rdfType, f.createURI("http://xmlns.com/foaf/0.1/Person"))); g.add(f.createStatement(providedCHO, URIUtils.proAuthor, uriPerson)); } //COPY_EVENT list = wrapper.getSourcesForTargetRelation(witness.id, "is_a_copy_of", "COPY_EVENT", -1); for(Entity copyEvent : list){ List<Entity> list0 = wrapper.getTargetsForSourceRelation(copyEvent.getId(), "has_person_copying_text", "PERSON", 1); if(list0.size() > 0){ Entity personCopyingText = list0.get(0); URI uriPerson = f.createURI("http://data.dm2e.eu/data/agent/mpiwg/" + NameSpaces.mpiwgCollection + "/" + personCopyingText.getId()); g.add(f.createStatement(uriPerson, URIUtils.skosPrefLabel, f.createLiteral(personCopyingText.getOwnValue()))); g.add(f.createStatement(uriPerson, URIUtils.rdfType, f.createURI("http://xmlns.com/foaf/0.1/Person"))); g.add(f.createStatement(providedCHO, URIUtils.dm2eCopyist, uriPerson)); } } } }