def test_art_setter(self): p = model.ManMadeObject("a", art=1) p.label = "a" pj = p._toJSON() self.assertFalse(pj.get('classified_as', None)) vocab.add_art_setter() p2 = vocab.Painting("b", art=1) p2j = p2._toJSON()
# Sold by the estate of Jeanne Baptiste d'Albert de Luynes from cromulent.model import factory, TimeSpan, Aggregation, Actor, Place from cromulent.vocab import Painting, add_art_setter, LotNumber, Purchase, Description add_art_setter() acq = Purchase() lot = Aggregation(label="Verrue sale, lot 87") acq2 = Purchase() obj = Painting("http://www.getty.edu/art/collection/objects/882/rembrandt-harmensz-van-rijn-the-abduction-of-europa-dutch-1632/", label="The Abduction of Europa", art=1) est = Actor(label="The estate of Jeanne Baptiste d'Albert de Luynes, comtesse de Verrue") lot.identified_by = LotNumber(value="87") lot.aggregates = obj # Date of Acquisition date = TimeSpan() date.begin_of_the_begin = "1737-03-27T00:00:00Z" date.end_of_the_end = "1737-03-27T23:59:59Z" # Description des = Description(value="1736 - 1737: Estate of Jeanne Baptiste d'Albert de Luynes, comtesse de Verrue, 1670 - 1736 [sold, Verrue sale, Paris, March 27, 1737, lot 87.]") acq.used_specific_object = lot acq.part = acq2 acq2.timespan = date acq2.transferred_title_from = est acq2.transferred_title_of = obj
basedir = site['base_url'] egdir = site['var']['exampleDir'] baseUrl = "%s://%s%s%s%s/" % (scheme, host, port, basedir, egdir) contextUrl = "%s://%s%s%sns/v1/linked-art.json" % (scheme, host, port, basedir) factory.base_url = baseUrl factory.base_dir = "content/%s" % egdir factory.context_uri = contextUrl # The vast majority of nodes should be blank nodes # only the top node needs an id # So use ident="auto int-per-segment" on top factory.auto_assign_id = False factory.auto_id_type = "int-per-segment" vocab.add_art_setter() vocab.add_attribute_assignment_check() vocab.conceptual_only_parts() factory.id_type_label = True # Try to load in the context only once ctxt = factory.context_json['@context'] # Profile definition fn = os.path.join(os.path.dirname(cromulent.__file__), 'data') fn += "/crm-profile.json" fh = open(fn) d = fh.read() fh.close() linked_art_profile = json.loads(d)