source: web/IbidasAtomicServices2.py @ 265

Last change on this file since 265 was 265, checked in by jjbot, 11 years ago
File size: 1.6 KB
Line 
1from IbidasSimpleMessage import IbidasSimpleMessage
2
3class AtomicServices:
4    def __init__(self, cd):
5        self.cd = cd
6
7    def getAvailableSets(self):
8        msg = IbidasSimpleMessage()
9        sets = self.cd.set[:, ('set_id', 'name')]
10        msg.addSets(sets)
11        print msg.finalize()
12        return msg.finalize()
13
14    def getAvailableItemRelationTypes(self):
15        #FIXME: insert real query
16        msg = IbidasSimpleMessage()
17        types = self.cd.term[0:100]
18        msg.addTerms(types)
19        return msg.finalize()
20
21    def getAvailableItemTypes(self):
22        #FIXME: insert real query
23        msg = IbidasSimpleMessage()
24        types = self.cd.term[101:200]
25        msg.addTerms(types)
26        return msg.finalize()
27
28    def getItemChildren(self, items):
29        pass
30
31    def getItemParents(self, items):
32        pass
33
34    def getItemNeighbours(self, items):
35        pass
36
37    def getItemsByID(self, ids):
38        pass
39
40    def getItemrelationsByID(self, ids):
41        pass
42       
43    def getSetsByID(self, ids):
44        msg = IbidasSimpleMessage()
45        sets = self.cd.set[_.set_id.within(*ids)]
46        msg.addSets(sets)
47        return msg.finalize()
48
49    def getSetsByName(self, names):
50        msg = IbidasSimpleMessage()
51        sets = self.cd.set[_.name.within(*names)]
52        msg.addSets(sets)
53        return msg.finalize()
54
55    def getItemsBySourceID(self, sourceID):
56        msg = IbidasSimpleMessage()
57        items = self.cd.item[_.source_id==sourceID]
58        msg.addItems(items)
59
60    def testConnection(self):
61        return "It works!"
62
63    def testConnectionHash(self):
64        msg = {'message': 'It works!'}
65        return msg
Note: See TracBrowser for help on using the repository browser.