當前位置: 首頁>>代碼示例>>Python>>正文


Python KQMLList.sets方法代碼示例

本文整理匯總了Python中kqml.KQMLList.sets方法的典型用法代碼示例。如果您正苦於以下問題:Python KQMLList.sets方法的具體用法?Python KQMLList.sets怎麽用?Python KQMLList.sets使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在kqml.KQMLList的用法示例。


在下文中一共展示了KQMLList.sets方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: send_display_figure

# 需要導入模塊: from kqml import KQMLList [as 別名]
# 或者: from kqml.KQMLList import sets [as 別名]
 def send_display_figure(self, path):
     msg = KQMLPerformative('tell')
     content = KQMLList('display-image')
     content.set('type', 'simulation')
     content.sets('path', path)
     msg.set('content', content)
     self.send(msg)
開發者ID:bgyori,項目名稱:bioagents,代碼行數:9,代碼來源:tra_module.py

示例2: make_failure

# 需要導入模塊: from kqml import KQMLList [as 別名]
# 或者: from kqml.KQMLList import sets [as 別名]
 def make_failure(self, reason=None, description=None):
     msg = KQMLList('FAILURE')
     if reason:
         msg.set('reason', reason)
     if description:
         msg.sets('description', description)
     return msg
開發者ID:bgyori,項目名稱:bioagents,代碼行數:9,代碼來源:__init__.py

示例3: test_respond_choose_nonsense

# 需要導入模塊: from kqml import KQMLList [as 別名]
# 或者: from kqml.KQMLList import sets [as 別名]
def test_respond_choose_nonsense():
    bs = BioSense_Module(testing=True)
    msg_content = KQMLList('CHOOSE-SENSE')
    msg_content.sets('ekb-term', ekb_from_text('bagel'))
    res = bs.respond_choose_sense(msg_content)
    print(res)
    assert res.head() == 'SUCCESS'
    assert res.get('agents')[0].gets('ont-type') is None
開發者ID:bgyori,項目名稱:bioagents,代碼行數:10,代碼來源:biosense_test.py

示例4: _get_perf

# 需要導入模塊: from kqml import KQMLList [as 別名]
# 或者: from kqml.KQMLList import sets [as 別名]
def _get_perf(text, msg_id):
    """Return a request message for a given text."""
    msg = KQMLPerformative('REQUEST')
    msg.set('receiver', 'READER')
    content = KQMLList('run-text')
    content.sets('text', text)
    msg.set('content', content)
    msg.set('reply-with', msg_id)
    return msg
開發者ID:johnbachman,項目名稱:indra,代碼行數:11,代碼來源:drum_reader.py

示例5: send_null_provenance

# 需要導入模塊: from kqml import KQMLList [as 別名]
# 或者: from kqml.KQMLList import sets [as 別名]
 def send_null_provenance(self, stmt, for_what, reason=''):
     """Send out that no provenance could be found for a given Statement."""
     content_fmt = ('<h4>No supporting evidence found for {statement} from '
                    '{cause}{reason}.</h4>')
     content = KQMLList('add-provenance')
     stmt_txt = EnglishAssembler([stmt]).make_model()
     content.sets('html', content_fmt.format(statement=stmt_txt,
                                             cause=for_what, reason=reason))
     return self.tell(content)
開發者ID:bgyori,項目名稱:bioagents,代碼行數:11,代碼來源:__init__.py

示例6: _get_drug_kqml

# 需要導入模塊: from kqml import KQMLList [as 別名]
# 或者: from kqml.KQMLList import sets [as 別名]
 def _get_drug_kqml(drug_list):
     drugs = KQMLList()
     for dn, pci in drug_list:
         drug = KQMLList()
         drug.sets('name', dn.replace(' ', '-'))
         if pci:
             drug.sets('pubchem_id', pci)
         drugs.append(drug)
     return drugs
開發者ID:bgyori,項目名稱:bioagents,代碼行數:11,代碼來源:dtda_module.py

示例7: test_respond_get_synonyms

# 需要導入模塊: from kqml import KQMLList [as 別名]
# 或者: from kqml.KQMLList import sets [as 別名]
def test_respond_get_synonyms():
    bs = BioSense_Module(testing=True)
    msg_content = KQMLList('GET-SYNONYMS')
    msg_content.sets('entity', mek1_ekb)
    res = bs.respond_get_synonyms(msg_content)
    assert res.head() == 'SUCCESS'
    syns = res.get('synonyms')
    syn_strs = [s.gets(':name') for s in syns]
    assert 'MAP2K1' in syn_strs
    assert 'MEK1' in syn_strs
    assert 'MKK1' in syn_strs
開發者ID:bgyori,項目名稱:bioagents,代碼行數:13,代碼來源:biosense_test.py

示例8: test_respond_choose_sense_is_member

# 需要導入模塊: from kqml import KQMLList [as 別名]
# 或者: from kqml.KQMLList import sets [as 別名]
def test_respond_choose_sense_is_member():
    bs = BioSense_Module(testing=True)
    msg_content = KQMLList('CHOOSE-SENSE-IS-MEMBER')
    msg_content.sets('ekb-term', mek1_ekb)
    msg_content.sets('collection', mek_ekb)
    print(msg_content)
    res = bs.respond_choose_sense_is_member(msg_content)
    print(res)
    print(res.head())
    assert(res.head() == 'SUCCESS')
    assert(res.get('is-member') == 'TRUE')
開發者ID:bgyori,項目名稱:bioagents,代碼行數:13,代碼來源:biosense_test.py

示例9: report_paths_graph

