various changes (not anything like an app yet)
[nltk_ontology_framework.git] / src / nltk_x / ontology / frame.py
blob89e379f29cd96c8f352081abf66b6f6a6ca92345
1 # This Python file uses the following encoding: utf-8
2 '''
3 Created on Apr 29, 2011
5 @author: mjacob
6 '''
8 import yaml
10 class framework(object):
11 TERMS="terms"
12 SYNONYMS="synonyms"
13 CONCEPTS="concepts"
14 CONCEPT_HIERARCHIES="concept_hierarchies"
15 RELATIONS="relations"
17 def __init__(self):
18 pass
20 def _do_step(self, step):
21 return step in self.__do_steps
23 def write_state(self, state, filename):
24 with open(filename, 'w') as fh:
25 fh.write(yaml.dump(state))
27 def read_state(self, filename):
28 with open(filename, 'w') as fh:
29 return yaml.load(fh.read())
31 def process(self, only_do=None, **additional_state):
32 state = self._get_initial_state(**additional_state)
34 if self._do_step(framework.TERMS) and not (only_do and not framework.TERMS in only_do):
35 state[framework.TERMS] = self._get_terms(**state)
37 if self._do_step(framework.SYNONYMS) and not (only_do and not framework.SYNONYMS in only_do):
38 state[framework.SYNONYMS] = self._get_synonyms(**state)
40 if self._do_step(framework.CONCEPTS) and not (only_do and not framework.CONCEPTS in only_do):
41 state[framework.CONCEPTS] = self._get_concepts(**state)
43 if self._do_step(framework.CONCEPT_HIERARCHIES) and not (only_do and not framework.CONCEPT_HIERARCHIES in only_do):
44 state[framework.CONCEPT_HIERARCHIES] = self._get_concept_hierarchies(**state)
46 if self._do_step(framework.RELATIONS) and not (only_do and not framework.RELATIONS in only_do):
47 state[framework.RELATIONS] = self._get_relations(**state)
49 return state
51 class terms(object):
52 def _get_terms(self, **state):
53 pass
55 class synonyms(object):
56 def _get_synonyms(self, **state):
57 pass
59 class concepts(object):
60 def _get_concepts(self, **state):
61 pass
63 def concept_hierarchies(object):
64 def _get_concept_hierarchies(self, **state):
65 pass
67 def relations(object):
68 def _get_relations(self, **state):
69 pass