Permalink
Browse files

Added CSV and TSV support. Added slower, but loss-less XML parser tha…

…t keeps literal types and languages.
  • Loading branch information...
1 parent 669e693 commit fc25fbf681c0924808957cad43024ee62f57e67e @wrvhage wrvhage committed Oct 7, 2011
@@ -11,7 +11,7 @@ Load SPARQL SELECT query result tables from an end-point as data frame.
\tabular{ll}{
Package: \tab SPARQL\cr
Type: \tab Package\cr
-Version: \tab 1.2\cr
+Version: \tab 1.3\cr
Date: \tab 2011-07-08\cr
License: \tab GPL-3\cr
Depends: \tab XML\cr
View
@@ -8,7 +8,7 @@ SPARQL client
This function connects to a SPARQL end-point over HTTP, poses a SELECT query, and return the results as a data frame with a named column for each variable from the SELECT query.
}
\usage{
-SPARQL(url = "http://localhost/", query = "", ns = NULL, param = "query", extra = "")
+SPARQL(url = "http://localhost/", query = "", ns = NULL, param = "query", extra = "", format="xml", lossy=TRUE)
}
%%- maybe also 'usage' for other objects documented here.
\arguments{
@@ -32,7 +32,13 @@ SPARQL(url = "http://localhost/", query = "", ns = NULL, param = "query", extra
}
\item{extra}{
%% ~~Describe \code{extra} here~~
- Extra characters appended to the HTTP request URL. Some SPARQL end-points require extra parameters to work. These can be supplied, in URL encoded form, as a character vector with this parameter. The SPARQL package makes an explicit request for "sparql-results+xml" from the endpoint.
+ Extra characters appended to the HTTP request URL. Some SPARQL end-points require extra parameters to work. These can be supplied, in URL encoded form, as a character vector with this parameter. This field can be used to specify the various ways in which different end-points can be told to return a certain format. For example, extra="&resultFormat=xml" or extra="&output=xml"
+}
+ \item{format}{
+ Can be used to explicitly state what kind of format is returned by the output. This version supports "xml", "csv" and "tsv".
+}
+ \item{lossy}{
+ The SPARQL client contains two parsers for SPARQL XML results, a fast lossy parser and a slow non-lossy parser. The lossy parser ignores literal datatypes and languages and does not wrap URIs with pointy braces. The lossy parameter can be set to FALSE to select the slow non-lossy XML parser when the format parameter is set to "xml" (which is the case by default). NB, Most SPARQL end-points that support CSV or TSV output are also lossy.
}
}
%%\details{
View
@@ -0,0 +1,7 @@
+\name{commonns}
+\alias{commonns}
+\title{commonns}
+\description{A vector of common namespaces and their prefixes.}
+\author{
+Willem Robert van Hage
+}
View
@@ -0,0 +1,8 @@
+\name{get_attr}
+\alias{get_attr}
+\title{get_attr}
+\description{Support function for SPARQL().}
+\author{
+Willem Robert van Hage
+}
+\keyword{internal}
View
@@ -0,0 +1,8 @@
+\name{noBrackets}
+\alias{noBrackets}
+\title{noBrackets}
+\description{Removes the pointy brackets from a non-lossy URI.}
+\author{
+Willem Robert van Hage
+}
+\keyword{internal}
@@ -0,0 +1,8 @@
+\name{readCSVstring}
+\alias{readCSVstring}
+\title{readCSVstring}
+\description{Parses a comma separated string.}
+\author{
+Willem Robert van Hage
+}
+\keyword{internal}
@@ -0,0 +1,8 @@
+\name{readTSVstring}
+\alias{readTSVstring}
+\title{readTSVstring}
+\description{Parses a tab separated string.}
+\author{
+Willem Robert van Hage
+}
+\keyword{internal}
View
@@ -0,0 +1,8 @@
+\name{sparqlns}
+\alias{sparqlns}
+\title{sparqlns}
+\description{The SPARQL namespace.}
+\author{
+Willem Robert van Hage
+}
+\keyword{internal}
View
@@ -0,0 +1,8 @@
+\name{sparqltest}
+\alias{sparqltest}
+\title{sparqltest}
+\description{Testing routine for SPARQL().}
+\author{
+Willem Robert van Hage
+}
+\keyword{internal}
View
Binary file not shown.
View
Binary file not shown.

0 comments on commit fc25fbf

Please sign in to comment.