Module fsmanip

Predicates for manipulating feature structures

Contents

Predicate


Top of this page Contents Index of this package LiLFeS Documents LiLFeS Home Page Tsujii laboratory

Predicate

copy/2

Formatcopy(+$S1, -$S2)
Arguments
+$S1bot Feature structure1
-$S2bot Feature structure2
Copy the feature structure $S1 in heap to $S2. It is different from assignment by unification such as S1=S2,because there causes no structure sharing.
> ?- X = person, X = Y.
 X: [$1] person
 Y: [$1] ...
 > ?- X = person, copy(X, Y).
 X: person
 Y: person

normalize/2

Formatnormalize(+$S1, -$S2)
Arguments
+$S1bot Feature structure1
-$S2bot Feature structure2
NoteSecond argument must be 'bot'.
Normalize the feature structure $S1 in heap to $S2. Copied feature structure can be manipulated with 'b_copy/2' and 'recopy'.

canonical_copy/2

Formatcanonical_copy(+$S1, -$S2)
Arguments
+$S1bot Feature structure1
-$S2bot Feature structure2
Copy the feature structure $S1 in heap to $S2. Feature structures with default feature values are reduced to atoms.

unifiable/2

Formatunifiable(+$A, +$B)
Arguments
+$Abot
+$Bbot
This predicate succeeds if $A and $B are unifiable. $A and $B remain unchanged after this predicate succeeds.

isshared/2

Formatisshared(+S1, +S2)
Arguments
+S1bot Feature structure1
+S2bot Feature structure2
Success if there is any shared structure between S1 and S2
> ?- X = NAME\"John", Y = FATHER\X, isshared(X,Y).
 ¡¡
 |~person       ~|
 X: [$1] | NAME:"John"   |
 | AGE:integer   |
 |_FATHER:person_|
 |~person         ~|
 Y: | NAME:string     |
 | AGE:integer     |
 |_FATHER:[$1] ..._|

isnotshared/2

Formatisnotshared(+S1, +S2)
Arguments
+S1bot Feature structure1
+S2bot Feature structure2
Success if there isn't any shared structure between S1 and S2
> ?- X = NAME\"John", Y = FATHER\X, isnotshared(X,Y).
 no 

recopy/2

Formatrecopy(+S1, -S2)
Arguments
+S1bot Feature structure1
-S2bot Feature structure2
Copy feature structure 1 to feature structure 2. Feature structure1 must be one part in heap. This can be used copy after copy.

b_equiv/2

Formatb_equiv(+S1, +S2)
Arguments
+S1bot Feature structure1
+S2bot Feature structure2
Success if feature structure1 are equivalent to feature structure 2.

identical/2

Formatidentical(+FS1,+FS2)
Sucess if feature structure1 FS1 and feature structure2FS2 are identical.
> ?- X = person & AGE\10, X = Y, identical(X,Y). 
 ¡¡
 |~person       ~|
 X: [$1] | NAME:string   |
 | AGE:10        |
 |_FATHER:person_|
 ¡¡
 > ?- identical(person & AGE\10, person & AGE\10).
 no 

not_identical/2

Formatnot_identical(+$FS1, +$FS2)
Arguments
+$FS1bot
+$FS2bot
This is true when $FS1 and $FS2 are not identical.

is_integer/1

Formatis_integer(+T)
Arguments
+Tbot Type
Success if the input is an integer.
> ?- is_integer(5).
 yes 

is_string/1

Formatis_string(+T)
Arguments
+Tbot Type
Success if the input is an string.
> ?- is_string("abc").
 yes 

is_float/1

Formatis_float(+T)
Arguments
+Tbot Type
Success if the input is an float.
> ?- is_float(-5.3).
 yes 

have_child/1

Formathave_child(+S)
Success if S has a child (= S is node).

have_no_child/1

Formathave_no_child(+S)
Success if S has no child (= S is leaf).

compound/1

Formatcompound(+S)
Success if S has a child (= S is node).

simple/1

Formatsimple(+S)
Success if S has no child (= S is leaf).

follow/3

Formatfollow(+S1, +L, ?S2)
Arguments
+S1bot Feature Structure
?S2bot Returned Feature Result.
Note+L should contain atleast the parents in the hierarchy or children with features. In both the cases, \ is required after Feature name.
Follow the path L of the feature structure S1 and return the result in S2 .
> ?- follow(a & F1\n ,F1\ ,X).
 X: n
 > ?- follow([a, b, c], [tl\, hd\], X).
 X: b 
 ¡¡
 This example is equal to "?- a & F1\n = F1\X." and "?- [a,b,c] = tl\hd\X.",but actually this can be used feature got by type_featurelist on L.

follow_if_exists/3

Formatfollow_if_exists(+S1, +L, ?S2)
Arguments
+S1bot Feature Structure
?S2bot Returned Feature Result.
Note+L should contain atleast the parents in the hierarchy or children with features. In both the cases, \ is required after Feature name.
Follow the path L of the feature structure S1 and return the result in S2 .However, if F1 does not exist in path then return failure.
> ?- follow_if_exists([a|_], [tl\, hd\], X).
 no 

