Viewing file: test_helper.py (3.82 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
def init(tester): tester.startTest("Init a Model")
from Ft.Rdf import Model, Statement, RDF_MS_BASE, RDF_SCHEMA_BASE from Ft.Rdf.Drivers import Memory d = Memory.DbAdapter('') d.begin() model = Model.Model(d)
VCARD = "http://4suite.org/nexus/rdfs/vcard#"
model.add([Statement.Statement('http://foo.com#molson', 'http://purl.org/dc/elements/1.1#Title', 'Mike Olson'), Statement.Statement('http://foo.com#molson', 'http://fourthought.com#spouse', 'http://foo.com#jolson'), Statement.Statement('http://foo.com#molson', 'http://fourthought.com#age', '27'), Statement.Statement('http://foo.com#jolson', 'http://purl.org/dc/elements/1.1#Title', 'Jessica Olson'), Statement.Statement('http://foo.com#jolson', 'http://fourthought.com#age', '27'), Statement.Statement('http://fourthought.com', 'http://fourthought.com#employee', 'http://foo.com#molson'), Statement.Statement('http://fourthought.com', 'http://purl.org/dc/elements/1.1#Title', 'Fourthought, Inc.'), Statement.Statement('http://foo.com#molson', '%stype' % RDF_MS_BASE, 'http://fourthought.com#Male'), Statement.Statement('http://foo.com#jolson', '%stype' % RDF_MS_BASE, 'http://fourthought.com#Female'), Statement.Statement('http://fourthought.com#Male', '%ssubClassOf' % RDF_SCHEMA_BASE, 'http://fourthought.com#Person'), Statement.Statement('http://fourthought.com#Female', '%ssubClassOf' % RDF_SCHEMA_BASE, 'http://fourthought.com#Person'),
Statement.Statement('http://foo.com#molson', 'http://fourthought.com#telephone', 'http://foo.com#T1'), Statement.Statement('http://foo.com#molson', 'http://fourthought.com#telephone', 'http://foo.com#T2'), Statement.Statement('http://foo.com#T1', '%stype' % RDF_MS_BASE, '%swork'%VCARD), Statement.Statement('http://foo.com#T1', '%stype' % RDF_MS_BASE, '%svoice'%VCARD), Statement.Statement('http://foo.com#T1', '%svalue' % RDF_MS_BASE, '555-1212'), Statement.Statement('http://foo.com#T2', '%stype' % RDF_MS_BASE, '%shome'%VCARD), Statement.Statement('http://foo.com#T2', '%stype' % RDF_MS_BASE, '%svoice'%VCARD), Statement.Statement('http://foo.com#T2', '%svalue' % RDF_MS_BASE, '555-2222'),
])
tester.testDone() return model
|