Skip to content

Instantly share code, notes, and snippets.

Avatar
🧊

tamsin johnson no-reply

🧊
  • UC Santa Barbara Library
  • United States
View GitHub Profile
View infinite_enum.rb
my_enum = (1..5).lazy.map { |i| i == 3 ? raise(StandardError) : i }
safe_enum = Enumerator.new do |y|
loop do
begin
y.yield my_enum.next
rescue => e
break if e.kind_of? StopIteration
end
end
View jcoyne.txt
RDF::Blazegraph::Repository
http://www.w3.org/ns/ldp#Container
10 Containers; 100 LDP-RS & LDP-NR per Container;
45 statements per LDP-RS; GET/HEAD x 5
user system total real
LDP-RS POST: 0.640000 0.020000 0.660000 ( 1.317389)
LDP-RS POST: 0.530000 0.020000 0.550000 ( 1.231923)
LDP-RS POST: 0.460000 0.030000 0.490000 ( 1.217985)
View gist:5217798316c02eaab9ac
# this works
marmotta=# LOAD 'auto_explain';
LOAD
marmotta=# SET auto_explain.log_min_duration = 0;
SET
marmotta=# SET auto_explain.log_buffers = true;
SET
marmotta=# SET auto_explain.log_analyze = true;
SET
@no-reply
no-reply / My Life.txt
Created Sep 3, 2015
My Life As a Turtle
View My Life.txt
puts RDF::Reader.for(:ttl).new(invalid, debug: true).dump :ttl
[1](3)parse(production): token :PREFIX, prod :turtleDoc, depth 0
[1](2) turtleDoc(:start:1): "@prefix"(PREFIX)
[1](3) parse(production): token :PREFIX prod :turtleDoc, prod_branch ["(", :ANON, :BASE, :BLANK_NODE_LABEL, :IRIREF, :PNAME_LN, :PNAME_NS, :PREFIX, "["], sequence [:_turtleDoc_1]
[1](3) parse(terms): todo {:prod=>:turtleDoc, :terms=>[:_turtleDoc_1]}, depth 1
[1](3) parse(token): accept :_turtleDoc_1
[1](3) parse(push): term :_turtleDoc_1, depth 1
[1](3) parse(production): token :PREFIX, prod :_turtleDoc_1, depth 1
[1](2) _turtleDoc_1(:start:1): "@prefix"(PREFIX)
[1](3) parse(production): token :PREFIX prod :_turtleDoc_1, prod_branch ["(", :ANON, :BASE, :BLANK_NODE_LABEL, :IRIREF, :PNAME_LN, :PNAME_NS, :PREFIX, "["], sequence [:statement, :turtleDoc]
View gist:1dea15856445bc42f6b3
:myAdminSet ldp:contains :file1, :file2 .
:myObject ldp:contains :fileContainer ;
pcdm:hasFile :file3 .
:fileContainer ldp:contains :file3 ;
ldp:hasMembershipResource :myObject ;
ldp:membershipPredicate pcdm:hasFile .
View fake_harvest.rb
opts = {uri:"http://repox.metro.org:8080/repox/OAIHandler",oai:{metadata_prefix:"mods",skip_set:["BusinessRecords","MusicParts","MusicScores","Programs","LBI_Periodicals","cia_menu","cdlc","dudleyo","JSY","p15109coll4","p16694coll39","p16694coll43","VHB011"]}}
# or whatever options you want to use, these are the real ESDN ones
activity = Krikri::Activity.create do |a|
a.agent = "Krikri::Harvesters::OAIHarvester"
a.opts = JSON.generate(opts)
end
n = 100 # or whatever test harvest size
View pdcm-related-files.ttl
View hasRelatedFile.ttl
:object1 a pcdm:Object ;
dc:title "I'm a thing" ;
ldp:contains :object2, :object3 ; # I'm told there's some use of an indirect container, here...
pcdm:hasMember :object2, :object3 . # ...but it seems orthogonal to this issue.
:object2 a pcdm:Object ;
ldp:contains :fileContainer1, :relatedFileContainer1 ;
pdcm:hasFile :blob1 ;
pdcm:hasRelatedFile :blob2 .
@no-reply
no-reply / DSL Notes.md
Last active Aug 29, 2015
DSL Reading Group Notes
View DSL Notes.md

Chapter 3

Patterns to Review : Nested Function; Method Chaining; Expression Builders; Symbol Table; Notification

  • The Krikri Mapping DSL does have a Semantic Model it is just a data structure rather than a Doman Model.
  • The mapping Semantic Model forms the basis for our notion of using a GUI front-end. We did this naturally because we were working in an OO language & thoughtful about separation of concerns.
  • We should look closely at Expression Builders as a pattern to be introduced in Krikri.
  • An internal DSL might be thought of as an added parsing layer, following the main language.