コード例 #1
0
ファイル: omia-integration.py プロジェクト: DoctorBud/dipper
def main():
    parser = argparse.ArgumentParser(
        description='OMIA integration test',
        formatter_class=argparse.RawTextHelpFormatter)

    parser.add_argument(
        '--input', '-i', type=str, required=True,
        help='Location of input ttl file')

    args = parser.parse_args()

    graph = ConjunctiveGraph()
    graph.parse(args.input, format=rdflib_util.guess_format(args.input))

    model_of = URIRef('http://purl.obolibrary.org/obo/RO_0003301')

    models = graph.subject_objects(model_of)
    model_len = len(list(models))

    if model_len < EXPECTED_PAIRS:
        logger.error("Not enough model_of predicates in graph:"
                     " {} expected {} check omia log for"
                     " warnings".format(model_len, EXPECTED_PAIRS))
        exit(1)

    omim_diseases = graph.objects(
        subject=URIRef('https://monarchinitiative.org/model/OMIA-breed:18'),
        predicate=model_of
    )

    if list(omim_diseases) != [URIRef('http://purl.obolibrary.org/obo/OMIM_275220')]:
        logger.error("Missing breed to omim triple for {}".format('OMIA-breed:18'))
        exit(1)
    
    logger.info("PASSED")
コード例 #2
0
ファイル: omia-integration.py プロジェクト: putmantime/dipper
def main():
    parser = argparse.ArgumentParser(
        description='OMIA integration test',
        formatter_class=argparse.RawTextHelpFormatter)

    parser.add_argument(
        '--input', '-i', type=str, required=True,
        help='Location of input ttl file')

    args = parser.parse_args()

    graph = ConjunctiveGraph()
    graph.parse(args.input, format=rdflib_util.guess_format(args.input))

    model_of = URIRef('http://purl.obolibrary.org/obo/RO_0003301')

    models = graph.subject_objects(model_of)
    model_len = len(list(models))

    if model_len < EXPECTED_PAIRS:
        logger.error("Not enough model_of predicates in graph:"
                     " {} expected {} check omia log for"
                     " warnings".format(model_len, EXPECTED_PAIRS))
        exit(1)
    else:
        logger.info("PASSED")
コード例 #3
0
ファイル: omia-integration.py プロジェクト: TomConlin/dipper
def main():
    parser = argparse.ArgumentParser(
        description='OMIA integration test',
        formatter_class=argparse.RawTextHelpFormatter)

    parser.add_argument(
        '--input', '-i', type=str, required=True, help='Location of input ttl file')

    args = parser.parse_args()

    graph = ConjunctiveGraph()
    graph.parse(args.input, format=rdflib_util.guess_format(args.input))

    # "is model of": "RO:0003301"
    # is_model_of = URIRef('OBO:RO_0003301')
    is_model_of = URIRef('http://purl.obolibrary.org/obo/RO_0003301')

    # if we curie_map & globaltt here we could ...
    # (pfx lcl) = globaltt["is model of"].split(':')
    # iri = curie_map[pfx] + '_'.join((pfx, lcl))
    # is_model_of = URIRef(iri)

    models = graph.subject_objects(is_model_of)
    model_len = len(set(list(models)))

    if model_len < EXPECTED_PAIRS:
        LOG.error(
            "Not enough <RO:is model of> predicates in graph: found {}, "
            "expected {} check omia log for warnings".format(
                model_len, EXPECTED_PAIRS))
        exit(1)
    # else:
    #    LOG.info(
    #        "Found {} model_of predicates in graph, expected at least: {}".format(
    #            model_len, EXPECTED_PAIRS))

    breed = 'https://monarchinitiative.org/model/OMIA-breed:758'
    disease = 'http://omim.org/entry/305100'

    omim_diseases = graph.objects(
        subject=URIRef(breed),
        predicate=is_model_of
    )

    if list(omim_diseases) != [URIRef(disease)]:
        LOG.error("Missing breed to omim triple for %s", breed)
        LOG.error(list(omim_diseases))
        exit(1)

    LOG.info("PASSED")
