Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Panel

get.vivo.grant<-function(raw.uri){
#

  1. Given a raw.uri (without the rdf filetype) of a VIVO grant RDF page,
  2. return basic facts about the grant. Dereference as needed. Missing
  3. 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(error)
    grant.awarded.by <- get.vivo.grant.awarded.by(error)
    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

Panel
No Format
>

 &gt; grant.
raw<
raw&lt;-"http://vivo.ufl.edu/individual/n768443563"

>

 &gt; get.vivo.grant(grant.raw)


 [1] "http://vivo.ufl.edu/individual/n3601856/n3601856.rdf"

$title
1

 $title
 [1] "Palm Beach County Health Community Access Program"


 $total.award.amount

...

Panel
1

 [1] "47578.00"


 $sponsor.award.id

...

Panel

1 NA


 [1] NA

 $ps.contract.number

...

Panel
1

 [1] "00056757"

$start

Panel
1


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

$end

Panel
1


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


 $grant.awarded.by

...

noformat
Panel
1

 [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.