def testPeriodical(self): p = Periodical() p.title = "Periodical title" p.issn = "1234-4321" p.publisher = "Periodical publisher" p.shortTitle = "pertitle" self.assertEqual(5, len(self.graph)) self.assertEqual('http://localhost:5000/serials/pertitle', p.locUrl)
def testTraversal(self): a = Article() i = Issue() p = Periodical() pr = Person() eg = EditorGroup() eg.periodical = p pr.name = "John Malcovitshy" p.title = "Periodicaltitle" eg.members = [pr] a.issue = i i.periodical = p a.makers = [pr] self.assertEqual(a.issue.periodical.title, "Periodicaltitle") self.assertEqual(a.makers[0].name, "John Malcovitshy") self.assertEqual(eg.members[0].name, "John Malcovitshy") self.assertEqual(eg.periodical.title, "Periodicaltitle") self.assertEqual(12, len(self.graph))
from model.namespaces import * from rdfalchemy import rdfSubject, rdfSingle, rdfMultiple from rdfalchemy.orm import mapper from rdflib import ConjunctiveGraph, URIRef #initialize main graph g = ConjunctiveGraph = rdfSubject.db ############# # NLR 56 # ############# nlr = Periodical("<http://rdf.freebase.com/rdf/en.new_left_review>") nlr.title = "New Left Review" nlr.issn = "0028-6060" nlr.shortTitle = "nlr" nlr.homepage = URIRef("http://www.newleftreview.org/") nlr56 = Issue("<tag:new-left-review-issue-56,2009-04-23>") nlr56.periodical = nlr nlr56.number = 56 nlr56.volume = 2 nlr56.title = "New Left Review 56 March-April 2009" nlr56.pubdate = "2009-03-09" nlr56.coverImg = URIRef("http://www.newleftreview.org/assets/images/NLR56cover.gif") a1 = Article("<tag:obama-at-manassas,2009-04-23>") a1.title = "Obama at Manassas" a1.creators = ["Mike Davis"]