[TASK] Create .gitignore and add the test code things.
This commit is contained in:
parent
e70686b236
commit
3b02118f39
|
@ -0,0 +1 @@
|
||||||
|
data.n3
|
|
@ -0,0 +1,50 @@
|
||||||
|
<local:n6366> rdf:type <http://purl.obolibrary.org/obo/BFO_0000002>
|
||||||
|
<local:n6366> rdf:type <http://purl.obolibrary.org/obo/BFO_0000004>
|
||||||
|
<local:n6366> rdf:type <http://www.w3.org/2002/07/owl#Thing>
|
||||||
|
<local:n6366> rdf:type <http://xmlns.com/foaf/0.1/Person>
|
||||||
|
<local:n6366> rdf:type <http://purl.obolibrary.org/obo/BFO_0000001>
|
||||||
|
<local:n6366> rdf:type <http://xmlns.com/foaf/0.1/Agent>
|
||||||
|
<local:n6366> <http://vivoweb.org/ontology/core#scopusId> "55903128900"
|
||||||
|
<local:n6366> vivo:mostSpecificType <http://vivoweb.org/ontology/core#FacultyMember>
|
||||||
|
<local:n6366> vivo:relatedBy <local:n3825>
|
||||||
|
<local:n6366> vivo:relatedBy <local:n7215>
|
||||||
|
<local:n6366> vivo:relatedBy <local:n1055>
|
||||||
|
|
||||||
|
|
||||||
|
<local:n4552> rdf:type <http://purl.obolibrary.org/obo/BFO_0000002>
|
||||||
|
<local:n4552> rdf:type <http://purl.obolibrary.org/obo/BFO_0000031>
|
||||||
|
<local:n4552> rdf:type <http://purl.obolibrary.org/obo/ARG_2000379>
|
||||||
|
<local:n4552> rdf:type <vcard:Kind>
|
||||||
|
<local:n4552> rdf:type <http://www.w3.org/2002/07/owl#Thing>
|
||||||
|
<local:n4552> rdf:type <http://purl.obolibrary.org/obo/BFO_0000001>
|
||||||
|
<local:n4552> rdf:type <http://purl.obolibrary.org/obo/IAO_0000030>
|
||||||
|
<local:n4552> vivo:mostSpecificType <vcard:Individual>
|
||||||
|
|
||||||
|
|
||||||
|
<local:n6438> rdf:type <owl:Thing>
|
||||||
|
<local:n6438> rdf:type <vcard:Geo>
|
||||||
|
<local:n6438> rdf:type <vcard:Explanatory>
|
||||||
|
<local:n6438> rdf:type <vcard:Geographical>
|
||||||
|
<local:n6438> rdf:type <vcard:Addressing>
|
||||||
|
<local:n6438> rdf:type <vcard:Communication>
|
||||||
|
<local:n6438> rdf:type <vcard:Calendar>
|
||||||
|
<local:n6438> rdf:type <vcard:Identification>
|
||||||
|
<local:n6438> rdf:type <vcard:Organizational>
|
||||||
|
<local:n6438> rdf:type <vcard:TimeZone>
|
||||||
|
<local:n6438> rdf:type <vcard:Security>
|
||||||
|
<local:n6438> vivo:mostSpecificType <vcard:Title>
|
||||||
|
|
||||||
|
|
||||||
|
#Die Person
|
||||||
|
<local:n6366> rdf:type <http://vivoweb.org/ontology/core#FacultyMember>
|
||||||
|
<local:n6366> <http://www.w3.org/2000/01/rdf-schema#label> "Krömker, Volker "^^<xsd:string>
|
||||||
|
<local:n6366> <http://purl.obolibrary.org/obo/ARG_2000028> <local:n4552> #hasContactInfo
|
||||||
|
|
||||||
|
#Die VCard
|
||||||
|
<local:n4552> rdf:type <vcard:Individual>
|
||||||
|
<local:n4552> <vcard:hasTitle> <local:n6438>
|
||||||
|
<local:n4552> <http://purl.obolibrary.org/obo/ARG_2000029> <local:n6366> #contactInformationFor
|
||||||
|
|
||||||
|
#(einer) der Titel
|
||||||
|
<local:n6438> rdf:type <vcard:Title>
|
||||||
|
<local:n6438> <vcard:title> "Prof. Dr. med.-vet."^^<xsd:string>
|
|
@ -306,7 +306,7 @@ def processPersons(session, additionalIdSeq):
|
||||||
|
|
||||||
#use memberships to determine person type
|
#use memberships to determine person type
|
||||||
for i, membership in enumerate(sqlP.memberships):
|
for i, membership in enumerate(sqlP.memberships):
|
||||||
if membership.active != 'Y':
|
if membership.active == False:
|
||||||
continue #SKIP INACTIVE MEMBERSHIPS!
|
continue #SKIP INACTIVE MEMBERSHIPS!
|
||||||
|
|
||||||
processMembership(membership, additionalIdSeq)
|
processMembership(membership, additionalIdSeq)
|
||||||
|
|
|
@ -0,0 +1,96 @@
|
||||||
|
import csv
|
||||||
|
from pprint import pprint
|
||||||
|
import urllib
|
||||||
|
|
||||||
|
from rdflib import Namespace
|
||||||
|
from rdfalchemy import rdfSingle
|
||||||
|
from rdfalchemy.rdfSubject import rdfSubject
|
||||||
|
|
||||||
|
from rdflib import Literal, BNode, Namespace, URIRef
|
||||||
|
from rdflib import RDF, RDFS, Graph, OWL
|
||||||
|
from rdflib.namespace import XSD
|
||||||
|
|
||||||
|
|
||||||
|
foaf = Namespace('http://xmlns.com/foaf/0.1/')
|
||||||
|
core = Namespace('http://vivoweb.org/ontology/core#')
|
||||||
|
vitro = Namespace('http://vitro.mannlib.cornell.edu/ns/vitro/0.7')
|
||||||
|
local = Namespace('http://localhost/core/ontology/core-local#')
|
||||||
|
|
||||||
|
#Namespace for the vivo app
|
||||||
|
vivo_app_url = 'http://localhost/vivo/'
|
||||||
|
app = Namespace(vivo_app_url)
|
||||||
|
|
||||||
|
|
||||||
|
class Thing(rdfSubject):
|
||||||
|
rdf_type = OWL.Thing
|
||||||
|
label = rdfSingle(RDFS.label)
|
||||||
|
|
||||||
|
class Person(Thing):
|
||||||
|
rdf_type = foaf.Person
|
||||||
|
|
||||||
|
class FacultyMember(Person):
|
||||||
|
rdf_type = core.FacultyMember
|
||||||
|
firstname = rdfSingle(foaf.firstName)
|
||||||
|
middlename = rdfSingle(core.middleName)
|
||||||
|
lastname = rdfSingle(foaf.lastName)
|
||||||
|
work_email = rdfSingle(core.workEmail)
|
||||||
|
phone = rdfSingle(core.workPhone)
|
||||||
|
fax = rdfSingle(core.workFax)
|
||||||
|
research_overview = rdfSingle(core.researchOverview)
|
||||||
|
preferred_title = rdfSingle(core.preferredTitle)
|
||||||
|
moniker = rdfSingle(vitro.moniker)
|
||||||
|
people_id = rdfSingle(local.peopleID)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def get_graph():
|
||||||
|
"""
|
||||||
|
Helper for getting a graph and binding namespaces.
|
||||||
|
"""
|
||||||
|
g = rdfSubject.db
|
||||||
|
#Bind the namespaces
|
||||||
|
g.bind('foaf', foaf)
|
||||||
|
g.bind('core', core)
|
||||||
|
g.bind('vitro', vitro)
|
||||||
|
g.bind('local', local)
|
||||||
|
return g
|
||||||
|
|
||||||
|
g = get_graph()
|
||||||
|
|
||||||
|
#Open the sample VIVO people file.
|
||||||
|
csv_url = 'http://iweb.dl.sourceforge.net/project/vivo/Data%20Ingest/people.csv'
|
||||||
|
people_file = urllib.urlopen(csv_url)
|
||||||
|
for count, row in enumerate(csv.DictReader(people_file)):
|
||||||
|
#Create a URI for the person.
|
||||||
|
person_uri = URIRef("%sfaculty%s" % (app, count + 1))
|
||||||
|
fac = FacultyMember(person_uri)
|
||||||
|
fac.label = row.get('name').strip()
|
||||||
|
fac.people_id = row.get('person_ID')
|
||||||
|
fac.moniker = row.get('title')
|
||||||
|
fac.firstname = row.get('first')
|
||||||
|
middle_name = row.get('middle')
|
||||||
|
if middle_name is not None and middle_name != "":
|
||||||
|
fac.middlename = row.get('middle')
|
||||||
|
fac.lastname = row.get('last')
|
||||||
|
fac.work_email = row.get('email')
|
||||||
|
fac.phone = row.get('phone')
|
||||||
|
fac.fax = row.get('fax')
|
||||||
|
|
||||||
|
print g.serialize(format='n3')
|
||||||
|
g.close()
|
||||||
|
"""
|
||||||
|
#Load the n3 file as a rdfSubject db.
|
||||||
|
people_n3 = 'http://iweb.dl.sourceforge.net/project/vivo/Data%20Ingest/people.n3'
|
||||||
|
rdfSubject.db.load(people_n3, format='n3')
|
||||||
|
#Get all of the assistant professors in the graph.
|
||||||
|
asst_professors = FacultyMember.filter_by(moniker="Assistant Professor")
|
||||||
|
print '\n' + '=' * 20
|
||||||
|
print "Assistant Professors"
|
||||||
|
print '=' * 20 + '\n'
|
||||||
|
for fac in asst_professors:
|
||||||
|
#Print full name, email, and url to vivo profile.
|
||||||
|
print "%s\t%s\t%s" % (fac.label, fac.work_email, fac.resUri.toPython())
|
||||||
|
|
||||||
|
#Use get_by to retrieve a single faculty member
|
||||||
|
faculty = FacultyMember.get_by(hr_id='3958')
|
||||||
|
print faculty.label"""
|
Loading…
Reference in New Issue