Beispiel #1
0
    def test_ttl_simple(self):
        # this fails when
        # test_integration.py is run
        # AND
        # test_roundtrip_py is run
        # but NOT when either is run independently
        from neurondm import Config, Neuron, Phenotype, NegPhenotype

        config = Config('test-ttl', ttl_export_dir=tel, py_export_dir=pyel)
        Neuron(Phenotype('TEMP:turtle-phenotype'))
        Neuron(NegPhenotype('TEMP:turtle-phenotype'))
        config.write()
        a = config.neurons()

        config2 = Config('test-ttl', ttl_export_dir=tel, py_export_dir=pyel)
        config2.load_existing()
        config2.write_python()
        b = config2.neurons()

        config3 = Config('test-ttl', ttl_export_dir=tel, py_export_dir=pyel)
        config3.load_python()
        c = config3.neurons()

        print(a, b, c)
        assert config.existing_pes is not config2.existing_pes is not config3.existing_pes
        assert a == b == c
Beispiel #2
0
def main():
    from pyontutils.utils import relative_path
    config = Config('keast-2020',
                    source_file=relative_path(__file__, no_wd_value=__file__))
    with Keast2020:
        needs_keast_namespace()

    config.write()
    config.write_python()
    return config
Beispiel #3
0
    def test_py_simple(self):
        from neurondm import Config, Neuron, Phenotype, NegPhenotype

        config = Config('test-py', ttl_export_dir=tel, py_export_dir=pyel)
        n1 = Neuron(Phenotype('TEMP:python-phenotype'))
        n2 = Neuron(NegPhenotype('TEMP:python-phenotype'))
        assert n1 != n2
        config.write_python()

        config2 = Config('test-py', ttl_export_dir=tel, py_export_dir=pyel)
        config2.load_python()  # FIXME load existing python ...
        config2.write()

        config3 = Config('test-py', ttl_export_dir=tel, py_export_dir=pyel)
        config3.load_existing()

        assert config.existing_pes is not config2.existing_pes is not config3.existing_pes
        assert config.neurons() == config2.neurons() == config3.neurons()
Beispiel #4
0
def main():
    from pyontutils.utils import relative_path
    config = Config('keast-2020',
                    source_file=relative_path(__file__, no_wd_value=__file__))

    with Keast2020:
        needs_keast_namespace(config)

    config.write()
    labels = (
        rdfs.label,
        #ilxtr.genLabel, ilxtr.localLabel, ilxtr.simpleLabel,
        #ilxtr.simpleLocalLabel, skos.prefLabel
    )
    to_remove = [t for t in config._written_graph
                 if t[1] in labels and '/neuron-type-keast-' in t[0]]
    [config._written_graph.remove(t) for t in to_remove]
    config._written_graph.write()
    config.write_python()
    return config,