-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use built-in base uri mechanism from jsonld
Much much faster (and simpler) than manual expansion with `@base`. Follow-up on #5
- Loading branch information
Showing
4 changed files
with
103 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
|
||
library(nycflights13) | ||
library(tidyverse) | ||
library(rdflib) | ||
source(system.file("examples/as_rdf.R", package="rdflib")) | ||
|
||
|
||
## Tidyverse Style | ||
df <- flights %>% | ||
left_join(airlines) %>% | ||
left_join(planes, by="tailnum") %>% | ||
select(carrier, manufacturer, model) | ||
|
||
## JSON-LD approach -- 5 sec, | ||
## ~ all rdf_parse | ||
## ~ all of which is jsonld_expand() | ||
profvis::profvis( | ||
x2 <- as_rdf.list(airports) | ||
) | ||
|
||
|
||
## rdf_add approach 12 sec | ||
## ~ all of which is rdf_add | ||
## ~ all of which is calls to new / initialize S4 method | ||
#3 ~ none of which is calls to the low level librdf_* C calls | ||
profvis::profvis( | ||
x2 <- as_rdf(airports, "faa", "x:") | ||
) | ||
|
||
|
||
|
||
x1 <- as_rdf(airlines, "carrier", "x:") | ||
x3 <- as_rdf(planes, "tailnum", "x:") | ||
|
||
system.time( | ||
x4 <- as_rdf(flights, NULL, "x:") | ||
) | ||
|
||
rdf <- c(x1,x2,x3) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters