Mercurial > hg > openmind
view src/main/java/org/mpi/openmind/scripts/FloruitDate.java @ 112:933d17f95016
new script MigratePrimeAliases to migrate is_prime_alias_X_of.
author | Robert Casties <casties@mpiwg-berlin.mpg.de> |
---|---|
date | Wed, 14 Aug 2019 20:48:02 +0200 |
parents | 615d27dce9b3 |
children |
line wrap: on
line source
package org.mpi.openmind.scripts; import org.mpi.openmind.cache.WrapperService; import org.mpi.openmind.repository.bo.Attribute; import org.mpi.openmind.repository.bo.Entity; import org.mpi.openmind.repository.bo.Node; import org.mpi.openmind.repository.bo.Relation; import org.mpi.openmind.repository.services.ServiceRegistry; public class FloruitDate { private static String FLORUIT_DATE = "FLORUIT_DATE"; private static String userName = "floruit-script"; public static void execute(){ System.out.println("*** FloruitDate ***"); ServiceRegistry services = new ServiceRegistry(); createDataModel(services.getWrapper()); System.out.println("&&&&&&&&&&&&&&&&&&&"); } private static void createDataModel(WrapperService ontology){ try { Entity floruitDate = new Entity(Node.TYPE_TBOX, Node.TYPE_TBOX, false); floruitDate.setOwnValue(FLORUIT_DATE); floruitDate = ontology.saveLWDefinition(floruitDate, userName); Attribute attName = new Attribute(Node.TYPE_TBOX, "date", "date"); attName.setSourceId(floruitDate.getId()); attName.setSourceObjectClass(Node.TYPE_TBOX); attName.setSourceModif(floruitDate.getModificationTime()); attName.setSystemStatus(Node.SYS_STATUS_CURRENT_VERSION); ontology.saveDefAttribute(attName, userName); //**** Entity person = ontology.getDefinition("PERSON"); Relation rel = new Relation(person, floruitDate, "has_floruit_date"); ontology.saveDefRelation(rel, userName); } catch (Exception e) { e.printStackTrace(); } } public static void main(String[] args){ FloruitDate.execute(); System.exit(0); } }