Given a raw URI for a VIVO person RDF page, call get.vivo.person
to get basic attributes regarding the person.
Code
No Format |
---|
get.vivo.person<-function(raw.uri){
#
# Given a raw.uri (without the rdf filetype) of a VIVO person page, return basic facts about the
# the person. Dereference as needed. Missing attributes are returned as NA.
#
uri <- make.vivo.uri(raw.uri)
x <- xmlParse(uri)
name.path <- paste("//rdf:Description[@rdf:about='",raw.uri,"']/rdfs:label",sep="",collapse="")
xns<-getNodeSet(x,name.path)
name <- xmlValue(xns[[1]])
era.commons.id <- get.vivo.attribute(x,"eraCommonsID","http://vivo.ufl.edu/ontology/vivo-ufl/")
email <- get.vivo.attribute(x,"email")
phone.number <- get.vivo.attribute(x,"phoneNumber")
pubs <- length(getNodeSet(x,"//d:authorInAuthorship",c(d="http://vivoweb.org/ontology/core#")))
grants <- length(getNodeSet(x,"//d:hasPrincipalInvestigatorRole",c(d="http://vivoweb.org/ontology/core#")))
#
# deref first (!) personInPosition to get department name
#
xns<-getNodeSet(x,"//d:personInPosition",c(d="http://vivoweb.org/ontology/core#"))
pip.uri <- make.vivo.uri(xmlGetAttr(xns[[1]],"rdf:resource"))
xpip<-xmlParse(pip.uri)
xns<-getNodeSet(xpip,"//d:positionInOrganization",c(d="http://vivoweb.org/ontology/core#"))
pio.uri <- make.vivo.uri(xmlGetAttr(xns[[1]],"rdf:resource"))
xpio <- xmlParse(pio.uri)
department <- get.vivo.name(xpio)
list(name=name,pubs=pubs,grants=grants,department=department,
era.commons.id=era.commons.id,email=email,phone.number=phone.number)
}
|
Sample Run
No Format |
---|
> person.raw
[1] "http://vivo.ufl.edu/individual/n25562"
> get.vivo.person(person.raw)
$name
[1] "Conlon, Mike"
$pubs
[1] 77
$grants
[1] 1
$department
[1] "Health Outcomes and Policy"
$era.commons.id
[1] "MCONLON"
$email
[1] "mconlon@ufl.edu"
$phone.number
[1] "3522738872"
|
Notes
- pubs is a count of AuthorInAuthorship assertions on the person page
- grants is a count of hasPrincipalInvestigatorRole on the person page
- department name is doubly dereferenced from personInPosition and then positionInOrganization
- era.commons.id is a UF extension