Skip to content

Instantly share code, notes, and snippets.

View no-reply's full-sized avatar

tamsin woo no-reply

  • UC Santa Barbara Library
  • United States
View GitHub Profile
@no-reply
no-reply / at.rb
Last active August 29, 2015 14:05
Desired ActiveTriples Predicate -> Property Behavior
class Person < ActiveTriples::Resource
configure :type => RDF::FOAF.Person, :base_uri => 'http://example.org/people#'
property :name, :predicate => RDF::FOAF.name
end
class Organization< ActiveTriples::Resource
configure :type => RDF::FOAF.Organization, :base_uri => "http://example.org/orgs#"
property :name, :predicate => RDF::FOAF.name
end
@no-reply
no-reply / HydraRDFConnect.md
Created August 15, 2014 21:22
RDF in Hydra Workshop

RDF in Hydra Workshop

Tom Johnson & Karen Estlund

This workshop provides an overview of the current state of RDF on the Hydra platform. We will work through examples of modeling complex metadata and creating objects that use it. The content will highlight creative use of Hydra 7's RDF capabilities to manage controlled vocabularies and integrate with Linked Data sources. Participants should expect some technical content, but need not be developers to benefit.

@no-reply
no-reply / at-semantics.md
Last active August 29, 2015 14:05
Property-Predicate Semantics in ActiveTriples

Property-Predicate Semantics in ActiveTriples

ActiveTriples is an Object-to-Graph Mapper (OGM) providing ActiveModel friendly, ORM-like functionality for managing RDF resources and graphs as Objects in Ruby.

The library defines a Resource class, instances of which represent the equivalent concept in RDF. Resource objects encapsulate an individual RDF Resource (i.e. its identifier (URI or blank node), and relevant statements) creating a corresponding Object schema and API. The Object schema is strictly non-normative with respect to the data structure and content of the associated RDF graph. That is to say, it is a design goal of ActiveTriples that any arbitrary RDF graph should be readable and safely writeable using the library and compatible with any Object schema. To achieve this goal, it is necessary to specify a clear Object-Graph semanti

@no-reply
no-reply / test.rb
Last active August 29, 2015 14:05
Test for ActiveTriples#38
before do
class DummyLicense < ActiveTriples::Resource
property :title, :predicate => RDF::DC.title
end
class DummyResource < ActiveTriples::Resource
configure :type => RDF::URI('http://example.org/SomeClass')
property :license, :predicate => RDF::DC.license, :class_name => DummyLicense
property :title, :predicate => RDF::DC.title
property :replaces, :predicate => RDF::DC.replaces
@no-reply
no-reply / gist:0033ba310300c311e0c3
Created August 27, 2014 16:20
Ansible Restart Unicorn
NOTIFIED: [frontend | restart unicorn] ****************************************
<192.168.50.6> ESTABLISH CONNECTION FOR USER: tom
<192.168.50.6> REMOTE_MODULE service name=unicorn_frontend state=reloaded
<192.168.50.6> EXEC ['ssh', '-C', '-tt', '-vvv', '-o', 'ControlMaster=auto', '-o', 'ControlPersist=60s', '-o', 'ControlPath=/home/tjohnson/.ansible/cp/ansible-ssh-%h-%p-%r', '-o', 'KbdInteractiveAuthentication=no', '-o', 'PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey', '-o', 'PasswordAuthentication=no', '-o', 'User=tom', '-o', 'ConnectTimeout=10', '192.168.50.6', "/bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1409156132.72-28508570131040 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1409156132.72-28508570131040 && echo $HOME/.ansible/tmp/ansible-tmp-1409156132.72-28508570131040'"]
<192.168.50.6> PUT /tmp/tmp2jNjg7 TO /home/tom/.ansible/tmp/ansible-tmp-1409156132.72-28508570131040/service
<192.168.50.6> EXEC ['ssh', '-C', '-tt', '-vvv', '-o', 'ControlMaster=auto', '-o', 'Contr
@no-reply
no-reply / DPLAvalidation.md
Created September 4, 2014 22:31
DPLA Validation Levels

Validation Use Cases

Basic Validation

  • Presence of Required Fields
  • Cardinality of Fields with Max Values
  • Domain & Range Restrictions on Properties
  • Controlled Vocabulary Compliance
require 'spec_helper'
require 'mongoid'
describe 'Mongoid integration' do
before do
class Person
include Mongoid::Document
include ActiveTriples::Identifiable
configure :base_uri => 'http://example.org/mongoid/'
@no-reply
no-reply / errors.txt
Created September 11, 2014 14:46
Akara module_config
In [10]: DplaGeonamesGeocoder().enrich_place(place)
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-10-346d292dde39> in <module>()
----> 1 DplaGeonamesGeocoder().enrich_place(place)
/home/tjohnson/src/dpla/ingestion/ENV/lib/python2.7/site-packages/dplaingestion/akamod/geocode.pyc in enrich_place(self, place)
295 hierarchy = self.reverse_geocode_hierarchy(lat, lng, ["PCLI", # Country
296 "ADM1", # State
--> 297 "ADM2"]) # County
@no-reply
no-reply / CHODatastream.rb
Last active August 29, 2015 14:06
Hydra Connect RDF Workshop Walkthrough
# lib/models/datastream.rb
class CHODatastream < ActiveFedora::NtriplesRDFDatastream
property :title, predicate: RDF::DC.title
property :creator, predicate: RDF::DC.creator
property :date, predicate: RDF::DC.date
property :location, predicate: RDF::DC.spatial
end
@no-reply
no-reply / error.py
Created September 16, 2014 15:54
What is this error about?
{ 'sourceResource': { 'DIFFERENT VALUES': { 'CURRENT DICT: ': { u'spatial': [ { u'coordinates': u'39.95233, -75.16379',
u'country': u'United States',
u'county': u'Philadelphia County',
u'name': u'Philadelphia, PA',
u'state': u'Pennsylvania'},
{ u'coordinates': u'37.77493, -122.41942',
u'country': u'United States',
u'county': u'San Francisco County',
u'name': u'San Francisco, CA',