1
|
1 package org.mpi.openmind.scripts;
|
|
2
|
|
3 import org.mpi.openmind.cache.WrapperService;
|
|
4 import org.mpi.openmind.repository.bo.Attribute;
|
|
5 import org.mpi.openmind.repository.bo.Entity;
|
|
6 import org.mpi.openmind.repository.bo.Node;
|
|
7 import org.mpi.openmind.repository.bo.Relation;
|
|
8 import org.mpi.openmind.repository.services.ServiceRegistry;
|
|
9
|
|
10 public class FloruitDate {
|
|
11
|
|
12 private static String FLORUIT_DATE = "FLORUIT_DATE";
|
|
13 private static String userName = "floruit-script";
|
|
14
|
|
15 public static void execute(){
|
|
16 System.out.println("*** FloruitDate ***");
|
|
17 ServiceRegistry services = new ServiceRegistry();
|
|
18 createDataModel(services.getWrapper());
|
|
19 System.out.println("&&&&&&&&&&&&&&&&&&&");
|
|
20 }
|
|
21
|
|
22 private static void createDataModel(WrapperService ontology){
|
|
23 try {
|
|
24 Entity floruitDate = new Entity(Node.TYPE_TBOX, Node.TYPE_TBOX, false);
|
|
25 floruitDate.setOwnValue(FLORUIT_DATE);
|
|
26
|
|
27 floruitDate = ontology.saveLWDefinition(floruitDate, userName);
|
|
28
|
|
29
|
|
30 Attribute attName = new Attribute(Node.TYPE_TBOX, "date", "date");
|
|
31 attName.setSourceId(floruitDate.getId());
|
|
32 attName.setSourceObjectClass(Node.TYPE_TBOX);
|
|
33 attName.setSourceModif(floruitDate.getModificationTime());
|
|
34 attName.setSystemStatus(Node.SYS_STATUS_CURRENT_VERSION);
|
|
35
|
|
36 ontology.saveDefAttribute(attName, userName);
|
|
37
|
|
38 //****
|
|
39 Entity person = ontology.getDefinition("PERSON");
|
|
40 Relation rel = new Relation(person, floruitDate, "has_floruit_date");
|
|
41 ontology.saveDefRelation(rel, userName);
|
|
42
|
|
43 } catch (Exception e) {
|
|
44 e.printStackTrace();
|
|
45 }
|
|
46 }
|
|
47
|
|
48 public static void main(String[] args){
|
|
49 FloruitDate.execute();
|
|
50 System.exit(0);
|
|
51 }
|
|
52
|
|
53 }
|