Beispiel #1
0
    def setup(self, **kwargs):

        self.sgv = scigraph.Vocabulary(cache=self.cache,
                                       verbose=self.verbose,
                                       basePath=self.apiEndpoint,
                                       safe_cache=True)
        self.sgg = scigraph.Graph(cache=self.cache,
                                  verbose=self.verbose,
                                  basePath=self.apiEndpoint)
        self.sgc = scigraph.Cypher(cache=self.cache,
                                   verbose=self.verbose,
                                   basePath=self.apiEndpoint)
        self.sgd = scigraph.Dynamic(cache=self.cache,
                                    verbose=self.verbose,
                                    basePath=self.apiEndpoint)
        self.curies = type('LocalCuries', (oq.OntCuries, ), {})
        self._remote_curies = type('RemoteCuries', (oq.OntCuries.new(), ), {})
        curies = self.sgc.getCuries()
        self.curies(curies)  # TODO can be used to provide curies...
        self._remote_curies(curies)
        self.prefixes = sorted(self.curies)
        self.search_prefixes = [
            p for p in sorted(self._remote_curies) if p != 'SCR'
        ]
        self.categories = self.sgv.getCategories()
        self._predicates = sorted(set(self.sgg.getRelationships()))
        #self._onts = sorted(o['n']['iri'] for o in self.sgc.execute('MATCH (n:Ontology) RETURN n', 1000, 'application/json'))  # only on newer versions, update when we switch production over
        self._onts = sorted(o['iri'] for o in self.sgc.execute(
            'MATCH (n:Ontology) RETURN n', 1000, 'text/plain'))
        super().setup(**kwargs)
Beispiel #2
0
                                    creatTree,
                                    dematerialize,
                                    flatten as flatten_tree)
from pyontutils.namespaces import rdfs, OntCuries
from pyontutils.scigraph_codegen import moduleDirect
from nifstd_tools.sheets_sparc import (hyperlink_tree,
                                       tag_row,
                                       open_custom_sparc_view_yml,
                                       YML_DELIMITER)
from nifstd_tools.simplify import simplify, cleanBad
from nifstd_tools import __version__

log = makeSimpleLogger('ontree')

# FIXME these will go to network which is :/
sgg = scigraph.Graph(cache=False, verbose=True)
sgv = scigraph.Vocabulary(cache=False, verbose=True)
sgc = scigraph.Cypher(cache=False, verbose=True)
sgd = scigraph.Dynamic(cache=False, verbose=True)

# This was for ttl creation extension for sparc view
# ixr.setup(instrumented=OntTerm)

a = 'rdfs:subClassOf'
_hpp = 'RO_OLD:has_proper_part'  # and apparently this fails too
hpp = 'http://www.obofoundry.org/ro/ro.owl#has_proper_part'
hpp = 'NIFRID:has_proper_part'
po = 'BFO:0000050'  # how?! WHY does this fail!? the curie is there!
_po = 'http://purl.obolibrary.org/obo/BFO_0000050'
hr = 'RO:0000087'
_hr = 'http://purl.obolibrary.org/obo/RO_0000087'