You are on page 1of 7

Assignment 1 Knowledge Base Systems:

Knowledge base for Real Estate Domain

Group 10: Bas Kloet, Christian Luijten, Paul van Tilburg

28th November 2005

Part 1a The semantic network


First, we defined three functions of housing items; Office, Living, and Leisure
because we want to build a KBS, suited for profiling and finding housing items
that can be either rented or bought.
We distinguished certain building types; Office building, Mansion, Villa, Apart-
ment, House, Bungalow, and Ranch. Because of avoiding multiple inheritance
we decided to group common building types per housing item function.
Instances were added to those building types with certain sets of attributes/fea-
tures; located-in, area, floor-area, nr-of-floors, nr-of-rooms, nr-of-bedrooms,
price, has-garage, and has-garden. Some default attribute values are defined
on the building types which are inherited or overridden by the instances.
The specified housing items and attributes are displayed in the semantic network
diagram group10 ass1 diagram.pdf.

Part 1b Facts and rules


The translation1 and relations2 of the semantic network diagram of Part 1a in
Prolog.
% Facts

% Office buildings
office building (dorgelolaan2) % Dorgelolaan 2 is an office building
office building ( jfklaan5 )
office building (kerkstraat24)
1 group10 ass1 factsrules.pl
2 group10 ass1 relations.pl

1
located in (dorgelolaan2, eindhoven) % Dorgelolaan 2 is located in Eindhoven
located in (jfklaan5 , eindhoven−c)
located in (kerkstraat24, breda)
10 floor area (dorgelolaan2, 100) % Dorgelolaan 2 has a floor area of 100mˆ2
floor area (jfklaan5 , 900)
floor area (kerkstraat24, 1200)
nr of flrs (dorgelolaan2, 1) % Dorgelolaan 2 has 2 floors
nr of flrs (jfklaan5 , 3)
nr of flrs (kerkstraat24, 2)
price (dorgelolaan2, 200) % Dorgelolaan 2 costs 200,000 euros
price (jfklaan5 , 100)
price (kerkstraat24, 900)
nr of rooms(dorgelolaan2, 1) % Dorgelolaan 2 has 1 room
20 nr of rooms(jfklaan5 , 21)
nr of rooms(kerkstraat24, 6)
garage(dorgelolaan2, no) % Dorgelolaan 2 has no garage
garage(jfklaan5 , yes)
garage(kerkstraat24, yes)

% Mansions
mansion(hekweg4) % Hekweg 4 is a mansion
mansion(fuutlaan12)
mansion(dorpsstraat9)
30 located in (hekweg4, breda) % Hekweg 4 is located in Breda
located in (fuutlaan12, eindhoven−c)
located in (dorpsstraat9, boekel)
floor area (hekweg4, 600) % Hekweg 4 has a floor area of 600mˆ2
floor area (fuutlaan12, 500)
floor area (dorpsstraat9, 1000)
nr of flrs (hekweg4, 3) % Hekweg 4 has 3 floors
nr of flrs (fuutlaan12, 2)
nr of flrs (dorpsstraat9, 2)
price (hekweg4, 650) % Hekweg 4 costs 650,000 euros
40 price (fuutlaan12, 400)
price (dorpsstraat9, 1000)
nr of rooms(hekweg4, 10) % Hekweg 4 has 10 rooms
nr of rooms(fuutlaan12, 8)
nr of rooms(dorpsstraat9, 15)
garden(hekweg4, yes) % Hekweg 4 has a garden
garden(fuutlaan12, no)
garden(dorpsstraat9, yes)

% Villas
50 villa (elburglaan23) % Elburglaan 23 is a villa
villa (lindelaan12)
villa (ruiterbos5)
located in (elburglaan23, eindhoven−strijp) % Elburglaan 23 is located in Eindhoven−Strijp
located in (lindelaan12 , acht)
located in (ruiterbos5 , breda)
floor area (elburglaan23, 500) % Elburglaan 23 has a floor area of 500mˆ2

2
floor area (lindelaan12 , 1200)
floor area (ruiterbos5 , 1400)
nr of flrs (elburglaan23, 1) % Elburglaan 23 has one floor
60 nr of flrs (lindelaan12 , 3)
nr of flrs (ruiterbos5 , 3)
price (elburglaan23, 300) % Elburglaan 23 costs 300,000 euros
price (lindelaan12 , 400)
price (ruiterbos5 , 600)
nr of rooms(elburglaan23, 8) % Elburglaan 23 has 8 rooms
nr of rooms(lindelaan12, 9)
nr of rooms(ruiterbos5, 12)
nr of bedrms(elburglaan23, 2) % Elburglaan 23 has 2 bedrooms
nr of bedrms(lindelaan12, 4)
70 nr of bedrms(ruiterbos5, 6)