restriction/2

Formatrestriction($S, +F)
Arguments
$Sbot ¡§Feature structure
Clear specified feature( modify it to the most generistic type).
> ?- X = NAME\"John" & AGE\10 & FATHER\(NAME\"Tom" & AGE\40), restriction(X,FATHER\). 
 |~person       ~|
 X: | NAME:"John"   |
 | AGE:10        |
 |_FATHER:person_|

overwrite/3

Formatoverwrite($S, +F, $T)
Arguments
$Sbot ¡§Feature structure
$Tbot Feature structure
Overwrite specified feature (modify it to the new value).
> ?- X = NAME\"John" & AGE\10 & FATHER\(NAME\"Tom" & AGE\40), overwrite(X,[FATHER\,NAME\],"Bob"). 
 |~person               ~|
 | NAME:"John"           |
 X: | AGE:10                |
 |        |~person    ~| |
 | FATHER:| NAME:"Bob" | |
 |_       |_AGE:40    _|_|

subnodelist/2

Formatsubnodelist(+S, -L)
Arguments
+Sbot Feature structure
-Llist Result list
returns the list of all children (including grand children) nodes as a list.
> ?- subnodelist(person & Name\"Mary",X)
 |~person            ~|                                          
 | NAME:[$1] "Jack"   |                                          
 X: < | AGE:[$2] integer   |, [$1] ..., [$2] ..., [$3] ..., [$4] ... >
 | FATHER:[$3] person |                                          
 |_MOTHER:[$4] person_|   

subnodelist_count/2

Formatsubnodelist_count(+S, -L)
Arguments
+Sbot Feature structure
-Llist Result list
returns the count of nodes in subnodelist.

sharednodelist/2

Formatsharednodelist(+S, -L)
Arguments
+Sbot Feature structure
-Llist Result list
Returns a list of shared nodes.
> ?- A = ( p(X,Y) :- q(X,Z), r(Z,Y) ), sharednodelist(A, B).
 |~:-/2                                          ~|
 |       |~p/2          ~|                        |
 | chead:| arg1:[$1] bot |                        |
 A: |       |_arg2:[$2] bot_|                        |
 |         |~q/2          ~|  |~r/2          ~|   |
 | cbody:< | arg1:[$1] ... |, | arg1:[$3] ... | > |
 |_        |_arg2:[$3] bot_|  |_arg2:[$2] ..._|  _|
 B: < [$1] ..., [$2] ..., [$3] ... >
 ¡¡
 This can be used for getting list of variables as this example shows.But variables of singleton is not added list because structure sharing does not occur.

contains/2

Formatcontains(+S1, +S2)
Arguments
+S1bot Feature structure£±
+S2bot Feature structure£²
Sucess if the feature structure1 contains the feature structure2.
> ?- N = "John", X = NAME\N & FATHER\NAME\N , contains(X,N).
 (if successful, return values of X and N) 
 > ?- X = NAME\"John" & FATHER\NAME\"John" , contains(X,N).
 no 
 ¡¡
 As can be seen from the example, although the values are same, since they are not shared, it fails. 
 Can be used to find out if S1 contains S2. 

is_cyclic/1

Formatis_cyclic(+S)
Arguments
+Sbot Feature structure
Sucess if the feature structure is cyclic.

equivalent/2

Formatequivalent(+S1, +S2)
Arguments
+S1bot Feature structure£±
+S2bot Feature structure£²
Sucess if feature structure1 and feature structure2 are equivalent.
> ?- equivalent(person & AGE\10, person & NAME\"Mary").
 no

not_equivalent/2

Formatnot_equivalent(+$FS1, +$FS2)
Arguments
+$FS1bot
+$FS2bot
This is true when $FS1 and $FS2 are not equivalent.

subsume/2

Formatsubsume(+S1, +S2)
Arguments
+S1bot Feature structure£±
+S2bot Feature structure£²
NoteIf type_subsume is different, it checks the internals of the feature.
Sucess if feature structure1 is a subsume of feature structure2.
> ?- subsume(person & AGE\10, person)
 no
 > ?- subsume(person, person & AGE\10)
 yes

type_equal/2

Formattype_equal(+FS1, +FS2)
Arguments
+FS1bot Feature structure£±
+FS2bot Feature structure£²
Success if the type of both feature structure are the same.
> ?- type_equal(foo & F1\a, foo & F1\b).
 yes 

type_subsume/2

Formattype_subsume(+TYPE1, +TYPE2)
Arguments
+TYPE1bot Type(Feature structure)£±
+TYPE2bot Type(Feature structure)£²
Success if the TYPE2 is included into the TYPE1.
> ?- type_subsume(list, nil).
 yes
 > ?- type_subsume(nil, list).
 no 

type_toptype/2

Formattype_toptype(+FS, -TYPE)
Arguments
+FSbot Feature structure
-TYPEbot Feature structure type
Generates just the types of a feature structure.
> ?- type_toptype(Racing Horse & Lineage\'Hail to Reason',X).
 X: Racing Horse
 > ?- type_toptype(p(a,b,c),X).
 X: p/3 

type_copy/2

