Created
May 30, 2009 01:31
-
-
Save bdarcus/120320 to your computer and use it in GitHub Desktop.
This file contains 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 characters
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