Given a non-complete uri, the get.vivo.grant function returns popular attributes as a list. if the attribute value is not specified in VIVO, the resulting value is NA. Note that several of the attributes are UF specific. If your VIVO does not extend the ontology to include these attributes, the resulting value for these attributes is always NA.

Code

 get.vivo.grant<-function(raw.uri){
 #
 #   Given a raw.uri (without the rdf filetype) of a VIVO grant RDF page,
 #   return basic facts about the grant.  Dereference as needed.  Missing
 #   attributes are returned as NA
 #
     uri <- make.vivo.uri(raw.uri)
     x <- xmlParse(uri)
     title              <- get.vivo.attribute(x,"label","http://www.w3.org/2000/01/rdf-schema#")
     sponsor.award.id   <- get.vivo.attribute(x,"sponsorAwardId","http://vivo.ufl.edu/ontology/vivo-ufl/")
     total.award.amount <- get.vivo.attribute(x,"totalAwardAmount")
     ps.contract.number <- get.vivo.attribute(x,"psContractNumber","http://vivo.ufl.edu/ontology/vivo- ufl/")
     dates              <- get.vivo.datetimeinterval(x)
     grant.awarded.by   <- get.vivo.grant.awarded.by(x)
     list(title=title,
         total.award.amount=total.award.amount,sponsor.award.id=sponsor.award.id,
         ps.contract.number=ps.contract.number,start=dates$start,end=dates$end,
         grant.awarded.by=grant.awarded.by)
 }

Sample run

 > grant.raw<-"http://vivo.ufl.edu/individual/n768443563"
 > get.vivo.grant(grant.raw)
 [1] "http://vivo.ufl.edu/individual/n3601856/n3601856.rdf"
 $title
 [1] "Palm Beach County Health Community Access Program"

 $total.award.amount
 [1] "47578.00"

 $sponsor.award.id
 [1] NA

 $ps.contract.number
 [1] "00056757"

 $start
 [1] "2005-05-12"

 $end
 [1] "2006-08-31"

 $grant.awarded.by
 [1] "US DEPT OF TRANSPORTATION"

Notes

  • total.award.amount has not been coerced to numeric. You'll want to coerce to numeric if you intend to do arithmetic.
  • start and end are in POSIXct formaat ready for date arithmetic and date functions. They are displayed by R as formatted text strings.
  • to get the start and end date, the original RDF page for the grant was dereferenced three times – once to get the date time interval RDF and then once each to get the start and end date RDF pages. This is done in the get.vivo.datetimeinterval function.