コード例 #4
0
def main():
    parser = argparse.ArgumentParser(
        description='OMIA integration test',
        formatter_class=argparse.RawTextHelpFormatter)

    parser.add_argument('--input',
                        '-i',
                        type=str,
                        required=True,
                        help='Location of input ttl file')

    args = parser.parse_args()

    graph = ConjunctiveGraph()
    graph.parse(args.input, format=rdflib_util.guess_format(args.input))

    # "is model of": "RO:0003301"
    # is_model_of = URIRef('OBO:RO_0003301')
    is_model_of = URIRef('http://purl.obolibrary.org/obo/RO_0003301')

    # if we curie_map & globaltt here we could ...
    # (pfx lcl) = globaltt["is model of"].split(':')
    # iri = curie_map[pfx] + '_'.join((pfx, lcl))
    # is_model_of = URIRef(iri)

    models = graph.subject_objects(is_model_of)
    model_len = len(set(list(models)))

    if model_len < EXPECTED_PAIRS:
        LOG.error("Not enough <RO:is model of> predicates in graph: found {}, "
                  "expected {} check omia log for warnings".format(
                      model_len, EXPECTED_PAIRS))
        exit(1)
    # else:
    #    LOG.info(
    #        "Found {} model_of predicates in graph, expected at least: {}".format(
    #            model_len, EXPECTED_PAIRS))

    breed = 'https://monarchinitiative.org/model/OMIA-breed:758'
    disease = 'http://omim.org/entry/305100'

    omim_diseases = graph.objects(subject=URIRef(breed), predicate=is_model_of)

    if list(omim_diseases) != [URIRef(disease)]:
        LOG.error("Missing breed to omim triple for %s", breed)
        LOG.error(list(omim_diseases))
        exit(1)

    LOG.info("PASSED")
コード例 #5
0
def main():
    parser = argparse.ArgumentParser(
        description='OMIA integration test',
        formatter_class=argparse.RawTextHelpFormatter)

    parser.add_argument('--input',
                        '-i',
                        type=str,
                        required=True,
                        help='Location of input ttl file')

    args = parser.parse_args()

    graph = ConjunctiveGraph()
    graph.parse(args.input, format=rdflib_util.guess_format(args.input))

    model_of = URIRef('http://purl.obolibrary.org/obo/RO_0003301')

    models = graph.subject_objects(model_of)
    model_len = len(list(models))

    if model_len < EXPECTED_PAIRS:
        logger.error("Not enough model_of predicates in graph:"
                     " {} expected {} check omia log for"
                     " warnings".format(model_len, EXPECTED_PAIRS))
        exit(1)

    omim_diseases = graph.objects(
        subject=URIRef('https://monarchinitiative.org/model/OMIA-breed:18'),
        predicate=model_of)

    if list(omim_diseases) != [
            URIRef('http://purl.obolibrary.org/obo/OMIM_275220')
    ]:
        logger.error(
            "Missing breed to omim triple for {}".format('OMIA-breed:18'))
        exit(1)

    logger.info("PASSED")
コード例 #6
0
ファイル: swap_primer.py プロジェクト: pavan046/pubsubsemhub
pprint(list(primer))

# just think .whatever((s, p, o))
# here we report on what we know

pprint(list(primer.subjects()))
pprint(list(primer.predicates()))
pprint(list(primer.objects()))

# and other things that make sense

# what do we know about pat?
pprint(list(primer.predicate_objects(myNS.pat)))

# who is what age?
pprint(list(primer.subject_objects(myNS.age)))

# Okay, so lets now work with a bigger
# dataset from the example, and start
# with a fresh new graph.

primer = ConjunctiveGraph()

# Lets start with a verbatim string straight from the primer text:

mySource = """


@prefix : <http://www.w3.org/2000/10/swap/Primer#>.
@prefix rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
コード例 #7
0
ファイル: swap_primer.py プロジェクト: SpazioDati/rdflib

# just think .whatever((s, p, o))
# here we report on what we know

pprint(list(primer.subjects()))
pprint(list(primer.predicates()))
pprint(list(primer.objects()))

# and other things that make sense

# what do we know about pat?
pprint(list(primer.predicate_objects(myNS.pat)))

# who is what age?
pprint(list(primer.subject_objects(myNS.age)))



# Okay, so lets now work with a bigger
# dataset from the example, and start
# with a fresh new graph.


primer = ConjunctiveGraph()


# Lets start with a verbatim string straight from the primer text:

mySource = """