# 需要導入模塊: from kqml import KQMLList [as 別名]
# 或者: from kqml.KQMLList import sets [as 別名]
 def report_paths_graph(self, paths_list):
     from indra.assemblers.graph import GraphAssembler
     from indra.util import flatten
     path_stmts = [stmts_from_json(l) for l in paths_list]
     all_stmts = flatten(path_stmts)
     ga = GraphAssembler(all_stmts)
     ga.make_model()
     resource = get_img_path('qca_paths.png')
     ga.save_pdf(resource)
     content = KQMLList('display-image')
     content.set('type', 'simulation')
     content.sets('path', resource)
     self.tell(content)
開發者ID:bgyori,項目名稱:bioagents,代碼行數:15,代碼來源:qca_module.py

示例10: test_respond_choose_sense

# 需要導入模塊: from kqml import KQMLList [as 別名]
# 或者: from kqml.KQMLList import sets [as 別名]
def test_respond_choose_sense():
    bs = BioSense_Module(testing=True)
    msg_content = KQMLList('CHOOSE-SENSE')
    msg_content.sets('ekb-term', mek1_ekb)
    res = bs.respond_choose_sense(msg_content)
    print(res)
    agents = res.get('agents')
    assert agents and agents.data
    agent = agents[0]
    name = agent.gets('name')
    assert name == 'MAP2K1'
    ont_type = agent.get('ont-type')
    assert ont_type == 'ONT::GENE'
開發者ID:bgyori,項目名稱:bioagents,代碼行數:15,代碼來源:biosense_test.py

示例11: send_display_model

# 需要導入模塊: from kqml import KQMLList [as 別名]
# 或者: from kqml.KQMLList import sets [as 別名]
 def send_display_model(self, diagrams):
     for diagram_type, resource in diagrams.items():
         if not resource:
             continue
         if diagram_type == 'sbgn':
             content = KQMLList('display-sbgn')
             content.set('type', diagram_type)
             content.sets('graph', resource)
         else:
             content = KQMLList('display-image')
             content.set('type', diagram_type)
             content.sets('path', resource)
         self.tell(content)
開發者ID:bgyori,項目名稱:bioagents,代碼行數:15,代碼來源:mra_module.py

示例12: respond_describe_model

# 需要導入模塊: from kqml import KQMLList [as 別名]
# 或者: from kqml.KQMLList import sets [as 別名]
    def respond_describe_model(self, content):
        """Convert the model to natural language."""
        # Get the model.
        model_id = self._get_model_id(content)
        model = self.mra.get_model_by_id(model_id)

        # Turn the model into a text description.
        english_assembler = EnglishAssembler(model)
        desc = english_assembler.make_model()

        # Respond to the BA.
        resp = KQMLList('SUCCESS')
        resp.sets('description', desc)
        return resp
開發者ID:bgyori,項目名稱:bioagents,代碼行數:16,代碼來源:mra_module.py

示例13: respond_model_get_json

# 需要導入模塊: from kqml import KQMLList [as 別名]
# 或者: from kqml.KQMLList import sets [as 別名]
 def respond_model_get_json(self, content):
     """Return response content to model-get-json request."""
     try:
         model_id = self._get_model_id(content)
     except Exception:
         model_id = None
     model = self.mra.get_model_by_id(model_id)
     if model is not None:
         model_msg = encode_indra_stmts(model)
         reply = KQMLList('SUCCESS')
         reply.sets('model', model_msg)
     else:
         reply = self.make_failure('MISSING_MODEL')
     return reply
開發者ID:bgyori,項目名稱:bioagents,代碼行數:16,代碼來源:mra_module.py

示例14: get_ambiguities_msg

# 需要導入模塊: from kqml import KQMLList [as 別名]
# 或者: from kqml.KQMLList import sets [as 別名]
def get_ambiguities_msg(ambiguities):
    sa = []
    for term_id, ambiguity in ambiguities.items():
        msg = KQMLList(term_id)

        pr = ambiguity[0]['preferred']
        pr_dbids = '|'.join([':'.join((k, v)) for
                             k, v in pr['refs'].items()])
        term = KQMLList('term')
        term.set('ont-type', pr['type'])
        term.sets('ids', pr_dbids)
        term.sets('name', pr['name'])
        msg.set('preferred', term)

        alt = ambiguity[0]['alternative']
        alt_dbids = '|'.join([':'.join((k, v)) for
                              k, v in alt['refs'].items()])
        term = KQMLList('term')
        term.set('ont-type', alt['type'])
        term.sets('ids', alt_dbids)
        term.sets('name', alt['name'])
        msg.set('alternative', term)

        sa.append(msg)

    ambiguities_msg = KQMLList(sa)
    return ambiguities_msg
開發者ID:bgyori,項目名稱:bioagents,代碼行數:29,代碼來源:biosense_module.py

示例15: test_respond_choose_sense_what_member

# 需要導入模塊: from kqml import KQMLList [as 別名]
# 或者: from kqml.KQMLList import sets [as 別名]
def test_respond_choose_sense_what_member():
    bs = BioSense_Module(testing=True)
    msg_content = KQMLList('CHOOSE-SENSE-WHAT-MEMBER')
    msg_content.sets('collection', mek_ekb)
    print(msg_content)
    res = bs.respond_choose_sense_what_member(msg_content)
    print(res)
    print(res.head())
    assert(res.head() == 'SUCCESS')
    assert(len(res.get('members')) == 2)
    m1 = res.get('members')[0]
    m2 = res.get('members')[1]
    assert m1.gets('name') == 'MAP2K1', m1.gets('name')
    assert m2.gets('name') == 'MAP2K2', m2.gets('name')
開發者ID:bgyori,項目名稱:bioagents,代碼行數:16,代碼來源:biosense_test.py


注:本文中的kqml.KQMLList.sets方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。