Last active
April 30, 2021 16:54
Revisions
-
ftrain revised this gist
Oct 25, 2020 . No changes.There are no files selected for viewing
-
ftrain revised this gist
Oct 25, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -5,4 +5,4 @@ CREATE TABLE triples ( olit TEXT DEFAULT NULL ); -- also add a bunch of indexes especially around p and o -
ftrain revised this gist
Oct 25, 2020 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -4,3 +4,5 @@ CREATE TABLE triples ( o TEXT DEFAULT NULL, olit TEXT DEFAULT NULL ); % also add a bunch of indexes especially around p and o -
ftrain created this gist
Oct 25, 2020 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ #!/usr/bin/perl while (<>) { s/'/''/g; /^([^\s]+)\s*([^\s]+)\s*(.+)\s+\.\s*$/; my $s = $1; my $p = $2; my $o = $3; $s=~s/[<>]//g; $p=~s/[<>]//g; # Is it an object literal? if ($o=~/^\"/) { $o=~s/"//g; print "INSERT INTO triples VALUES ('$s', '$p', NULL, '$o');\n"; } else { $o=~s/[<>]//g; print "INSERT INTO triples VALUES ('$s', '$p', '$o', NULL);\n"; } } This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,6 @@ CREATE TABLE triples ( s TEXT NOT NULL, p TEXT NOT NULL, o TEXT DEFAULT NULL, olit TEXT DEFAULT NULL ); This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,5 @@ # something like this, I can't remember exactly sqlite3 triples < triples.sql cat n3file.n3 | n3tosql.pl | sqlite triples