01: /*
02: * Copyright (C) 2007 <A href="http://www-ist.massey.ac.nz/JBDietrich" target="_top">Jens Dietrich</a>
03: *
04: * This library is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU Lesser General Public
06: * License as published by the Free Software Foundation; either
07: * version 2 of the License, or (at your option) any later version.
08: *
09: * This library is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12: * Lesser General Public License for more details.
13: *
14: * You should have received a copy of the GNU Lesser General Public
15: * License along with this library; if not, write to the Free Software
16: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17: */
18:
19: package example.nz.org.take.r2ml.eurent;
20:
21: import java.util.List;
22: import java.util.Map;
23:
24: import example.nz.org.take.r2ml.eurent.domain.Branch;
25: import example.nz.org.take.r2ml.eurent.domain.Rental;
26: import example.nz.org.take.r2ml.eurent.domain.RentalCar;
27: import example.nz.org.take.r2ml.eurent.generated.EURentKB;
28: import example.nz.org.take.r2ml.eurent.generated.availableAt;
29:
30: import nz.org.take.rt.DerivationLogEntry;
31: import nz.org.take.rt.ResultSet;
32:
33: /**
34: * Sample script used to query the generated classes.
35: *
36: * @author <a href="http://www-ist.massey.ac.nz/JBDietrich/">Jens Dietrich</a>
37: */
38:
39: public class Sample {
40:
41: /**
42: * @param args
43: */
44: public static void main(String[] args) {
45: RentalCar c = new RentalCar();
46: c.setPlateNumber("No42");
47: Branch b = new Branch();
48: b.setName("Palmerston North");
49: Rental r = new Rental();
50: c.setRentalCarScheduledForService(false);
51: c.setStoredAt(b);
52: c.setAssignedTo(null);
53: EURentKB kb = new EURentKB();
54: ResultSet<availableAt> rs = kb.availableAt_10(c);
55: availableAt result = rs.next();
56: System.out.println(result.branch.getName());
57:
58: List<DerivationLogEntry> log = rs.getDerivationLog();
59: for (DerivationLogEntry entry : log) {
60: System.out.println(entry.getCategory() + ": "
61: + entry.getName());
62: }
63: Map<String, String> annotations = kb.getAnnotations();
64: if (annotations != null) {
65: System.out.println(annotations.get("dc:date"));
66: System.out.println(annotations.get("dc:creator"));
67: }
68:
69: }
70:
71: }
|