コード例 #1
0
#! /usr/bin/env python
# Experiment Navigator user interaction script
# Julia Daniel, Akhila Moturu, Eric Cramer, and Gaby Steiner
# Final project for CS 270 / BMI 210, Winter 2018
# ----------------------------------------------------------

import ontology as o
import sys

if __name__ == "__main__":
    print("* ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ *")
    print("Welcome to the Experiment Navigator!")
    print("Loading our cutting-edge experiment ontology...")
    ont = o.build_ontology()
    print("...done!")
    print(
        "The Experiment Navigator is your tool to help find the right experiment for you, given a hypothesis you'd like to test."
    )
    print("Please enter your hypothesis here, in your own words:")
    hypothesis = input(" > ")
    # print(hypothesis)
    print(
        "Great! In order to determine which experiment(s) you should conduct to test this hypothesis, we need to know more about the substances and information involved."
    )
    molecule = input("What type of molecule are you working with? ")
    if molecule.lower() == "protein":
        typeprotein = input(
            "What do you want to learn about the protein? Please type one of the following: location, structure, interaction, quantification, detection. "
        )
        #DONE WITH LOCATION
        if typeprotein.lower() == "location":
コード例 #2
0
        res = g.query("select (COUNT(?a) as ?CNT) where {?a <" + PREFIX + '/' +
                      relation + "> ?s .}")
        output = str(list(res)[0][0])

    elif q_number == 11:
        res = g.query("select (COUNT(?s) as ?CNT) where {?s <" + PREFIX + '/' +
                      relation + "> <" + PREFIX + '/' + entity + "> .}")
        output = str(list(res)[0][0])

    elif q_number == 12:
        res = g.query("select (COUNT(?s) as ?CNT) where {?s <"+PREFIX +'/'+ relation + "> <"+PREFIX +'/'+entity+ "> ." \
                            "?s <"+PREFIX +'/'+ relation + "> <"+PREFIX +'/'+entity2+ "> .}"
                         )
        output = str(list(res)[0][0])

    else:
        output = None
    print(output)


if __name__ == "__main__":

    input = sys.argv[1]
    if input == 'question':

        q_number, relation, entity, entity2 = extract_q_info(sys.argv[2])
        query(q_number, relation, entity, entity2)

    elif input == 'create':
        build_ontology()