Formattype_copy(+$FS, -$TYPE)
Arguments
+$FSbot
-$TYPEbot
This lets the value of $TYPE be the type of $FS. $FS ¤Î·¿¤ò $TYPE ¤Ë¥³¥Ô¡¼¤·¤Þ¤¹¡¥

type_extendable/1

Formattype_extendable(+TYPE)
Success if TYPE is expendable(i.e.subtype of TYPE can be defined in other modules).

type_unify/3

Formattype_unify(+TYPE1, +TYPE2, -RESULT)
Arguments
+TYPE1bot Type(Feature structure)£±
+TYPE2bot Type(Feature structure)£²
-RESULTbot Just the type of the simplification result.
Return the simplification TYPE1 and TYPE2 in the RESULT .
> ?- type_unify(Rectangle, Rhombus, X).
 X: Square 

type_common/3

Formattype_common(+FS1, +FS2, +FS3)
Arguments
+FS1bot Feature structure£±
+FS2bot Feature structure£³
Success if FS1 and FS2 and FS3 ars the same type.

type_nfeature/2

Formattype_nfeature(+TYPE, -NUM)
Arguments
+TYPEbot Type(Feature structure)
-NUMinteger Number of features
Return in how many types exists of the TYPE parameter.
> ?- type_nfeature(cons, N).
 N : 2 

type_featurelist/2

Formattype_featurelist(+TYPE, -LIST)
Arguments
+TYPEbot Type(Feature structure)
-LISTlist Feature list
Return a list of features from TYPE
> a <- [bot] + [F\].
 > b <- [a] + [G\].
 > c <- [a] + [H\].
 > d <- [b,c]+ [J\].
 > ?- type_featurelist(d, L).
 L: < F\, G\, H\, J\ > 

type_havefeature/2

Formattype_havefeature(+TYPE, +FEATURE)
Arguments
+TYPEbot Type(Feature structure)
+FEATUREfeature Feature
NotePlease add the character \ to the end of the FEATURE.
Success is the feature structure in TYPE have the parameter feature.
> ?- type_havefeature(Fresh, Stud\).
 yes 

type_subtypes/2

Formattype_subtypes(+TYPE, -LIST)
Arguments
+TYPEbot Type(Feature structure)
-LISTlist List pf subtypes
Get a list of the subtypes of TYPE. The list includes parents and all ancestors.
> ?- type_subtypes(Triangle, L).
 L : < Triangle, Isometric, Right Angle Triangle, Isometric Right Angle Triangle, Equilateral Triangle > 
 > ?- type_subtypes(bot, L).
 L : (all the subtypes are displayed) 

type_nsubtypes/2

Formattype_nsubtypes(+TYPE, -NUM)
Arguments
+TYPEbot Type(Feature structure)
-NUMinteger number of subtype
Return how many the subtypes TYPE has.

type_supertypes/2

Formattype_supertypes(+TYPE, -LIST)
Arguments
+TYPEbot Type(Feature structure)
-LISTlist List pf supertypes
Get a list of the supertypes of TYPE. The list includes parents and all ancestors.
> ?- type_supertypes(Square, L).
 L : < Square, Rectangle, Rhombus, Parallelogram, Quadrilateral, bot > 

type_nsupertypes/2

Formattype_nsupertypes(+TYPE, -NUM)
Arguments
+TYPEbot Type(Feature structure)
-NUMinteger number of supertype
Return how many the supertypes TYPE has.

type_unifiables/2

Formattype_unifiables(+TYPE, -LIST)
Arguments
+TYPEbot Type(Feature structure)
-LISTlist list of unifiable types
Return a list of all unifiable type of TYPE.

type_nunifiables/2

Formattype_nunifiables(+TYPE, -NUM)
Arguments
+TYPEbot Type(Feature structure)
-NUMinteger number of unifiable types
Return how many the unifiable types TYPE has.

type_directsubtypes/2

Formattype_directsubtypes(+TYPE, -LIST)
Arguments
+TYPEbot Type(Feature structure)
-LISTlist Direct subtype list
Get a list of the direct subtypes of TYPE.
> ?- type_directsubtypes(pred/3, L).
 L: < pred/4, findall/3, commonpart/3, add_to_array/3, read_array/3, +/3, -/3,  //3, ///3, mod/3, follow/3, intersectionlist/3, type_unify/3 > 

type_directsupertypes/2

Formattype_directsupertypes(+TYPE, -LIST)
Arguments
+TYPEbot Type(Feature structure)
-LISTlist Direct supertype list
Get a list of the direct supertypes of TYPE.
> ?- type_directsupertypes(Isometric Right Angle Triangle, L).
 L : < Isometric, Right Angle Triangle > 

fs_compare/3

Formatfs_compare(+FS1,+FS2,-$Result)
Arguments
+FS1bot Feature structure1
+FS2bot Feature structure2
-$ResultResult of comparison (-1, 0, 1)
Complete order of FS1 and FS2

Top of this page Contents Index of this package LiLFeS Documents LiLFeS Home Page Tsujii laboratory

This document is automatically created by lildoc on Fri Sep 24 14:13:57 2004