% Appartments
appartment(hemelrijken100) % Hemelrijken 100 is an appartment
appartment(boschdijk128)
appartment(hoofdstraat1)
located in (hemelrijken100, eindhoven−c) % Hemelrijken 100 is located in Eindhoven−Centrum
located in (boschdijk128, eindhoven−stratum)
located in (hoofdstraat1, boekel)
floor area (hemelrijken100, 150) % Hemelrijken 100 has a floor area of 150mˆ2
80 floor area (boschdijk128, 200)
floor area (hoofdstraat1, 200)
price (hemelrijken100, 300) % Hemelrijken 100 costs 300,000 euros
price (boschdijk128, 350)
price (hoofdstraat1, 200)
nr of rooms(hemelrijken100, 6) % Hemelrijken 100 has 6 rooms
nr of rooms(boschdijk128, 7)
nr of rooms(hoofdstraat1, 6)
nr of bedrms(hemelrijken100, 4) % Hemelrijken 100 has 4 bedrooms
nr of bedrms(boschdijk128, 4)
90 nr of bedrms(hoofdstraat1, 4)
garden(hemelrijken100, yes) % Hemelrijken 100 has a garden
garden(boschdijk128, no)
garden(hoofdstraat1, no)

% Houses
house(bavelselaan238) % Bavelselaan 238 is a house
house(stratumseind20)
house(hemelrijken117)
located in (bavelselaan238, breda) % Bavelselaan 238 is located in Breda
100 located in (stratumseind20, eindhoven−stratum)
located in (hemelrijken117, eindhoven−woensel)
floor area (bavelselaan238, 150) % Bavelselaan 238 has a floor area of 150mˆ2
floor area (stratumseind20, 300)
floor area (hemelrijken117, 250)
price (bavelselaan238, 90) % Bavelselaan 238 costs 90,000 euros
price (stratumseind20, 120)

3
price (hemelrijken117, 200)
nr of rooms(bavelselaan238, 9) % Bavelselaan 238 has 9 rooms
nr of rooms(stratumseind20, 10)
110 nr of rooms(hemelrijken117, 12)
nr of bedrms(bavelselaan238, 4) % Bavelselaan 238 has 4 bedrooms
nr of bedrms(stratumseind20, 3)
nr of bedrms(hemelrijken117, 4)
garden(bavelselaan238, yes) % Bavelselaan 238 has a garden
garden(stratumseind20, no)
garden(hemelrijken117, yes)

% Bungalows
bungalow(ringelstraat1) % Ringelstraat 1 is a bungalow
120 bungalow(schenkelplein7)
bungalow(dorpsstraat9)
located in ( ringelstraat1 , acht) % Ringelstraat 1 is located in Acht
located in (schenkelplein7 , eindhoven−strijp)
located in (dorpsstraat9, bavel)
floor area ( ringelstraat1 , 100) % Ringelstraat 1 has a floor area of 100mˆ2
floor area (schenkelplein7 , 120)
floor area (dorpsstraat9, 200)
price ( ringelstraat1 , 200) % Ringelstraat 1 costs 200,000 euros
price (schenkelplein7 , 250)
130 price (dorpsstraat9, 250)
nr of rooms( ringelstraat1 , 5) % Ringelstraat 1 has 5 rooms
nr of rooms(schenkelplein7, 6)
nr of rooms(dorpsstraat9, 8)
nr of bedrms(ringelstraat1 , 3) % Ringelstraat 1 has 3 bedrooms
nr of bedrms(schenkelplein7, 2)
nr of bedrms(dorpsstraat9, 2)
garden(ringelstraat1 , yes) % Ringelstraat 1 has a garden
garden(schenkelplein7, yes)
garden(dorpsstraat9, no)
140

% Ranches
ranch(tilburgseweg6) % Tilburgseweg 6 is a ranch
ranch(spoorstraat2)
ranch(boutenslaan33)
located in (tilburgseweg6, bavel) % Tilburgseweg 6 is located in Bavel
located in (spoorstraat2, boekel)
located in (boutenslaan33, eindhoven−gestel)
area(tilburgseweg6, 10000) % Tilburgseweg 6 has an area of 10,000mˆ2
area(spoorstraat2, 5000)
150 area(boutenslaan33, 12000)
floor area (tilburgseweg6, 100) % Tilburgseweg 6 has a floor area of 100mˆ2
floor area (spoorstraat2, 120)
floor area (boutenslaan33, 90)
price (tilburgseweg6, 1000) % Tilburgseweg 6 costs 1,000,000 euros
price (spoorstraat2, 700)
price (boutenslaan33, 300)

4
nr of rooms(tilburgseweg6, 6) % Tilburgseweg 6 has 6 rooms
nr of rooms(spoorstraat2, 7)
nr of rooms(boutenslaan33, 8)
160 nr of bedrms(tilburgseweg6, 2) % Tilburgseweg 6 has 2 bedrooms
nr of bedrms(spoorstraat2, 3)
nr of bedrms(boutenslaan33, 3)

% Rules

% Housing items can be divided into offices , living spaces and leisure spaces .
170

housing item(X) :− % Every office is an housing item


office (X)

housing item(X) :−
living (X)

housing item(X) :−
180 leisure (X)

% An office is always an office building or a mansion

office (X) :−
office building (X) % If something’s an office building , then this
% means it’s an office .

office (X) :− % If something’s a mansion, then this means it’s


mansion(X) % an office .
190

% A housing item for (permanent) living is always a villa , an appartment


% or a house.

living (X) :−
villa (X)

living (X) :−
appartment(X)

200 living (X) :−


house(X)

% A housing item meant for leisure is always a bungalow or a ranch.

leisure (X) :−
bungalow(X)

5
leisure (X) :−
ranch(X)

% Relations

% If the number of bedrooms for a housing item isn’t specified directly (as
% a fact), but the housing item is an office building , then you know the
% number of bedrooms must be 0.

nr of bedrooms(X, Y) :−
nr of bedrms(X, Y) % The number of bedrooms is stated as a fact.

10 nr of bedrooms(X, 0) :−
office building (X) % An office building has 0 bedrooms by default

% If the existance of a garden with a housing item isn’ t specified directly


% (as a fact ), but the housing item is a villa or a ranch, then you know
% there is a garden.

has garden(X, Y) :−
garden(X, Y) % The existence of a garden is stated as a fact .

20 has garden(X, true) :−


villa (X) or ranch(X) % Villas and ranches have a garden by default.

% If the existance of a garage with a housing item isn’ t specified directly


% (as a fact ), but the housing item is a villa , then you know there is a
% garage.

has garage(X, Y) :−
garage(X, Y) % The existence of a garage is stated as a fact .
30

has garage(X, true) :−


villa (X) % Villas have a garage by default .

% If the number of floors of a housing item isn’ t specified directly (as a


% fact), but the housing item is an appartment or a bungalow, then you know
% there is only one floor .

nr of floors (X, Y) :−
40 nr of flrs (X, Y) % The number of bedrooms is stated as a fact.

nr of floors (X, 1) :−
appartment(X) or bungalow(X) % Appartments and bungalows have only one
% floor by default

6
Part 1c Basic tasks and questions
Procedures3 to use the knowledge base for accomplishing certain housing tasks
are given below. In the listing below pseudo Prolog is used.
% Group 10 − Assignment 1 − Task definition

% Which houses of type T are for sale?


avail of type (X, T) :−
”T(X)”

% Which houses of type T in region R are for sale?


avail of type in region (X, T, R) :−
10 ”T(X)” and located in(X, R)

% Find all houses with feature F


avail with feature (X, F) :−
”F(X, true)”

% Find all office buildings which have at least N different number of floors
different office floors (X, N) :−
office building (X) and nr of floors (X, Y) and Y > N

20 % Find all houses which cost between lower bound A and upper bound B
houses priced between(X, A, B) :−
house(X) and price(X, Y) and A < Y <B

% List all features of house H


house features(X)
”Return all features F for which F(X) exists.”

Part 1d Problem solving


Consider the following problem: Finding a leisure function housing item with a
price between e300,000 and e500,000.
We use the tree from group10 ass1 diagram.pdf. Our search space is narrowed
down to the Leisure function subclass of Housing item. Since we are looking for
leisure homes we can use the Leisure node as the root node of the search tree.
The solution space consists of the leafs matching our requirements.
Then, a blind search (DFS) can be used, starting at the root of the given search
space, to find the matching housing items.
Other tasks of Part 1c go in a similar fashion.
3 group10 ass1 task.pl

You might also like