diff --git a/lib/docs/docs/r.md b/lib/docs/docs/r.md index 49abc69..78ad149 100644 --- a/lib/docs/docs/r.md +++ b/lib/docs/docs/r.md @@ -23,7 +23,7 @@ Initialize a converter, then use it to `compress` URIs to CURIEs, or `expand` CU ```r title="curies_conversion.R" library(curiesr) -converter <- ConverterR$new() +converter <- Converter$new() curie <- converter$compress("http://purl.obolibrary.org/obo/DOID_1234") uri <- converter$expand("doid:1234") diff --git a/r/DESCRIPTION b/r/DESCRIPTION index 1dead12..3939c27 100644 --- a/r/DESCRIPTION +++ b/r/DESCRIPTION @@ -1,4 +1,4 @@ -Package: curiesr +Package: curies Title: Idiomatic conversion between URIs and compact URIs (CURIEs) Version: 0.1.0 Authors@R: c( diff --git a/r/NAMESPACE b/r/NAMESPACE index 6dce5af..1b850c7 100644 --- a/r/NAMESPACE +++ b/r/NAMESPACE @@ -1,5 +1,5 @@ # Generated by roxygen2: do not edit by hand -S3method("$",ConverterR) -S3method("[[",ConverterR) -useDynLib(curiesr, .registration = TRUE) +S3method("$",Converter) +S3method("[[",Converter) +useDynLib(curies, .registration = TRUE) diff --git a/r/R/extendr-wrappers.R b/r/R/extendr-wrappers.R index 234367b..f79aab2 100644 --- a/r/R/extendr-wrappers.R +++ b/r/R/extendr-wrappers.R @@ -4,26 +4,26 @@ # # This file was created with the following call: -# .Call("wrap__make_curiesr_wrappers", use_symbols = TRUE, package_name = "curiesr") +# .Call("wrap__make_curies_wrappers", use_symbols = TRUE, package_name = "curies") #' @docType package #' @usage NULL -#' @useDynLib curiesr, .registration = TRUE +#' @useDynLib curies, .registration = TRUE NULL -ConverterR <- new.env(parent = emptyenv()) +Converter <- new.env(parent = emptyenv()) -ConverterR$new <- function() .Call(wrap__ConverterR__new) +Converter$new <- function() .Call(wrap__Converter__new) -ConverterR$compress <- function(uri) .Call(wrap__ConverterR__compress, self, uri) +Converter$compress <- function(uri) .Call(wrap__Converter__compress, self, uri) -ConverterR$expand <- function(curie) .Call(wrap__ConverterR__expand, self, curie) +Converter$expand <- function(curie) .Call(wrap__Converter__expand, self, curie) #' @export -`$.ConverterR` <- function (self, name) { func <- ConverterR[[name]]; environment(func) <- environment(); func } +`$.Converter` <- function (self, name) { func <- Converter[[name]]; environment(func) <- environment(); func } #' @export -`[[.ConverterR` <- `$.ConverterR` +`[[.Converter` <- `$.Converter` # nolint end diff --git a/r/README.md b/r/README.md index adb1b87..e3e34e6 100644 --- a/r/README.md +++ b/r/README.md @@ -69,7 +69,7 @@ After installation, the following should work: ```r library(curiesr) -converter <- ConverterR$new() +converter <- Converter$new() curie <- converter$compress("http://purl.obolibrary.org/obo/DOID_1234") print(curie) ``` diff --git a/r/man/curiesr-package.Rd b/r/man/curies-package.Rd similarity index 75% rename from r/man/curiesr-package.Rd rename to r/man/curies-package.Rd index 6f6579b..651fa4c 100644 --- a/r/man/curiesr-package.Rd +++ b/r/man/curies-package.Rd @@ -1,10 +1,10 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/extendr-wrappers.R \docType{package} -\name{curiesr-package} -\alias{curiesr} -\alias{curiesr-package} -\title{curiesr: Idiomatic conversion between URIs and compact URIs (CURIEs)} +\name{curies-package} +\alias{curies} +\alias{curies-package} +\title{curies: Idiomatic conversion between URIs and compact URIs (CURIEs)} \description{ R package for the curies library: idiomatic conversion between URIs and compact URIs (CURIEs) } diff --git a/r/src/Makevars b/r/src/Makevars index d26c72c..40badb7 100644 --- a/r/src/Makevars +++ b/r/src/Makevars @@ -1,7 +1,7 @@ TARGET_DIR = ./rust/target LIBDIR = $(TARGET_DIR)/release -STATLIB = $(LIBDIR)/libcuriesr.a -PKG_LIBS = -L$(LIBDIR) -lcuriesr -lssl +STATLIB = $(LIBDIR)/libcuries.a +PKG_LIBS = -L$(LIBDIR) -lcuries -lssl all: C_clean diff --git a/r/src/Makevars.win b/r/src/Makevars.win index 98cb9f9..4d567d6 100644 --- a/r/src/Makevars.win +++ b/r/src/Makevars.win @@ -2,8 +2,8 @@ TARGET = $(subst 64,x86_64,$(subst 32,i686,$(WIN)))-pc-windows-gnu TARGET_DIR = ./rust/target LIBDIR = $(TARGET_DIR)/$(TARGET)/release -STATLIB = $(LIBDIR)/libcuriesr.a -PKG_LIBS = -L$(LIBDIR) -lcuriesr -lws2_32 -ladvapi32 -luserenv -lbcrypt -lntdll -lCrypt32 -lSecur32 +STATLIB = $(LIBDIR)/libcuries.a +PKG_LIBS = -L$(LIBDIR) -lcuries -lws2_32 -ladvapi32 -luserenv -lbcrypt -lntdll -lCrypt32 -lSecur32 all: C_clean diff --git a/r/src/curiesr-win.def b/r/src/curiesr-win.def index 5c15206..1e1d744 100644 --- a/r/src/curiesr-win.def +++ b/r/src/curiesr-win.def @@ -1,2 +1,2 @@ EXPORTS -R_init_curiesr +R_init_curies diff --git a/r/src/entrypoint.c b/r/src/entrypoint.c index 12b2389..2da279a 100644 --- a/r/src/entrypoint.c +++ b/r/src/entrypoint.c @@ -1,8 +1,8 @@ // We need to forward routine registration from C to Rust // to avoid the linker removing the static library. -void R_init_curiesr_extendr(void *dll); +void R_init_curies_extendr(void *dll); -void R_init_curiesr(void *dll) { - R_init_curiesr_extendr(dll); +void R_init_curies(void *dll) { + R_init_curies_extendr(dll); } diff --git a/r/src/rust/Cargo.toml b/r/src/rust/Cargo.toml index c4e581a..ee23e50 100644 --- a/r/src/rust/Cargo.toml +++ b/r/src/rust/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = 'curiesr' +name = 'curies-r' publish = false version = '0.3.0' edition = '2021' @@ -7,7 +7,7 @@ license-file.workspace = true [lib] crate-type = [ 'staticlib' ] -name = 'curiesr' +name = 'curies' [dependencies] curies.workspace = true diff --git a/r/src/rust/src/lib.rs b/r/src/rust/src/lib.rs index 90a71ca..b43311a 100644 --- a/r/src/rust/src/lib.rs +++ b/r/src/rust/src/lib.rs @@ -1,17 +1,17 @@ use extendr_api::prelude::*; -use ::curies::{sources::get_bioregistry_converter, Converter}; +use ::curies::{sources::get_bioregistry_converter, Converter as RsConverter}; use tokio::runtime::Runtime; /// Converter struct for R /// @export -pub struct ConverterR { - converter: Converter, +pub struct Converter { + converter: RsConverter, pub name: String, } #[extendr] -impl ConverterR { +impl Converter { fn new() -> Result { // Building from empty converter works // let mut converter = Converter::default(); @@ -41,16 +41,15 @@ impl ConverterR { } /// Initialize converter -fn init_converter() -> Converter { +fn init_converter() -> RsConverter { let rt = Runtime::new().unwrap(); rt.block_on(async { get_bioregistry_converter().await.unwrap() }) } -// Macro to generate exports. This ensures exported functions are registered with R. -// See corresponding C code in `entrypoint.c`. +// Macro to generate exports. This ensures exported functions are registered with R. See corresponding C code in `entrypoint.c`. extendr_module! { - mod curiesr; - impl ConverterR; + mod curies; + impl Converter; // fn hello_world; } diff --git a/r/tests/test-curies.R b/r/tests/test-curies.R index 303543d..e906d0e 100644 --- a/r/tests/test-curies.R +++ b/r/tests/test-curies.R @@ -1,8 +1,8 @@ library(testthat) -library(curiesr) +library(curies) -test_that("Create curiesr default converter, compress and expand", { - converter <- ConverterR$new() +test_that("Create curies default converter, compress and expand", { + converter <- Converter$new() expect_equal(converter$compress("http://purl.obolibrary.org/obo/DOID_1234"), "doid:1234") expect_equal(converter$expand("doid:1234"), "http://purl.obolibrary.org/obo/DOID_1234")