Modelling Property Listing (with XDb2) -
02-04-2005
, 02:43 PM
The following script models a property listing using an experimental
db. It models a $200,000 single-family property with MLS# A2868Z. It
has 3 bedroom. The master bedroom is 25x30 and has biege Dupont carpet
that was installed 1/1/2000. The second bedroom is 12x15 and has pink
and purple carpet. The third bedroom is 12x15 and has hardwood flooring
that was installed 1/2/1990 and needs resurfacing. It has 3 bathrooms.
The master bathroom has brass finished Moen faucets. The second is a
hall bathroom and the third a half bathroom. It has a 2-car attached
garage. It has 2 fireplaces, the first is made of brick and its hearth
is made of stone. The second fireplace is made of stone and its hearth
is made of stone also. The 15x20 kitchen has cork flooring and the
following appliances: a white Maytag dishwasher, an Amana electric
range, and a Sears side-by-side fridge that is brand new. Details at
www.xdb2.com/example/ex117.asp
// Create items in directory to classify properties.
(CREATE *property.item ~in = dir)
(CREATE *single-family.item ~in = dir)
(CREATE *MLS#.item ~in = dir)
// Create items in directory to classify rooms.
(CREATE *room.item ~in = dir)
(CREATE *bedroom.item ~in = dir)
(CREATE *master bedroom.item ~in = dir)
(CREATE *bathroom.item ~in = dir)
(CREATE *master bathroom.item ~in = dir)
(CREATE *hall bathroom.item ~in = dir)
(CREATE *half bathroom.item ~in = dir)
(CREATE *kitchen.item ~in = dir)
(CREATE *garage.item ~in = dir)
(CREATE *fireplace.item ~in = dir)
(CREATE *hearth.item ~in = dir)
(CREATE *carpet.item ~in = dir)
(CREATE *flooring.item ~in = dir)
(CREATE *appliance.item ~in = dir)
(CREATE *dishwasher.item ~in = dir)
(CREATE *range.item ~in = dir)
(CREATE *fridge.item ~in = dir)
(CREATE *fixture.item ~in = dir)
(CREATE *faucet.item ~in = dir)
(CREATE *mfg.item ~in = dir)
(CREATE *material.item ~in = dir)
(CREATE *finish.item ~in = dir)
(CREATE *style.item ~in = dir)
(CREATE *color.item ~in = dir)
(CREATE *size.item ~in = dir)
(CREATE *price.item ~in = dir)
(CREATE *installed.item ~in = dir)
(CREATE *misc.item ~in = dir)
// Create the verb 'has'
(CREATE *has.cls = verb)
// Create a property.
(CREATE *.cls = property
& it.cls = single-family
& it.name = 3/2.5/2 Ranch
& it.MLS# = +A2868Z
& it.price = +200000
& it.has = (CREATE *.cls = room
_ & it.cls = bedroom
_ & it.cls = master bedroom
_ & it.size = +25x30
_ & it.has = (CREATE *.cls = carpet
_ & it.color = +beige
_ & it.mfg = +Dupont
_ & it.installed = +1/2/2000))
& it.has = (CREATE *.cls = room
_ & it.cls = bedroom
_ & it.size = +12x15
_ & it.has = (CREATE *.cls = carpet
_ & it.color = +pink
_ & it.color = +purple))
& it.has = (CREATE *.cls = room
_ & it.cls = bedroom
_ & it.size = +12x15
_ & it.has = (CREATE *.cls = flooring
_ & it.material = +hard wood
_ & it.installed = +1/2/1990
_ & it.misc = +Needs resurfacing))
& it.has = (CREATE *.cls = room
_ & it.cls = bathroom
_ & it.cls = master bathroom
_ & it.has = (CREATE *.cls = fixture
_ & it.cls = faucet
_ & it.finish = +brass
_ & it.mfg = +Moen))
& it.has = (CREATE *.cls = room
_ & it.cls = bathroom
_ & it.cls = hall bathroom)
& it.has = (CREATE *.cls = room
_ & it.cls = bathroom
_ & it.cls = half bathroom)
& it.has = (CREATE *.cls = room
_ & it.cls = garage
_ & it.size = +2-car
_ & it.style = +attached)
& it.has = (CREATE *.cls = fireplace
_ & it.material = +brick
_ & it.has = (CREATE *.cls = hearth
_ & it.material = +stone))
& it.has = (CREATE *.cls = fireplace
_ & it.material = +stone
_ & it.has = (CREATE *.cls = hearth
_ & it.material = +stone))
& it.has = (CREATE *.cls = room
_ & it.cls = kitchen
_ & it.size = +15x20
_ & it.has = (CREATE *.cls = flooring
_ & it.material = +cork)
_ & it.has = (CREATE *.cls = appliance
_ & it.cls = dishwasher
_ & it.color = +white
_ & it.mfg = +Maytag)
_ & it.has = (CREATE *.cls = appliance
_ & it.cls = range
_ & it.style = +electric
_ & it.mfg = +Amana)
_ & it.has = (CREATE *.cls = appliance
_ & it.cls = fridge
_ & it.style = +Side-by-side
_ & it.mfg = +Sears
_ & it.misc = +Brand new))
)
// Find propertis that have a bedroom with purple carpeting
// and a kitchen with a Sears fridge.
// Finds above property.
(SELECT *.cls=property
_ & *.has=(*.cls=bedroom & *.has=(*.cls=carpet & *.color=purple))
_ & *.has=(*.cls=kitchen & *.has=(*.cls=fridge & *.mfg=Sears))) |