Skip to content

Instantly share code, notes, and snippets.

@bdarcus
Created May 30, 2009 01:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bdarcus/120320 to your computer and use it in GitHub Desktop.
Save bdarcus/120320 to your computer and use it in GitHub Desktop.
from rdflib import Namespace
from rdfalchemy import rdfSubject, rdfsSubject, rdfSingle, rdfMultiple
from rdfalchemy.orm import mapper
RS = Namespace('http://vocab.org/resourcelist/schema#')
class List(rdfSubject):
rdf_type = RS['List']
contains = rdfMultiple(RS.contains)
created = rdfSingle(RS.created)
def add_item(item):
contains.append(item)
def add_section(section):
contains.append(section)
class Section(rdfSubject):
rdf_type = RS['Section']
contains = rdfMultiple(RS.contains)
created = rdfSingle(RS.created)
next = rdfSingle(RS.next)
previous = rdfSingle(RS.previous)
class Item(rdfSubject):
rdf_type = RS['Item']
resource = rdfSingle(RS.resource)
next = rdfSingle(RS.next)
previous = rdfSingle(RS.previous)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment