Skip to content

Instantly share code, notes, and snippets.

View awead's full-sized avatar
🏠
Working from home

Adam Wead awead

🏠
Working from home
View GitHub Profile
irb(main):001:0> f = GenericFile.new
LocalAuthority Load (0.1ms) SELECT "local_authorities".* FROM "local_authorities" WHERE "local_authorities"."name" = 'lc_subjects' LIMIT 1
LocalAuthority Load (0.1ms) SELECT "local_authorities".* FROM "local_authorities" WHERE "local_authorities"."name" = 'lexvo_languages' LIMIT 1
LocalAuthority Load (0.1ms) SELECT "local_authorities".* FROM "local_authorities" WHERE "local_authorities"."name" = 'lc_genres' LIMIT 1
Using the default fedora.yml that comes with active-fedora. If you want to override this, pass the path to fedora.yml to ActiveFedora - ie. ActiveFedora.init(:fedora_config_path => '/path/to/fedora.yml') - or set Rails.root and put fedora.yml into #{Rails.root}/config.
ActiveFedora: loading fedora config from /Users/awead/.gem/ruby/2.1.1/bundler/gems/active_fedora-331a64092daf/config/fedora.yml
Using the default fedora.yml that comes with active-fedora. If you want to override this, pass the path to fedora.yml to ActiveFedora - ie. ActiveFedora.
> f.content.versions.count
=> 9
> f.content.versions.last
=> #<RDF::URI:0x3fe0d263fc5c URI:http://127.0.0.1:8983/fedora/rest/dev/p8/41/8w/01/p8418w01t/content/fcr:versions/87a0a8c317f1e71754f3c2-6da1-4288-b64f-930d12753452>
> f.content.versions.last.path.split("/").last
=> "87a0a8c317f1e71754f3c2-6da1-4288-b64f-930d12753452"
@awead
awead / gist:c8c0fd01261054eecf64
Created September 17, 2014 21:19
Fake PBCore namespace and RDF vocabs for PBCore
INSERT {
<http://www.pbcore.org/v2/> <http://purl.org/vocab/vann/preferredNamespacePrefix> "pbcore"
} WHERE {
}
/*
* This is not actual RDF for PBCore, but a test to see if you can assign PBCore elements as Fedora4 attributes
*/
[pbcore:elements] mixin
2014-09-22 11:14:52 -0400 (26874) Rendering 500 page due to exception: #<NoMethodError: undefined method `label' for nil:NilClass> - ["/opt/heracles/deploy/scholarsphere/shared/bundle/ruby/2.1.0/gems/blacklight-5.5.3/app/helpers/blacklight/configuration_helper_behavior.rb:85:in `facet_field_label'", "/opt/heracles/deploy/scholarsphere/shared/bundle/ruby/2.1.0/gems/blacklight-5.5.3/app/helpers/blacklight/render_constraints_helper_behavior.rb:72:in `block in render_filter_element'", "/opt/heracles/deploy/scholarsphere/shared/bundle/ruby/2.1.0/gems/blacklight-5.5.3/app/helpers/blacklight/render_constraints_helper_behavior.rb:70:in `map'", "/opt/heracles/deploy/scholarsphere/shared/bundle/ruby/2.1.0/gems/blacklight-5.5.3/app/helpers/blacklight/render_constraints_helper_behavior.rb:70:in `render_filter_element'", "/opt/heracles/deploy/scholarsphere/shared/bundle/ruby/2.1.0/gems/blacklight-5.5.3/app/helpers/blacklight/render_constraints_helper_behavior.rb:54:in `block in render_constraints_filters'", "/opt/heracles
@awead
awead / gist:e4aff26ad98465cf7593
Created September 22, 2014 17:01
Index failure
scholarsphere:sf268912r: #<RSolr::Error::Http: RSolr::Error::Http - 400 Bad Request\nError: {'responseHeader'=>{'status'=>400,'QTime'=>1},'error'=>{'msg'=>'Illegal character ((CTRL-CHAR, code 11))\n at [row,col {unknown-source}]: [1,5795]','code'=>400}}\n\nRequest Data: \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?><add><doc><field name=\\\"system_create_dtsi\\\">2014-04-02T20:41:01Z</field><field name=\\\"system_modified_dtsi\\\">2014-09-10T10:36:27Z</field><field name=\\\"object_state_ssi\\\">A</field><field name=\\\"active_fedora_model_ssi\\\">GenericFile</field><field name=\\\"id\\\">scholarsphere:sf268912r</field><field name=\\\"object_profile_ssm\\\">{\\\"datastreams\\\":{\\\"DC\\\":{\\\"dsLabel\\\":\\\"Dublin Core Record for this object\\\",\\\"dsVersionID\\\":\\\"DC1.0\\\",\\\"dsCreateDate\\\":\\\"2014-04-02T20:41:01Z\\\",\\\"dsState\\\":\\\"A\\\",\\\"dsMIME\\\":\\\"text/xml\\\",\\\"dsFormatURI\\\":\\\"http://www.openarchives.org/OAI/2.0/oai_dc/\\\",\\\"dsControlGroup\\\":\\\"X\\\",\\\"dsSize\\\
/Users/awead/.gem/ruby/2.1.2/gems/actionpack-4.1.6/lib/action_controller/base.rb:164:in `<module:ActionController>': uninitialized constant ActionController::Metal (NameError)
from /Users/awead/.gem/ruby/2.1.2/gems/actionpack-4.1.6/lib/action_controller/base.rb:5:in `<top (required)>'
from /Users/awead/.gem/ruby/2.1.2/gems/responders-1.1.1/lib/responders.rb:1:in `<top (required)>'
from /Users/awead/.gem/ruby/2.1.2/gems/devise-3.4.0/lib/devise.rb:7:in `<top (required)>'
from /Users/awead/Projects/Github/projecthydra/sufia/spec/spec_helper.rb:6:in `require'
from /Users/awead/Projects/Github/projecthydra/sufia/spec/spec_helper.rb:6:in `<top (required)>'
from /Users/awead/Projects/Github/projecthydra/sufia/spec/actors/generic_file/actor_spec.rb:1:in `require'
from /Users/awead/Projects/Github/projecthydra/sufia/spec/actors/generic_file/actor_spec.rb:1:in `<top (required)>'
from /Users/awead/.gem/ruby/2.1.2/gems/rspec-core-3.1.6/lib/rspec/core/configuration.rb:1105:in `load'
from /Users/awead/.gem/ruby/2.
@awead
awead / gist:787bdd31c6182db77230
Created October 28, 2014 16:01
curl -H "Accept: text/turtle" http://localhost:8983/fedora/rest/test/4c/e0/ee/93/4ce0ee93-7bfb-4745-aaaa-62c7ce0cf7e5/fcr:versions
@prefix dc: <http://purl.org/dc/elements/1.1/> .
@prefix nt: <http://www.jcp.org/jcr/nt/1.0> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix fcrepo: <http://fedora.info/definitions/v4/repository#> .
@prefix ns001: <http://purl.org/dc/terms/> .
@prefix test: <info:fedora/test/> .
@prefix fedoraconfig: <http://fedora.info/definitions/v4/config#> .
@prefix image: <http://www.modeshape.org/images/1.0> .
@prefix xs: <http://www.w3.org/2001/XMLSchema> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@awead
awead / gist:960301e1b0e39742fd6b
Created October 29, 2014 17:22
Curl example to make something versionable
curl -X PATCH -H "Content-type: application/sparql-update" --data-binary "insert data { <http://localhost:8983/fedora/rest/test/81/e3/aa/db/81e3aadb-e54e-423f-9ac3-85d96c726aa3/descMetadata/fcr:versions> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.jcp.org/jcr/mix/1.0versionable> . }" http://localhost:8983/fedora/rest/test/81/e3/aa/db/81e3aadb-e54e-423f-9ac3-85d96c726aa3/descMetadata/fcr:versions
@awead
awead / gist:219b6055e08b1a5bd8c3
Created November 13, 2014 17:00
has versions
def has_verisons?
ActiveFedora.fedora.connection.get(versions_url)
true
rescue Ldp::Error
false
end
end
@awead
awead / gist:7025154f9c9674253ade
Created January 8, 2015 20:02
Scholarsphere fedora-4/develop failure
GenericFilesController::create rescued ActionView::MissingTemplate
Missing template generic_files/jq_upload, application/jq_upload with {:locale=>[:en], :formats=>[:json], :variants=>[], :handlers=>[:erb, :builder, :raw, :ruby, :coffee, :haml]}. Searched in:
* "/Users/awead/Projects/Github/psu-stewardship/scholarsphere/app/views"
* "/Users/awead/Projects/Github/psu-stewardship/scholarsphere/.bundle/ruby/2.1.0/gems/devise-3.2.4/app/views"
* "/Users/awead/Projects/Github/psu-stewardship/scholarsphere/.bundle/ruby/2.1.0/bundler/gems/sufia-81d7d2b23292/app/views"
* "/Users/awead/Projects/Github/psu-stewardship/scholarsphere/.bundle/ruby/2.1.0/gems/mailboxer-0.12.4/app/views"
* "/Users/awead/Projects/Github/psu-stewardship/scholarsphere/.bundle/ruby/2.1.0/gems/blacklight_advanced_search-5.1.2/app/views"
* "/Users/awead/Projects/Github/psu-stewardship/scholarsphere/.bundle/ruby/2.1.0/bundler/gems/browse-everything-d380e4b8c91a/app/views"
* "/Users/awead/Projects/Github/psu-stewardship/scholarsphere/.