Exemplo n.º 1
0
def main():
	f = open("ref_col.csv", "r")
	r = csv.reader(f)

	next(r) #Skip header
	headers = ["acq_by", "acq_from", "acq_date", "add_names", "avai_data", "cat", 
		"certified", "chem_comp", "CAS", "chem_form", "chem_name", "col_name", "color",
		"CI", "name", "comp_type", "contact", "email", "experiments", "fire", "formulation",
		"fbarcode", "geo_org", "grid_loc", "health", "manufacturer", "mass_vol", "mix_pigment",
		"mix_type", "MSDS", "nat_syn", "notes", "obarcode", "org_date", "other_safe", 
		"part_col", "phone", "phys_form", "prep", "reactivity", "samp_type", "typ_use",
		"warning", "borrower", "inv_status"]
	for counter, row in enumerate(r):
		rec = dict(zip(headers, row))
		# Testing first two rows
		if counter < 2: 
			s = ManMadeObject(label="Sample Object")

		# Sample Identification/General Information
			# AccessionNumber is used for now, will a new class Barcode - aat:300343361
			s.identified_by = Barcode(label="Full Barcode", value=rec['fbarcode']) 
			s.identified_by = Barcode(label="Old Barcode", value=rec['obarcode'])
			s.identified_by = Name(label="Common Name", value=rec['name'])
			s.identified_by = Name(label="Additional Names", value=rec['add_names'])
			
			# Sample Type
			if rec['samp_type']:
				s.classified_as = instances[rec['samp_type'].lower()]
			
			# Typical use
			if rec['typ_use']:
				s.as_general_use = instances[rec['typ_use'].lower()]
			
			# Physical Form
			if rec['phys_form']:
				pf = rec['phys_form'].split()
				if len(pf) < 4:
					i = 0
					while i <= 2:
						s.classified_as = instances[pf[i].lower().replace(',', '')]
						i += 1
						break
				else:
					s.referred_to_by = Description(label="Sample Type", value=rec['phys_form'])

			# Color
			if rec['color']:
				s.classified_as = instances[rec['color']]
			
			# Natural/Synthetic
			if rec['nat_syn']:
				s.classified_as = instances[rec['nat_syn'].lower()]
			elif rec[nat_syn] == "Unknown":
				s.classified_as = Type(label="Natural/Synthetic", value="Unknown") 

			# Grid Location: lab shelf/storage?
			loc = Place()
			if rec['grid_loc']:
				loc.identified_by = Identifier(label="Grid Location", value=rec['grid_loc'])
				s.current_location = loc 
			
			# Index (CI) No., Preparation, Certified Standard

		# Acquisition Information

			acq = Acquisition()
			gci = Department("http://www.getty.edu/conservation/", label="Getty Research Institute")
			s.changed_ownership_through = acq
			acq.transferred_title_to = gci
			# Acquisition Date
			if rec['acq_date']:
				acq.timespan = TimeSpan(label=rec['acq_date'])

			# Acquired by
			if rec['acq_by']:
				emp = Actor(label=rec['acq_by'])
				acq.carried_out_by = emp
				emp.member_of = gci

			# Acquired from, debating whether it should be Actor or Group,
			# so info of person in contact can be linked
			if rec['acq_from']:
				acq.transferred_title_from = Actor(label=rec['acq_from'])

			# Geographic Origin
			if rec['geo_org']:
				prod = Production()
				origin = Place(label="Geographic Origin")
				origin.identified_by = Name(value=rec['geo_org'])
				prod.took_place_at = origin
				s.produced_by = prod

			# Catalog No.
			if rec['cat']:
				s.identified_by = CatalogNumber(label="Catalog No.", value=rec['cat'])

		# Miscellaneous
			# Notes
			if rec['notes']:
				io = InformationObject(value=rec['notes'])
				io.classified_as = instances["notes"]





			print(factory.toString(s, compact=False))
Exemplo n.º 2
0
# print(factory.toString(obj, compact=False))





# Example of Ownership

# from cromulent.model import factory, Acquisition
# from cromulent.vocab import Painting, MuseumOrg, add_art_setter
# add_art_setter()
# acq = Acquisition("https://linked.art/example/activity/28", "Acquisition of Painting")
# org = MuseumOrg("https://linked.art/example/group/16", "Museum")
# obj = Painting("https://linked.art/example/object/62", "Painting", art=1)
# obj.current_owner = org
# org.acquired_title_through = acq 
# print(factory.toString(obj, compact=False))




# Example of Location

