Skip to content

Commit

Permalink
Copied in the R package stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
egonw committed Mar 22, 2011
1 parent 7bacbbf commit 8e2a06c
Show file tree
Hide file tree
Showing 24 changed files with 218 additions and 10 deletions.
4 changes: 1 addition & 3 deletions .gitignore
@@ -1,3 +1 @@
bin
*~
*.jar
*.Rcheck/
31 changes: 31 additions & 0 deletions LICENSE.md
@@ -0,0 +1,31 @@

# License

Copyright (C) 2011 Egon Willighagen <egon.willighagen@gmail.com>

The license for this package is GPL v3. The copyright and license for Jena
is defined by (see http://jena.sourceforge.net/license.html):

© Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Hewlett-Packard Development Company, LP
© Copyright 2010 Talis Systems Ltd.
© Copyright 2010 Epimorphics Ltd.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

which in turn depends on these packages (see http://jena.sourceforge.net/Licenses/):

System Version License

Xerces 2.7.1 Apache 2 License
ICU4J 3.4.4 IBM X License
JUnit 4.5 Common Public License Version 1.0
Lucene 2.3.1 Apache 2 License
Log4j 1.2.12 Apache 2 License
SLF4J 1.5.6 SLF4J License
WoodSToX StAX parser StAX API 1.0.1 / Impl 3.2.9 Apache 2 License
Jena IRI library 0.7 Jena License
9 changes: 9 additions & 0 deletions README.md
@@ -0,0 +1,9 @@

# About

java/ -> Helper classes for the R rdf package.
rdf/ -> R package for dealing with RDF, using Jena.

# Copyright / License

See the LICENSE file.
3 changes: 3 additions & 0 deletions java/.gitignore
@@ -0,0 +1,3 @@
bin
*~
*.jar
10 changes: 8 additions & 2 deletions build.groovy → java/build.groovy
Expand Up @@ -4,8 +4,14 @@ ant.mkdir(dir:"bin")
ant.javac(
srcdir:"src", destdir:"bin",
includes:"**/*.java",
fork:"true"
)
fork:"true") {
classpath {
fileset dir: "../rdf/inst/cont", {
include name: "*.jar"
}
}
}

ant.jar(
destfile:"rrdf.jar",
basedir:"bin",
Expand Down
11 changes: 11 additions & 0 deletions java/src/com/github/egonw/rrcdk/RJenaHelper.java
@@ -0,0 +1,11 @@
import com.hp.hpl.jena.rdf.model.*;
import com.hp.hpl.jena.ontology.*;

public class RJenaHelper {

public Model loadRdf(String file, String format) {
Model model = ModelFactory.createOntologyModel();
return model;
}

}
1 change: 1 addition & 0 deletions rdf/.gitignore
@@ -0,0 +1 @@
*~
11 changes: 11 additions & 0 deletions rdf/DESCRIPTION
@@ -0,0 +1,11 @@
Package: rdf
Type: Package
Title: rdf - support for the Resource Description Framework
Version: 1.0
Date: 2011-03-22
Author: Egon Willighagen <egon.willighagen@gmail.com>
Maintainer: Egon Willighagen <egon.willighagen@gmail.com>
Depends: R (>= 2.0.0), rJava
Description: Work with RDF data.
License: BSD
LazyLoad: yes
20 changes: 20 additions & 0 deletions rdf/R/load.rdf.R
@@ -0,0 +1,20 @@
load.rdf <- function(f, format="RDF/XML") {
.jcall(
"com.hp.hpl.jena.rdf.model.ModelFactory",
"Lcom/hp/hpl/jena/ontology/OntModel;",
"createOntologyModel"
)


}

merge.rdf <- function(model1, model2) {
if (attr(model2, "jclass") != "Lcom/hp/hpl/jena/rdf/model/Model") {
model2 <- .jcast(model2, "com/hp/hpl/jena/rdf/model/Model")
}

.jcall(
model1, "Lcom/hp/hpl/jena/rdf/model/Model;",
"add", model2
)
}
24 changes: 24 additions & 0 deletions rdf/R/rdf.R
@@ -0,0 +1,24 @@
.packageName <- "rdf"

require(rJava, quietly=TRUE)

.First.lib <- function(lib, pkg) {
dlp<-Sys.getenv("DYLD_LIBRARY_PATH")
if (dlp!="") { # for Mac OS X we need to remove X11 from lib-path
Sys.setenv("DYLD_LIBRARY_PATH"=sub("/usr/X11R6/lib","",dlp))
}

.jinit(classpath=c(
paste(lib,pkg,"cont","arq-2.8.7.jar",sep=.Platform$file.sep),
paste(lib,pkg,"cont","icu4j-3.4.4.jar",sep=.Platform$file.sep),
paste(lib,pkg,"cont","iri-0.8.jar",sep=.Platform$file.sep),
paste(lib,pkg,"cont","jena-2.6.4.jar",sep=.Platform$file.sep),
paste(lib,pkg,"cont","log4j-1.2.13.jar",sep=.Platform$file.sep),
paste(lib,pkg,"cont","lucene-core-2.3.1.jar",sep=.Platform$file.sep),
paste(lib,pkg,"cont","slf4j-api-1.5.8.jar",sep=.Platform$file.sep),
paste(lib,pkg,"cont","slf4j-log4j12-1.5.8.jar",sep=.Platform$file.sep),
paste(lib,pkg,"cont","stax-api-1.0.1.jar",sep=.Platform$file.sep),
paste(lib,pkg,"cont","wstx-asl-3.2.9.jar",sep=.Platform$file.sep),
paste(lib,pkg,"cont","xercesImpl-2.7.1.jar",sep=.Platform$file.sep)
))
}
Binary file added rdf/inst/cont/arq-2.8.7.jar
Binary file not shown.
Binary file added rdf/inst/cont/icu4j-3.4.4.jar
Binary file not shown.
Binary file added rdf/inst/cont/iri-0.8.jar
Binary file not shown.
Binary file added rdf/inst/cont/jena-2.6.4.jar
Binary file not shown.
Binary file added rdf/inst/cont/log4j-1.2.13.jar
Binary file not shown.
Binary file added rdf/inst/cont/lucene-core-2.3.1.jar
Binary file not shown.
Binary file added rdf/inst/cont/slf4j-api-1.5.8.jar
Binary file not shown.
Binary file added rdf/inst/cont/slf4j-log4j12-1.5.8.jar
Binary file not shown.
Binary file added rdf/inst/cont/stax-api-1.0.1.jar
Binary file not shown.
Binary file added rdf/inst/cont/wstx-asl-3.2.9.jar
Binary file not shown.
Binary file added rdf/inst/cont/xercesImpl-2.7.1.jar
Binary file not shown.
56 changes: 56 additions & 0 deletions rdf/man/load.rdf.Rd
@@ -0,0 +1,56 @@
\name{load.rdf}
\alias{load.rdf}
%- Also NEED an '\alias' for EACH other topic documented here.
\title{
Load RDF content
}
\description{
Loads triples from a RDF serialization.
}
\usage{
load.rdf(file, format = "RDF/XML")
}
%- maybe also 'usage' for other objects documented here.
\arguments{
\item{file}{
File to read the triples from.
}
\item{format}{
Format of the RDF file, e.g. RDF/XML.
}
}
\details{
%% ~~ If necessary, more details than the description above ~~
}
\value{
Returns something at some point.
}
%%\references{
%% ~put references to the literature/web site here ~
%%}
\author{
Egon Willighagen
}
%%\note{
%% ~~further notes~~
%%}

%% ~Make other sections like Warning with \section{Warning }{....} ~

%%\seealso{
%% ~~objects to See Also as \code{\link{help}}, ~~~
%%}
\examples{
##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.

## The function is currently defined as
function(file, format="RDF/XML") {
c();
}
}
% Add one or more standard keywords, see file 'KEYWORDS' in the
% R documentation directory.
\keyword{ ~RDF }
\keyword{ ~triple }
43 changes: 43 additions & 0 deletions rdf/man/rdf-package.Rd
@@ -0,0 +1,43 @@
\name{rdf-package}
\alias{rdf-package}
\alias{rdf}
\docType{package}
\title{
What the package does (short line)
~~ package title ~~
}
\description{
More about what it does (maybe more than one line)
~~ A concise (1-5 lines) description of the package ~~
}
\details{
\tabular{ll}{
Package: \tab rdf\cr
Type: \tab Package\cr
Version: \tab 1.0\cr
Date: \tab 2011-03-22\cr
License: \tab BSD\cr
LazyLoad: \tab yes\cr
}
~~ An overview of how to use the package, including the most important ~~
~~ functions ~~
}
\author{
Who wrote it

Maintainer: Who to complain to <yourfault@somewhere.net>
~~ The author and/or maintainer of the package ~~
}
\references{
~~ Literature or other references for background information ~~
}
~~ Optionally other standard keywords, one per line, from file KEYWORDS in ~~
~~ the R documentation directory ~~
\keyword{ package }
%\seealso{
%~~ Optional links to other man pages, e.g. ~~
%~~ \code{\link[<pkg>:<pkg>-package]{<pkg>}} ~~
%}
%\examples{
%~~ simple examples of the most important functions ~~
%}
5 changes: 0 additions & 5 deletions src/com/github/egonw/rrcdk/RJenaHelper.java

This file was deleted.

0 comments on commit 8e2a06c

Please sign in to comment.