from pathlib import Path import rdflib from pyontutils.core import Ont, OntGraph from pyontutils.config import auth from pyontutils.sheets import Sheet from pyontutils.namespaces import owl, rdf, rdfs, ilxtr, NIFRID, OntCuries, skos, makeNamespaces from neurondm import OntTerm, OntId from neurondm.models.allen_cell_types import AllenCellTypes from neurondm.core import log log = log.getChild('indicators') OntCuries(AllenCellTypes.prefixes) # FIXME BAD OntCuries({'TEMPIND': 'http://uri.interlex.org/temp/uris/phenotype-indicators/'}) NIFRAW, NIFTTL = makeNamespaces('NIFRAW', 'NIFTTL') a = rdf.type # TODO the proper way to do this in the future will be to write a populateIndicators # for Neuron and Phenotype class PhenotypeIndicators(Sheet): name = 'phenotype-indicators' sheet_name = 'indicators' @property def things(self): def process(k, v): if ',' in v:
#!/usr/bin/env python3 import rdflib import ontquery from neurondm.lang import * from neurondm import * from pyontutils.core import OntId, OntTerm from pyontutils.utils import relative_path from pyontutils.namespaces import makePrefixes, makeNamespaces, OntCuries from pyontutils.namespaces import interlex_namespace, PREFIXES from pyontutils.namespaces import NIFRID, ilxtr, hasRole, definition from pyontutils.namespaces import rdf, rdfs, owl from pyontutils.combinators import restriction swanr = rdflib.Namespace(interlex_namespace('swanson/uris/readable/')) NIFRAW, = makeNamespaces('NIFRAW') config = Config( 'basic-neurons', prefixes={ 'swanr': swanr, 'SWAN': interlex_namespace('swanson/uris/neuroanatomical-terminology/terms/'), 'SWAA': interlex_namespace( 'swanson/uris/neuroanatomical-terminology/appendix/'), }, source_file=relative_path(__file__)) class NeuronSWAN(NeuronEBM): owlClass = ilxtr.NeuronSWAN
if def_: yield from olit(subject, definition, def_) if synonyms: if not isinstance(synonyms, tuple): # this is why python sucks and racket is awesome if this was racket # the error would show up on the line where the problem was :/ raise TypeError( f'Type of {synonyms!r} should not be {type(synonyms)}!') yield from olit(subject, NIFRID.synonym, *synonyms) if comment: yield from olit(subject, rdfs.comment, comment) obo, RO, prov, *_ = makeNamespaces('obo', 'RO', 'prov') filename = 'methods-core' prefixes = None OntCuries['HBP_MEM'] = 'http://www.hbp.FIXME.org/hbp_measurement_methods/' imports = NIFTTL['nif_backend.ttl'], #imports = obo['bfo.owl'], obo['ro.owl'] #imports = tuple() comment = 'The core components for modelling techniques and methods.' branch = 'methods' _repo = True debug = True triples = ( # data properties odp(ilxtr.hasAspectValue), odp(ilxtr.hasConstrainingAspect_value,
from datetime import datetime from getpass import getuser from collections import OrderedDict import rdflib from docopt import docopt from pyontutils.core import OntId from pyontutils.utils import makeSimpleLogger from pyontutils.qnamefix import cull_prefixes from pyontutils.namespaces import makeNamespaces, NIFRID, definition from pyontutils.namespaces import TEMP, PREFIXES as uPREFIXES from pyontutils.closed_namespaces import rdf, rdfs, owl, oboInOwl from IPython import embed log = makeSimpleLogger('obo-io') fobo, obo, NIFSTD, NOPE = makeNamespaces('fobo', 'obo', 'NIFSTD', '') N = -1 # use to define 'many ' for tag counts TW = 4 # tab width class od(OrderedDict): pass od.__repr__ = dict.__repr__ # this is our current (horrible) conversion from obo to ttl obo_tag_to_ttl = { #'id': (lambda s, p: rdflib.URIRef(s), rdf.type, owl.Class), '%s rdf:type owl:Class ;\n', 'name': rdfs.label,