Ejemplo n.º 1
0
def get_journals():
    # Let's try to match on ORCIDs
    query = ("PREFIX vivo: <" + VIVO + "> "
             "PREFIX bibo: <" + BIBO + "> "
             "SELECT ?journal ?issn ?eissn "
             "WHERE {{ "
             "?journal a bibo:Journal . } "
             "UNION {?journal a bibo:Journal . "
             "?journal bibo:issn ?issn . } "
             "UNION {?journal a bibo:Journal . "
             "?journal bibo:eissn ?eissn . } "
             "} ")

    bindings = vivo_api_query(query)
    journals = {}
    if bindings:
        for rec in bindings:
            if 'journal' in rec:
                uri = rec['journal']['value']
                if 'issn' in rec:
                    issn = rec['issn']['value']
                    journals[issn] = uri
                if 'eissn' in rec:
                    eissn = rec['eissn']['value']
                    journals[eissn] = uri
    log.debug(journals)
    return journals
Ejemplo n.º 2
0
def get_people():
    # Let's try to match on ORCIDs
    query = ("PREFIX vivo: <" + VIVO + "> "
             "PREFIX foaf: <" + FOAF + "> "
             "PREFIX pub: <" + PUB + "> "
             "SELECT ?per ?orcid "
             "WHERE { "
             "{ ?per a foaf:Person . "
             "?per vivo:orcidId ?orcid . } "
             "UNION { ?per a foaf:Person . "
             "?per pub:publonsId ?orcid . } "
             "} ")

    bindings = vivo_api_query(query)
    people = {}
    if bindings:
        for rec in bindings:
            if 'per' and 'orcid' in rec:
                uri = rec['per']['value']
                orcid = rec['orcid']['value'].replace(
                    'http://orcid.org/',
                    '').replace('https://orcid.org/',
                                '').replace('https://publons.com/a/',
                                            '').replace('/', '')
                people[orcid] = uri
    log.debug(people)
    return people
def get_techniques():
    query = ("PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> "
             "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> "
             "PREFIX obo: <http://purl.obolibrary.org/obo/> "
             "SELECT ?uri ?label "
             "WHERE { "
             "GRAPH <http://vitro.mannlib.cornell.edu/default/vitro-kb-2> "
             "{ "
             "?uri rdf:type obo:ERO_0000007 . "
             "?uri rdfs:label ?label "
             "}}")
    techniques = [[], []]
    bindings = vivo_api_query(query)
    if bindings:
        for idx, concept in enumerate(bindings):
            uri = bindings[idx]["uri"]["value"]
            label = bindings[idx]["label"]["value"].lower()
            techniques[0].append(label)
            techniques[1].append(uri)
        return techniques
Ejemplo n.º 4
0
def get_techniques():
    query = ("PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> "
             "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> "
             "PREFIX obo: <http://purl.obolibrary.org/obo/> "
             "SELECT ?uri ?label "
             "WHERE { "
             "GRAPH <http://vitro.mannlib.cornell.edu/default/vitro-kb-2> "
             "{ "
             "?uri rdf:type obo:ERO_0000007 . "
             "?uri rdfs:label ?label "
             "}}")
    techniques = [[], []]
    bindings = vivo_api_query(query)
    if bindings:
        for idx, concept in enumerate(bindings):
            uri = bindings[idx]["uri"]["value"]
            label = bindings[idx]["label"]["value"].lower()
            techniques[0].append(label)
            techniques[1].append(uri)
        return techniques
def get_concepts():
    query = ("PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> "
             "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> "
             "PREFIX skos: <http://www.w3.org/2004/02/skos/core#> "
             "SELECT ?uri ?label "
             "WHERE { "
             "GRAPH <http://vitro.mannlib.cornell.edu/default/vitro-kb-2> "
             "{ "
             "?uri rdf:type skos:Concept . "
             "?uri rdfs:label ?label "
             "}}")

    concepts = [[], []]
    bindings = vivo_api_query(query)
    if bindings:
        for idx, concept in enumerate(bindings):
            uri = bindings[idx]["uri"]["value"]
            label = bindings[idx]["label"]["value"].lower()
            concepts[0].append(label)
            concepts[1].append(uri)
        return concepts
Ejemplo n.º 6
0
def get_concepts():
    query = ("PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> "
             "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> "
             "PREFIX skos: <http://www.w3.org/2004/02/skos/core#> "
             "SELECT ?uri ?label "
             "WHERE { "
             "GRAPH <http://vitro.mannlib.cornell.edu/default/vitro-kb-2> "
             "{ "
             "?uri rdf:type skos:Concept . "
             "?uri rdfs:label ?label "
             "}}")

    concepts = [[], []]
    bindings = vivo_api_query(query)
    if bindings:
        for idx, concept in enumerate(bindings):
            uri = bindings[idx]["uri"]["value"]
            label = bindings[idx]["label"]["value"].lower()
            concepts[0].append(label)
            concepts[1].append(uri)
        return concepts