Exemple #1
0
    def testArticleMapping(self):
        self.assertEqual(0, len(self.graph))
        a = Article()
        self.assertTrue(isinstance(list(self.graph.subjects())[0], BNode))
        self.assertEqual(1, len(self.graph)) # bnode--rdf:type-->bibo:article

        a.title = "Testtitle" # + bnode--dc:title--> "Testtitle"
        self.assertEqual(2, len(self.graph)) 
        self.assertEqual(1, len(list(self.graph.triples((None,DC['title'], None)))))
        self.assertEqual(a.title, "Testtitle")

        a.creators = ["Testcreator1", "Testcreator2"]
        #a.creators = "Testcreator" XXX hoe doe je assertRaises met assignment?

        a.abstract = "Testabstract"
        a.sPg = 1
        a.ePg = 3
        #TODO check string & int types in rdf
        a.auStr = "Author 1, author 2"
        a.section = "Testsection"
        a.ivrs = ["Testintervieuwer"]
        a.ives = [u"Testgeïntervieuwde"]
        self.assertEqual(11, len(self.graph))
Exemple #2
0
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"]
a1.abstract = "Does Obama’s victory signal a political turning point comparable to 1980 or 1932? Mike Davis maps county-level changes, from below—minority-majority demographics, subprime suburbs, white-collar financial worries—catalysed by the 2008 campaign. From above, realignment of American capital behind the Silicon President."
a1.issue = nlr56

a2 = Article("<tag:freedoms-triumph,2009-04-23>")
a2.creators = ["Dylan Riley"]
a2.title = "Freedom's Triumph?"
a2.abstract = "Reviving its classical definition, ‘rule of the propertyless’, Luciano Canfora recasts the story of democracy in Europe as one of successive defeats, with lessons from Louis Napoleon on the use of suffrage as legitimation for oligarchic rule. Dylan Riley assesses a remarkable historical polemic from the Italian philologist."
a2.issue = nlr56

a3 = Article("<tag:giovanni-arrighi,2009-04-22>")
a3.title = "Giovanni Arrighi: The Winding Paths of Capital"
a3.ivrs = ["David Harvey"]
a3.ives = ["Giovani Arrighi"]
a3.abstract = "The author of Long Twentieth Century and Adam Smith in Beijing, interviewed by David Harvey, on dispossession and development, capitalist crises, China’s future. The political education of a teenage factory-manager, via African liberation struggles and autonomia operaia; and influences—Braudel, Gramsci, Smith, Marx—in Arrighi’s work."