from cromulent.model import factory, Place
from cromulent.vocab import Painting, add_art_setter
add_art_setter()
loc = Place("https://linked.art/example/place/8", "Gallery W6")
obj = Painting("https://linked.art/example/object/63", "Painting", art=1)
obj.current_location = loc 
print(factory.toString(obj, compact=False))
Exemplo n.º 3
0
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)

e = MultiExhibition(label="The Age of Rembrandt")
d = TimeSpan(label="1966-1967")
d.begin_of_the_begin = "1966-10-10T00:00:00Z"
d.end_of_the_end = "1967-03-05T23:59:59Z"
e.timespan = d

e1 = Exhibition(label="Exhibition at first location")
c1 = Aggregation()
l1 = MuseumPlace(label="The Fine Arts Museums of San Francisco")
e1.took_place_at = l1
l1.part_of = Place(label="San Francisco")
d1 = TimeSpan(label="1966")
d1.begin_of_the_begin = "1966-10-10T00:00:00Z"
d1.end_of_the_end = "1966-11-13T23:59:59Z"
e1.timespan = d1
c1.aggregates = obj
e1.used_specific_object = c1

e2 = Exhibition(label="Exhibition at second location")
c2 = Aggregation()
l2 = MuseumPlace(label="Toledo Museum of Art")
e2.took_place_at = l2
l2.part_of = Place(label="Toledo")
d2 = TimeSpan(label="1966-1967")
d2.begin_of_the_begin = "1966-11-26T00:00:00Z"
d2.end_of_the_end = "1967-01-08T23:59:59Z"
Exemplo n.º 4
0
def main():
    f = open("ref_col.csv", "r")
    r = csv.reader(f)

    next(r)  #Skip header

    headers = [
        "acq_by", "acq_from", "acq_date", "add_names", "avai_data", "cat",
        "certified", "chem_comp", "CAS", "chem_form", "chem_name", "coll_name",
        "color", "CI", "name", "comp_type", "contact", "email", "experiments",
        "fire", "formulation", "fbarcode", "geo_org", "grid_loc", "health",
        "manufacturer", "mass_vol", "mix_pigment", "mix_type", "MSDS",
        "nat_syn", "notes", "obarcode", "org_date", "other_safe", "part_coll",
        "phone", "phys_form", "prep", "reactivity", "samp_type", "typ_use",
        "warning", "borrower", "inv_status"
    ]

    for counter, row in enumerate(r):
        rec = dict(zip(headers, row))
        # Testing first two rows
        if counter < 2:
            s = ManMadeObject(label=rec['name'])

            # Sample Identification/General Information

            s.identified_by = Barcode(label="Full Barcode",
                                      value=rec['fbarcode'])
            s.identified_by = Barcode(label="Old Barcode",
                                      value=rec['obarcode'])
            s.identified_by = PrimaryName(label="Common Name",
                                          value=rec['name'])
            s.identified_by = Name(label="Additional Names",
                                   value=rec['add_names'])

            # Sample Type
            if rec['samp_type']:
                try:
                    s.classified_as = instances[rec['samp_type'].lower()]
                except:
                    s.referred_to_by = Description(label="Sample Type",
                                                   value=rec['samp_type'])

            # Typical use
            if rec['typ_use']:
                use = rec['typ_use'].split('/')
                for i in range(len(use)):
                    try:
                        s.as_general_use = instances[use[i].lower().strip()]
                    except:
                        s.referred_to_by = Description(label="Typical Use",
                                                       value=use[i])

            # Physical Form
            if rec['phys_form']:
                pf = rec['phys_form'].split()

                if len(pf) < 4:
                    l = []

                    for i in range(len(pf)):
                        try:
                            s.classified_as = instances[pf[i].lower().replace(
                                ',', '').strip()]
                        except:
                            l.append(pf[i])

                    l_join = " ".join(l)

                    s.referred_to_by = Description(label="Physical Form",
                                                   value=l_join)

                else:
                    s.referred_to_by = Description(label="Physical Form",
                                                   value=rec['phys_form'])

            # Color
            if rec['color']:
                try:
                    s.classified_as = instances[rec['color'].lower()]
                except:
                    s.referred_to_by = Description(label="Color",
                                                   value=rec['color'])

            # Index (CI) Color

            # Natural/Synthetic
            if rec['nat_syn']:
                s.classified_as = instances[rec['nat_syn'].lower()]
            elif rec['nat_syn'] == "Unknown":
                s.classified_as = Type(label="Natural/Synthetic",
                                       value="Unknown")

            # Preparation : go to Production

            # Certified Standard

            # Grid Location: lab shelf/storage?
            loc = Place()
            if rec['grid_loc']:
                loc.identified_by = Identifier(label="Grid Location",
                                               value=rec['grid_loc'])
                s.current_location = loc

        # Chemical Information
        # Chemical Formula
            if rec['chem_form']:
                s.identified_by = Formula(value=rec['chem_form'])

            if rec['chem_name']:
                s.identified_by = Name(label="Chemical Name",
                                       value=rec['chem_name'])

            if rec['CAS']:
                s.identified_by = Identifier(label="Chemical (CAS) No.",
                                             value=rec['CAS'])

            if rec['comp_type']:
                comp_type = rec['comp_type'].lower()
                try:
                    s.classified_as = instances[comp_type]
                except:
                    s.classified_as = Type(label="Compound Type",
                                           value=rec['comp_type'])

            if rec['mix_type']:
                mix_type = rec['mix_type'].split('-')
                for i in mix_type:
                    s.classified_as = instances[i.lower().strip()]

        # Acquisition Information

            acq = Acquisition()

            s.changed_ownership_through = acq
            acq.transferred_title_to = v.dept['GCI']
            # Acquisition Date
            if rec['acq_date']:
                adate = rec['acq_date']
                tspan = TimeSpan(label=adate)
                if len(adate) == 4:
                    tspan.begin_of_the_begin = str(
                        parse(adate + 'January',
                              settings={'PREFER_DAY_OF_MONTH': 'first'}))
                    tspan.end_of_the_end = str(
                        parse(adate + 'January',
                              settings={'PREFER_DAY_OF_MONTH': 'first'}) +
                        timedelta(days=365))
                elif 'ca.' in adate or 'Spring' in adate:
                    y = adate.split()[1]
                    tspan.begin_of_the_begin = str(
                        parse(y + 'January',
                              settings={'PREFER_DAY_OF_MONTH': 'first'}))
                    tspan.end_of_the_end = str(
                        parse(y + 'January',
                              settings={'PREFER_DAY_OF_MONTH': 'first'}) +
                        timedelta(days=365))
                elif '-' in adate:
                    y = adate.split('-')
                    start_year = y[0].strip()
                    end_year = y[1].strip()
                    if len(start_year) == 4:
                        tspan.begin_of_the_begin = str(
                            parse(start_year + 'January',
                                  settings={'PREFER_DAY_OF_MONTH': 'first'}))
                        tspan.end_of_the_end = str(
                            parse(end_year + 'January',
                                  settings={'PREFER_DAY_OF_MONTH': 'first'}) +
                            timedelta(days=365))
                    else:
                        tspan.begin_of_the_begin = str(
                            parse(adate,
                                  settings={'PREFER_DAY_OF_MONTH': 'first'}))
                        tspan.end_of_the_end = str(
                            parse(adate,
                                  settings={'PREFER_DAY_OF_MONTH': 'last'}) +
                            timedelta(days=1))
                else:
                    tspan.begin_of_the_begin = str(
                        parse(adate, settings={'PREFER_DAY_OF_MONTH':
                                               'first'}))
                    tspan.end_of_the_end = str(
                        parse(adate, settings={'PREFER_DAY_OF_MONTH': 'last'})
                        + timedelta(days=1))

                acq.timespan = tspan

            # Acquired by
            if rec['acq_by']:

                p = rec['acq_by'].split('-')
                pname = p[0].split()

                agent = " ".join(pname)
                dpt = p[-1]

                if agent in v.person:
                    emp = v.person[agent]
                else:
                    emp = Person(label=agent)
                acq.carried_out_by = emp
                if dpt in v.dept:
                    emp.member_of = v.dept[dpt]

            # Part of Collection
            if rec['part_coll']:
                s.referred_to_by = LinguisticObject(label='Part of Collection',
                                                    value=rec['part_coll'])

            # Acquired from, debating whether it should be Actor or Group,
            # so info of person in contact can be linked

            global seller

            if rec['acq_from']:
                if rec['acq_from'] in v.sellers:
                    seller = v.sellers[rec['acq_from'].strip()]
                else:
                    seller = Actor(label=rec['acq_from'].strip())
                acq.transferred_title_from = seller

            # Collection Name
            if rec['coll_name']:
                coll = v.collection[rec['coll_name']]
                s.aggregated_by = coll
                coll_creation = Creation()
                coll.created_by = coll_creation
                coll_creation.carried_out_by = seller

            # Contact name
            if rec['contact']:
                if rec['contact'] in v.contact:
                    contact_name = v.contact[rec['contact'].strip()]
                else:
                    s.related_entity = contact_name
                # Email
                if rec['email']:
                    contact_name.contact_point = EMail(label="E-Mail",
                                                       value=rec['email'])

            # Phone number: could be either the number of the contact person,
            # or of the acquired_from
            # if rec['phone']:

            prod = Production()
            s.produced_by = prod

            # Preparation
            if rec['prep']:
                prep = SamplePreparation(value=rec['prep'])
                prod.technique = prep
                if rec['formulation']:
                    prep.referred_to_by = Formulation(value=rec['formulation'])

            # Geographic Origin
            if rec['geo_org']:
                origin = Place(label="Geographic Origin")
                origin.identified_by = Name(value=rec['geo_org'])
                prod.took_place_at = origin

            # Manufacturer
            if rec['manufacturer']:
                if rec['manufacturer'] in v.manufacturers:
                    mfr = v.manufacturers[rec['manufacturer']]
                elif rec['manufacturer'] in v.sellers:
                    mfr = v.sellers[rec['manufacturer']]
                else:
                    mfr = Group(label=rec['manufacturer'])
                prod.carried_out_by = mfr

            # Catalog No.
            if rec['cat']:
                s.identified_by = CatalogNumber(label="Catalog No.",
                                                value=rec['cat'])

        # Miscellaneous

        # Origination Date
        # if rec['org_date']:
        # 	odate = rec['org_date']
        # 	t_span = TimeSpan(label=odate)
        # 	if len(adate) == 4:
        # 		t_span.begin_of_the_begin = str(parse(odate + 'January', settings={'PREFER_DAY_OF_MONTH': 'first'}))
        # 		t_span.end_of_the_end = str(parse(odate + 'January', settings={'PREFER_DAY_OF_MONTH': 'first'}) + timedelta(days=365))
        # 	elif 'ca.' in adate or 'pre' in adate:
        # 		y = odate.split()[1]
        # 		t_span.begin_of_the_begin = str(parse(y + 'January', settings={'PREFER_DAY_OF_MONTH': 'first'}))
        # 		t_span.end_of_the_end = str(parse(y + 'January', settings={'PREFER_DAY_OF_MONTH': 'first'}) + timedelta(days=365))
        # 	elif '-' in adate:
        # 		y = odate.split('-')
        # 		start_year = y[0].strip()
        # 		end_year = y[1].strip()
        # 		if len(start_year) == 4:
        # 			t_span.begin_of_the_begin = str(parse(start_year + 'January', settings={'PREFER_DAY_OF_MONTH': 'first'}))
        # 			t_span.end_of_the_end = str(parse(end_year + 'January', settings={'PREFER_DAY_OF_MONTH': 'first'}) + timedelta(days=365))
        # 		else:
        # 			t_span.begin_of_the_begin = str(parse(odate, settings={'PREFER_DAY_OF_MONTH': 'first'}))
        # 			t_span.end_of_the_end = str(parse(odate, settings={'PREFER_DAY_OF_MONTH': 'last'}) + timedelta(days=1))
        # 	else:
        # 		t_span.begin_of_the_begin = str(parse(odate, settings={'PREFER_DAY_OF_MONTH': 'first'}))
        # 		t_span.end_of_the_end = str(parse(odate, settings={'PREFER_DAY_OF_MONTH': 'last'}) + timedelta(days=1))

        # acq.timespan = t_span

        # Mass or Volume
            if rec['mass_vol']:
                mv = rec['mass_vol'].replace('appx.',
                                             '').replace('approx.',
                                                         '').split()
                if len(mv) == 2:
                    dim = MassVolume(value=mv[0])
                    s.dimension = dim
                    dim.unit = instances[mv[1].replace('.', '')]
                else:
                    try:
                        u = instances[(mv[1] + " " + mv[2]).replace('.', '')]
                        dim = MassVolume(value=mv[0])
                        s.dimension = dim
                        dim.unit = u
                    except:
                        s.referred_to_by = DimensionStatement(
                            label="Mass or Volume", value=rec['mass_vol'])

            # Experiments on Sample
            if rec['experiments']:
                s.referred_to_by = Description(label="Experiments on Sample",
                                               value=rec['experiments'])

            # Notes
            if rec['notes']:
                s.referred_to_by = Notes(value=rec['notes'])

        # Available Data

        # MSDS & Safety

        # Safety: classified_as or referred_to_by properties
            if rec['fire']:
                s.classified_as = FireSafety(value=rec['fire'])

            if rec['health']:
                health_safe = Safety(label="Health Safety",
                                     value=rec['health'])
                s.classified_as = health_safe
                health_safe.classified_as = instances['health']

            if rec['reactivity']:
                react_safe = Safety(label="Reactivity Safety",
                                    value=rec['reactivity'])
                s.classified_as = react_safe
                react_safe.classified_as = instances['reactivity']

            if rec['other_safe']:
                other_safe = Safety(label="Other Safety",
                                    value=rec['other_safe'])
                s.classified_as = other_safe
                other_safe.classified_as = instances['other']

            print(factory.toString(s, compact=False))
