def test_normal_case(self): from pump.vivopump import create_enum import os filename = "data/__test_create_enum.txt" query = "select ?short ?vivo where {?vivo a foaf:Person . ?vivo rdfs:label ?short .} ORDER BY ?short" create_enum(filename, query, QUERY_PARMS) self.assertTrue(os.path.isfile(filename)) os.remove(filename)
def main(): """ Generate the organization enum """ print datetime.now(), "Start" parms = get_parms() # Organization query = """ SELECT (MIN (?xlabel) AS ?short) ?vivo WHERE { ?vivo rdf:type foaf:Organization . ?vivo rdfs:label ?xlabel . } GROUP BY ?vivo ORDER BY ?short """ create_enum("country_enum.txt", query, parms) # Country query = """ SELECT (MIN (?xlabel) AS ?short) ?vivo WHERE { ?vivo rdf:type vivo:Country . ?vivo rdfs:label ?xlabel . } GROUP BY ?vivo ORDER BY ?short """ create_enum("country_enum.txt", query, parms) print datetime.now(), "End"
def main(): """ Generate the enums for degrees """ print datetime.now(), "Start" parms = get_parms() # person query = """ SELECT (MIN (?xlabel) AS ?short) ?vivo WHERE { ?vivo rdf:type vivo:GeographicLocation . ?vivo rdfs:label ?xlabel . } GROUP BY ?vivo ORDER BY ?short """ create_enum("location_enum.txt", query, parms) print datetime.now(), "End"
def main(): """ Generate the enums for concepts """ print datetime.now(), "Start" parms = get_parms() # Concept query = """ SELECT (MIN (?xlabel) AS ?short) ?vivo WHERE { ?vivo rdf:type skos:Concept . ?vivo rdfs:label ?xlabel . } GROUP BY ?vivo ORDER BY ?short """ create_enum("concept_enum.txt", query, parms) print datetime.now(), "End"
def main(): """ Generate the enums for positions """ print datetime.now(), "Start" parms = get_parms() # person via Orcid query = """ SELECT (MIN (?xshort) AS ?short) ?vivo WHERE { ?vivo vivo:orcidId ?xshort . } GROUP BY ?vivo ORDER BY ?short """ create_enum("orcid_enum.txt", query, parms) # department via label query = """ SELECT (MIN (?xlabel) AS ?short) ?vivo WHERE { {?vivo a vivo:Department . } UNION {?vivo a vivo:Institute . } UNION {?vivo a vivo:School . } UNION {?vivo a vivo:Center .} UNION {?vivo a vivo:College . } ?vivo rdfs:label ?xlabel . } GROUP BY ?vivo ORDER BY ?short """ create_enum("dept_enum.txt", query, parms) # dates via datetime query = """ SELECT ?short ?vivo WHERE { ?vivo a vivo:DateTimeValue . # ?vivo vivo:dateTimePrecision vivo:yearMonthDayPrecision . ?vivo vivo:dateTime ?short . } ORDER BY ?short """ create_enum("date_enum.txt", query, parms, trim=10) print datetime.now(), "End"
def main(): """ Generate the enums for editorial activities """ print datetime.now(), "Start" parms = get_parms() # person via label query = """ SELECT (MIN (?xshort) AS ?short) ?vivo WHERE { ?vivo a foaf:Person . ?vivo rdfs:label ?xshort . } GROUP BY ?vivo ORDER BY ?short """ create_enum("person_enum.txt", query, parms) # journals via label query = """ SELECT (MIN (?xlabel) AS ?short) ?vivo WHERE { ?vivo a bibo:Journal . ?vivo rdfs:label ?xlabel . } GROUP BY ?vivo ORDER BY ?short """ create_enum("journal_enum.txt", query, parms) # dates via datetime query = """ SELECT ?short ?vivo WHERE { ?vivo a vivo:DateTimeValue . ?vivo vivo:dateTime ?short . } ORDER BY ?short """ create_enum("date_enum.txt", query, parms, trim=10) print datetime.now(), "End"
def main(): """ Generate the enums for publications """ print datetime.now(), "Start" parms = get_parms() # person via Orcid query = """ SELECT (MIN (?xshort) AS ?short) ?vivo WHERE { ?vivo vivo:orcidId ?xshort . } GROUP BY ?vivo ORDER BY ?short """ create_enum("orcid_enum.txt", query, parms) # journals via issn query = """ SELECT (MIN (?xlabel) AS ?short) ?vivo WHERE { ?vivo a bibo:Journal . ?vivo rdfs:label ?xlabel . } GROUP BY ?vivo ORDER BY ?short """ create_enum("journal_enum.txt", query, parms) # dates via datetime query = """ SELECT ?short ?vivo WHERE { ?vivo a vivo:DateTimeValue . # ?vivo vivo:dateTimePrecision vivo:yearMonthDayPrecision . ?vivo vivo:dateTime ?short . } ORDER BY ?short """ create_enum("date_enum.txt", query, parms, trim=10) print datetime.now(), "End"
def main(): """ Generate the enums for positions """ print datetime.now(), "Start" parms = get_parms() # person via Orcid query = """ SELECT (MIN (?xshort) AS ?short) ?vivo WHERE { ?vivo vivo:orcidId ?xshort . } GROUP BY ?vivo ORDER BY ?short """ create_enum("orcid_enum.txt", query, parms) # journals via issn query = """ SELECT (MIN (?xlabel) AS ?short) ?vivo WHERE { ?vivo a bibo:Journal . ?vivo rdfs:label ?xlabel . } GROUP BY ?vivo ORDER BY ?short """ create_enum("journal_enum.txt", query, parms) # dates via datetime query = """ SELECT ?short ?vivo WHERE { ?vivo a vivo:DateTimeValue . # ?vivo vivo:dateTimePrecision vivo:yearMonthDayPrecision . ?vivo vivo:dateTime ?short . } ORDER BY ?short """ create_enum("date_enum.txt", query, parms, trim=10) print datetime.now(), "End"
def main(): """ Generate the enums for awards """ print datetime.now(), "Start" parms = get_parms() # person query = """ SELECT ?short ?vivo WHERE { ?vivo a foaf:Person . ?vivo rdfs:label ?short . } ORDER BY ?short """ create_enum("person_enum.txt", query, parms) # school query = """ SELECT ?short ?vivo WHERE { ?vivo a foaf:Organization . ?vivo rdfs:label ?short . } ORDER BY ?short """ create_enum("org_enum.txt", query, parms) # date query = """ SELECT ?short ?vivo WHERE { ?vivo a vivo:DateTimeValue . ?vivo vivo:dateTimePrecision vivo:yearPrecision . ?vivo vivo:dateTime ?short . } ORDER BY ?short """ create_enum("date_enum.txt", query, parms, trim=4) # academic degree query = """ SELECT ?short ?vivo WHERE { ?vivo a vivo:Award . ?vivo rdfs:label ?short . } ORDER BY ?short """ create_enum("award_enum.txt", query, parms) print datetime.now(), "End" return None
def main(): """ Generate the enums for grants """ print datetime.now(), "Start" parms = get_parms() # person via Orcid query = """ SELECT (MIN (?xshort) AS ?short) ?vivo WHERE { ?vivo vivo:orcidId ?xshort . } GROUP BY ?vivo ORDER BY ?short """ create_enum("orcid_enum.txt", query, parms) # department via label query = """ SELECT (MIN (?xlabel) AS ?short) ?vivo WHERE { {?vivo a vivo:Department . } UNION {?vivo a vivo:Institute . } UNION {?vivo a vivo:School . } UNION {?vivo a vivo:Center .} UNION {?vivo a vivo:College . } ?vivo rdfs:label ?xlabel . } GROUP BY ?vivo ORDER BY ?short """ create_enum("dept_enum.txt", query, parms) # Funding Organizations via label query = """ SELECT (MIN (?xlabel) AS ?short) ?vivo WHERE { ?vivo a vivo:FundingOrganization . ?vivo rdfs:label ?xlabel . } GROUP BY ?vivo ORDER BY ?short """ create_enum("sponsor_enum.txt", query, parms) # Concept via label query = """ SELECT (MIN (?xlabel) AS ?short) ?vivo WHERE { ?vivo a skos:Concept . ?vivo rdfs:label ?xlabel . } GROUP BY ?vivo ORDER BY ?short """ create_enum("concept_enum.txt", query, parms) # dates via datetime query = """ SELECT ?short ?vivo WHERE { ?vivo a vivo:DateTimeValue . # ?vivo vivo:dateTimePrecision vivo:yearMonthDayPrecision . ?vivo vivo:dateTime ?short . } ORDER BY ?short """ create_enum("date_enum.txt", query, parms, trim=10) print datetime.now(), "End"
def main(): """ Generate the enums for teaching """ print datetime.now(), "Start" parms = get_parms() # person via Orcid query = """ SELECT (MIN (?xshort) AS ?short) ?vivo WHERE { ?vivo vivo:orcidId ?xshort . } GROUP BY ?vivo ORDER BY ?short """ create_enum("orcid_enum.txt", query, parms) # Course via label query = """ SELECT (MIN (?xlabel) AS ?short) ?vivo WHERE { ?vivo a vivo:Course . ?vivo rdfs:label ?xlabel . } GROUP BY ?vivo ORDER BY ?short """ create_enum("course_enum.txt", query, parms) # Concept via label query = """ SELECT (MIN (?xlabel) AS ?short) ?vivo WHERE { ?vivo a skos:Concept . ?vivo rdfs:label ?xlabel . } GROUP BY ?vivo ORDER BY ?short """ create_enum("concept_enum.txt", query, parms) # dates via datetime query = """ SELECT ?short ?vivo WHERE { ?vivo a vivo:DateTimeValue . # ?vivo vivo:dateTimePrecision vivo:yearMonthDayPrecision . ?vivo vivo:dateTime ?short . } ORDER BY ?short """ create_enum("date_enum.txt", query, parms, trim=10) print datetime.now(), "End"
def main(): """ Generate the enums for degrees """ print datetime.now(), "Start" parms = get_parms() # person query = """ SELECT (MIN (?xlabel) AS ?short) ?vivo WHERE { ?vivo a foaf:Person . ?vivo rdfs:label ?xlabel . } GROUP BY ?vivo ORDER BY ?short """ create_enum("person_enum.txt", query, parms) # degree query = """ SELECT (MIN (?xlabel) AS ?short) ?vivo WHERE { ?vivo a vivo:AcademicDegree . ?vivo rdfs:label ?xlabel . } GROUP BY ?vivo ORDER BY ?short """ create_enum("degree_enum.txt", query, parms) # school query = """ SELECT (MIN (?xlabel) AS ?short) ?vivo WHERE { ?vivo a vivo:University . ?vivo rdfs:label ?xlabel . } GROUP BY ?vivo ORDER BY ?short """ create_enum("school_enum.txt", query, parms) # dates query = """ SELECT ?short ?vivo WHERE { ?vivo a vivo:DateTimeValue . ?vivo vivo:dateTimePrecision vivo:yearMonthPrecision . ?vivo vivo:dateTime ?short . } ORDER BY ?short """ create_enum("date_enum.txt", query, parms, trim=7) print datetime.now(), "End"
def main(): """ Generate the enums for degrees """ print datetime.now(), "Start" parms = get_parms() # person via Orcid query = """ SELECT (MIN (?xshort) AS ?short) ?vivo WHERE { ?vivo vivo:orcidId ?xshort . } GROUP BY ?vivo ORDER BY ?short """ create_enum("orcid_enum.txt", query, parms, skip=17) # degree query = """ SELECT (MIN (?xlabel) AS ?short) ?vivo WHERE { ?vivo a vivo:AcademicDegree . ?vivo rdfs:label ?xlabel . } GROUP BY ?vivo ORDER BY ?short """ create_enum("degree_enum.txt", query, parms) # dates query = """ SELECT ?short ?vivo WHERE { ?vivo a vivo:DateTimeValue . ?vivo vivo:dateTimePrecision vivo:yearPrecision . ?vivo vivo:dateTime ?short . } ORDER BY ?short """ create_enum("date_enum.txt", query, parms, trim=4) # Concept via label query = """ SELECT (MIN (?xlabel) AS ?short) ?vivo WHERE { ?vivo a skos:Concept . ?vivo rdfs:label ?xlabel . } GROUP BY ?vivo ORDER BY ?short """ create_enum("concept_enum.txt", query, parms) print datetime.now(), "End"