Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development #2

Merged
merged 3 commits into from
Feb 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ License: GNU Lesser General Public License
<https://www.gnu.org/licenses/lgpl-3.0.en.html>
Encoding: UTF-8
LazyData: true
RoxygenNote: 6.0.1
RoxygenNote: 7.1.1
Collate:
'db-access-high-level.R'
'db-access-low-level.R'
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export(RdfLibBackend)
export(ResourceDescriptionFramework)
export(add_data)
export(add_data_factory)
export(add_trig_file_to_graphdb)
export(api_triplestore_access)
export(basic_triplestore_access)
export(blank_node)
Expand Down
22 changes: 22 additions & 0 deletions R/db-access-high-level.R
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,25 @@ add_data_factory = function(access_options, prefixes)
add_data(do.call(paste, as.list(rdf_data)), access_options = access_options)
}
}

#'
#' The function `add_trig_file_to_graphdb` retrieves the rdf data from a trig file and inserts each line into an element of a list.
#' Then, this list is imported to graphdb triplestore using rdfr4::add_factory() functtion.
#'
#' @param graphdb_access_options graphdb triplestore access options.
#' @param prefixes named character
#' @param trig_file file name of the rdf format containing context (named graph).
#'
#' @export
add_trig_file_to_graphdb = function(graphdb_access_options,prefixes,trig_file){
if(missing(trig_file)){
return ("File missing")
} else if(!file.exists(trig_file)) {
return (paste0("File ",trig_file," not found."))
} else {
rdf_data <- scan(trig_file, what = "", sep = "\n")
}
add_data_to_graphdb = add_data_factory(access_options = graphdb_access_options, prefixes = prefixes)
out <- add_data_to_graphdb(rdf_data = rdf_data)
return(out)
}
Loading