Exemplo n.º 5
0
	BeginningOfExistence, EndOfExistence, Place, LinguisticObject
from cromulent.vocab import Painting, add_art_setter, Description

add_art_setter()

acq = Acquisition()
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)

# Info of acquirer

p = Person(label="Jacques Specx")
birth = BeginningOfExistence(label="Birth")
tob = TimeSpan(label="1585")
tob.begin_of_the_begin = "1585-01-01"
tob.end_of_the_end = "1585-12-31"
pob = Place(label="Amsterdam")
pob.part_of = Place(label="The Netherlands")
birth.timespan = tob 
birth.took_place_at = pob
death = EndOfExistence(label="Death")
tod = TimeSpan(label="1652")
tod.begin_of_the_begin = "1652-01-01"
tod.end_of_the_end = "1652-12-31"
pod = Place(label="Amsterdam")
pod.part_of = Place(label="The Netherlands")
death.timespan = tod 
death.took_place_at = pod
p.brought_into_existence_by = birth
p.taken_out_of_existence_by = death

# Date of Acquisition
Exemplo n.º 6
0
w_in.unit = instances["inches"]
obj.dimension = h_cm
obj.dimension = w_cm
obj.dimension = h_in
obj.dimension = w_in

# Materials
sup = SupportPart(label="Single oak panel")
obj.made_of = instances["oil"]
obj.part = sup
sup.made_of = instances["oak"]

