Coder Social home page Coder Social logo

cower's Introduction

cower

R-implementation of COW to convert csv files to nquads using json-ld data description and data.table for speed.

Installation.

library("devtools")
devtools::install_github("rijpma/cower")

You may need to manually install V8 as an external dependency, see the V8 package.

cower's People

Contributors

rijpma avatar

Stargazers

 avatar

Watchers

 avatar  avatar

cower's Issues

csvw:value strings should not need double quotes

If you want "csvw:value": "my string" to result in triples with sub pred "my string" it needs to be provided as "csvw:value": "'my string;"` because otherwise cower thinks it's a column name. Should be fixed in add_schema_evals

error if total rows are an exact multiple of batch_size

When going through the csv file in chunks and the total rows are an exact multiple of the batch size, cower ends up having to read a csv file of zero remaining rows and an error is thrown. Because the conversion in that case is complete, the error message should not appear.

Possible fixes:

  1. tryCatch or another error handler
  2. count the rows on the csv file in advance (very inefficient in R because entire file would nonetheless have to be read), dependency on wc -l somewhat undesirable, though there are already external depedencies (head, though only when max_size is specified; and maybe gzfile, though only when using compress = T).

no evaluation in propertyUrl

propertyUrls are only expanded, never evaluated: ..., "propertyUrl": "vocab:{variable}",... does not work. would need to get evaluated before predicates are inserted, but only if {} present.

handle csvw:parseOnEmpty as in COW

If csvw:parseOnEmpty = true, empty cells should be converted; if false they should not. Current behavious is probably NA in data means dropped at writing due to use of complete.cases.

row numbering subject wrong in combination with NULL specification

Because .I is evaluated after subsetting, batch[!Rank %in% c(1, 2), uriref(.I, base = 'http://example.com/')] does not work because it starts counting. batch[, list(Rank, uriref(.I, base = "http://example.com/"))][!Rank %in% c(1, 2), ] but doesn't update the data.table. Best alternative might be batch[, vrb := uriref(.I, base = 'http://example.com/')], followed by batch[Rank %in% c(1, 2), vrb := NA], that is, use the nullstrings for separate commands.

handle conditionals

The conditional in COW, {% if something %}x{% else %}y{% endif %} is currently not supported. R's ifelse() function probably does work as an alternative.

complete metadata graph

conversions fails without valueUrl or csvw:value or titles

If the json only provides datatype and name, and not valueUrl, csvw:value, or titles for a column, conversion fails. Happens because nothing is placed in valueUrl_eval. Fix by replacing titles by names, or by supplementing titles by names where titles is missing.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.