コード例 #1
0
 def setUp(self):
     ontquery.OntCuries(core.PREFIXES)
     #self.query = OntQuery(localonts, remoteonts1, remoteonts2)  # provide by default maybe as ontquery?
     #bs = ontquery.BasicService()  # TODO
     #self.query = ontquery.OntQuery(bs, upstream=OntTerm)
     if 'SCICRUNCH_API_KEY' in os.environ:
         self.query = ontquery.OntQuery(
             ontquery.SciGraphRemote(api_key=core.get_api_key()),
             upstream=OntTerm)
     else:
         self.query = ontquery.OntQuery(ontquery.SciGraphRemote(
             apiEndpoint='http://localhost:9000/scigraph'),
                                        upstream=OntTerm)
コード例 #2
0
    def setup(self, **kwargs):
        oq.OntCuries({'TMP': 'http://uri.interlex.org/base/tmp_'})

        if self.apiEndpoint is not None:
            try:
                self.ilx_cli = InterLexClient(base_url=self.apiEndpoint)
            except exc.NoApiKeyError:
                if not self.readonly:
                    # expect attribute errors for ilx_cli
                    log.warning(
                        'You have not set an API key for the SciCrunch API! '
                        'InterLexRemote will error if you try to use it.')

        super().setup(**kwargs)
コード例 #3
0
ファイル: test_all.py プロジェクト: tmsincomb/ontquery
    def setUp(self):
        #self.query = oq.OntQuery(localonts, remoteonts1, remoteonts2)  # provide by default maybe as oq?
        #bs = oq.BasicService()  # TODO
        #self.query = oq.OntQuery(bs, upstream=OntTerm)
        #oq.QueryResult._OntTerm = OntTerm
        SCR = oq.plugin.get('SciCrunch')()
        services = SCR,
        # this was an ok idea, but better to also have known good local prefixes
        # probably need to clean up an clarify the bad old
        #services[0].setup()  # explicit call to setup so we can populate OntCuries
        #oq.OntCuries(services[0].curies)
        oq.OntCuries(CURIE_MAP)

        self.query = oq.OntQueryCli(*services, instrumented=OntTerm)
        oq.OntTerm.query_init(*services)
コード例 #4
0
oq.utils.log.setLevel('DEBUG')
log = oq.utils.log.getChild('test')

try:
    from pyontutils.namespaces import PREFIXES as CURIE_MAP
    from pyontutils import scigraph
except ModuleNotFoundError:
    from ontquery.plugins.services import scigraph_client as scigraph
    from ontquery.plugins.namespaces.nifstd import CURIE_MAP

SKIP_NETWORK = ('SKIP_NETWORK' in os.environ or 'FEATURES' in os.environ
                and 'network-sandbox' in os.environ['FEATURES'])
skipif_no_net = pytest.mark.skipif(
    SKIP_NETWORK, reason='Skipping due to network requirement')

oq.OntCuries(CURIE_MAP)

suffixes = (
    '',
    'hello',
    'world',
    'ev:il',
    '1234567',
    '1232/123123/asdfasdf',
    'lol_this#is/even-worse/_/123',
)

test_graph = rdflib.Graph()
triples = (
    ('UBERON:0000955', 'rdf:type', 'owl:Class'),
    ('UBERON:0000955', 'rdfs:label', 'brain'),
コード例 #5
0
import os
import unittest
from uuid import uuid4
import pytest
import rdflib
import ontquery as oq
from .common import test_graph, skipif_no_net, log
from .test_interlex_client import skipif_no_api_key

# FIXME TODO per service ... + mismatch warning
oq.OntCuries({
    'rdf': str(rdflib.RDF),
    'rdfs': str(rdflib.RDFS),
    'owl': str(rdflib.OWL),
    'BFO': 'http://purl.obolibrary.org/obo/BFO_',
    'UBERON': 'http://purl.obolibrary.org/obo/UBERON_',
    'NLX': 'http://uri.neuinfo.org/nif/nifstd/nlx_',
    'BIRNLEX': 'http://uri.neuinfo.org/nif/nifstd/birnlex_',
    'ILX': 'http://uri.interlex.org/base/ilx_',
    'RO': 'http://purl.obolibrary.org/obo/RO_',
    'hasRole': 'http://purl.obolibrary.org/obo/RO_0000087',
})
oq.OntCuries({
    'hasPart': oq.OntId('BFO:0000051'),
    'partOf': oq.OntId('BFO:0000050'),
})
OntId = oq.OntId


class ServiceBase:
    def setUp(self):
        class OntTerm(oq.OntTerm):
コード例 #6
0
 def setUp(self):
     oq.OntCuries(common.CURIE_MAP)