# Current location
loc = Gallery(label="Gallery E205")
mu = MuseumPlace(label="Museum East Pavillion")
place = Place(label="The Getty Center")
loc.part_of = mu
mu.part_of = place
obj.current_location = loc

# Signature
sign = Signature(label="RHL [in ligature]. van Rÿn.1632")
bpart = BottomPart(label="Lower Right")
bpart.carries = sign
obj.part = bpart

# Description
des = Description(
    label="Description",
    value=
    "In the Metamorphoses, the ancient Roman poet Ovid told a story about the god Jupiter, who disguised himself as a white bull in order to seduce the princess Europa away from her companions and carry her across the sea to the distant land that would bear her name.\nDuring his long career Rembrandt rarely painted mythological subjects. Here he conveys a narrative story through dramatic gesture and visual effects. Bewildered, Europa grasps the bull's horn, digs her fingers into his neck, and turns back to look at her companions on the water's edge. One young woman falls to the ground and raises her arms in alarm, dropping the flower garland intended for the bull's neck into her lap, while her friend clasps her hands in consternation and watches helplessly. The carriage driver above rises to his feet and stares at the departing princess in horror. In the background, a city shrouded in mist extends along the horizon, perhaps serving as an allusion to the ancient city of Tyre as well as to contemporary Amsterdam.The dark thicket of trees to the right contrasts with the pink and blue regions of the sea and sky. Sunlight breaks through the clouds and reflects off the water, but the sky behind the trees is dark and foreboding.\nA master of visual effects, Rembrandt took pleasure in describing the varied textures of sumptuous costumes and glittering gold highlights on the carriage and dresses."
Exemplo n.º 7
0
	BeginningOfExistence, EndOfExistence, Place
from cromulent.vocab import Painting, add_art_setter, Description

add_art_setter()

acq = Acquisition(label="Held in trust by the estate")
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)

# Info of acquirer

p = Person(label="Jeanne Baptiste d'Albert de Luynes, comtesse de Verrue")
birth = BeginningOfExistence(label="Birth")
tob = TimeSpan(label="1670")
tob.begin_of_the_begin = "1670-01-01T00:00:00Z"
tob.end_of_the_end = "1670-12-31T23:59:59"
pob = Place(label="Paris")
pob.part_of = Place(label="France")
birth.timespan = tob 
birth.took_place_at = pob
death = EndOfExistence(label="Death")
tod = TimeSpan(label="1736")
tod.begin_of_the_begin = "1736-01-01T00:00:00Z"
tod.end_of_the_end = "1736-12-31T23:59:59Z"
pod = Place(label="Savoy")
pod.part_of = Place(label="France")
death.timespan = tod 
death.took_place_at = pod
p.brought_into_existence_by = birth
p.taken_out_of_existence_by = death

# Estate