| Format | copy(+$S1, -$S2) | ||||||
|---|---|---|---|---|---|---|---|
| Arguments |
| ||||||
| 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 | |||||||
| Format | normalize(+$S1, -$S2) | ||||||
|---|---|---|---|---|---|---|---|
| Arguments |
| ||||||
| Note | Second 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'. | |||||||
| Format | canonical_copy(+$S1, -$S2) | ||||||
|---|---|---|---|---|---|---|---|
| Arguments |
| ||||||
| Copy the feature structure $S1 in heap to $S2. Feature structures with default feature values are reduced to atoms. | |||||||
| Format | unifiable(+$A, +$B) | ||||||
|---|---|---|---|---|---|---|---|
| Arguments |
| ||||||
| This predicate succeeds if $A and $B are unifiable. $A and $B remain unchanged after this predicate succeeds. | |||||||
| Format | isshared(+S1, +S2) | ||||||
|---|---|---|---|---|---|---|---|
| Arguments |
| ||||||
| 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] ..._| | |||||||
| Format | isnotshared(+S1, +S2) | ||||||
|---|---|---|---|---|---|---|---|
| Arguments |
| ||||||
| Success if there isn't any shared structure between S1 and S2 | |||||||
> ?- X = NAME\"John", Y = FATHER\X, isnotshared(X,Y). no | |||||||
| Format | recopy(+S1, -S2) | ||||||
|---|---|---|---|---|---|---|---|
| Arguments |
| ||||||
| Copy feature structure 1 to feature structure 2. Feature structure1 must be one part in heap. This can be used copy after copy. | |||||||
| Format | b_equiv(+S1, +S2) | ||||||
|---|---|---|---|---|---|---|---|
| Arguments |
| ||||||
| Success if feature structure1 are equivalent to feature structure 2. | |||||||
| Format | identical(+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 | |
| Format | not_identical(+$FS1, +$FS2) | ||||||
|---|---|---|---|---|---|---|---|
| Arguments |
| ||||||
| This is true when $FS1 and $FS2 are not identical. | |||||||
| Format | is_integer(+T) | |||
|---|---|---|---|---|
| Arguments |
| |||
| Success if the input is an integer. | ||||
> ?- is_integer(5). yes | ||||
| Format | is_string(+T) | |||
|---|---|---|---|---|
| Arguments |
| |||
| Success if the input is an string. | ||||
> ?- is_string("abc").
yes
| ||||
| Format | is_float(+T) | |||
|---|---|---|---|---|
| Arguments |
| |||
| Success if the input is an float. | ||||
> ?- is_float(-5.3). yes | ||||
| Format | have_child(+S) |
|---|---|
| Success if S has a child (= S is node). | |
| Format | have_no_child(+S) |
|---|---|
| Success if S has no child (= S is leaf). | |
| Format | compound(+S) |
|---|---|
| Success if S has a child (= S is node). | |
| Format | simple(+S) |
|---|---|
| Success if S has no child (= S is leaf). | |
| Format | follow(+S1, +L, ?S2) | ||||||
|---|---|---|---|---|---|---|---|
| Arguments |
| ||||||
| 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. | |||||||
| Format | follow_if_exists(+S1, +L, ?S2) | ||||||
|---|---|---|---|---|---|---|---|
| Arguments |
| ||||||
| 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 | |||||||
| Format | restriction($S, +F) | |||
|---|---|---|---|---|
| Arguments |
| |||
| 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_| | ||||
| Format | overwrite($S, +F, $T) | ||||||
|---|---|---|---|---|---|---|---|
| Arguments |
| ||||||
| 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 _|_| | |||||||
| Format | subnodelist(+S, -L) | ||||||
|---|---|---|---|---|---|---|---|
| Arguments |
| ||||||
| 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_| | |||||||
| Format | subnodelist_count(+S, -L) | ||||||
|---|---|---|---|---|---|---|---|
| Arguments |
| ||||||
| returns the count of nodes in subnodelist. | |||||||
| Format | sharednodelist(+S, -L) | ||||||
|---|---|---|---|---|---|---|---|
| Arguments |
| ||||||
| 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. | |||||||
| Format | contains(+S1, +S2) | ||||||
|---|---|---|---|---|---|---|---|
| Arguments |
| ||||||
| 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. | |||||||
| Format | is_cyclic(+S) | |||
|---|---|---|---|---|
| Arguments |
| |||
| Sucess if the feature structure is cyclic. | ||||
| Format | equivalent(+S1, +S2) | ||||||
|---|---|---|---|---|---|---|---|
| Arguments |
| ||||||
| Sucess if feature structure1 and feature structure2 are equivalent. | |||||||
> ?- equivalent(person & AGE\10, person & NAME\"Mary"). no | |||||||
| Format | not_equivalent(+$FS1, +$FS2) | ||||||
|---|---|---|---|---|---|---|---|
| Arguments |
| ||||||
| This is true when $FS1 and $FS2 are not equivalent. | |||||||
| Format | subsume(+S1, +S2) | ||||||
|---|---|---|---|---|---|---|---|
| Arguments |
| ||||||
| Note | If 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 | |||||||
| Format | type_equal(+FS1, +FS2) | ||||||
|---|---|---|---|---|---|---|---|
| Arguments |
| ||||||
| Success if the type of both feature structure are the same. | |||||||
> ?- type_equal(foo & F1\a, foo & F1\b). yes | |||||||
| Format | type_subsume(+TYPE1, +TYPE2) | ||||||
|---|---|---|---|---|---|---|---|
| Arguments |
| ||||||
| Success if the TYPE2 is included into the TYPE1. | |||||||
> ?- type_subsume(list, nil). yes > ?- type_subsume(nil, list). no | |||||||
| Format | type_toptype(+FS, -TYPE) | ||||||
|---|---|---|---|---|---|---|---|
| Arguments |
| ||||||
| 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 | |||||||
| Format | type_copy(+$FS, -$TYPE) | ||||||
|---|---|---|---|---|---|---|---|
| Arguments |
| ||||||
| This lets the value of $TYPE be the type of $FS. $FS ¤Î·¿¤ò $TYPE ¤Ë¥³¥Ô¡¼¤·¤Þ¤¹¡¥ | |||||||
| Format | type_extendable(+TYPE) |
|---|---|
| Success if TYPE is expendable(i.e.subtype of TYPE can be defined in other modules). | |
| Format | type_unify(+TYPE1, +TYPE2, -RESULT) | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Arguments |
| |||||||||
| Return the simplification TYPE1 and TYPE2 in the RESULT . | ||||||||||
> ?- type_unify(Rectangle, Rhombus, X). X: Square | ||||||||||
| Format | type_common(+FS1, +FS2, +FS3) | ||||||
|---|---|---|---|---|---|---|---|
| Arguments |
| ||||||
| Success if FS1 and FS2 and FS3 ars the same type. | |||||||
| Format | type_nfeature(+TYPE, -NUM) | ||||||
|---|---|---|---|---|---|---|---|
| Arguments |
| ||||||
| Return in how many types exists of the TYPE parameter. | |||||||
> ?- type_nfeature(cons, N). N : 2 | |||||||
| Format | type_featurelist(+TYPE, -LIST) | ||||||
|---|---|---|---|---|---|---|---|
| Arguments |
| ||||||
| 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\ > | |||||||
| Format | type_havefeature(+TYPE, +FEATURE) | ||||||
|---|---|---|---|---|---|---|---|
| Arguments |
| ||||||
| Note | Please 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 | |||||||
| Format | type_subtypes(+TYPE, -LIST) | ||||||
|---|---|---|---|---|---|---|---|
| Arguments |
| ||||||
| 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) | |||||||
| Format | type_nsubtypes(+TYPE, -NUM) | ||||||
|---|---|---|---|---|---|---|---|
| Arguments |
| ||||||
| Return how many the subtypes TYPE has. | |||||||
| Format | type_supertypes(+TYPE, -LIST) | ||||||
|---|---|---|---|---|---|---|---|
| Arguments |
| ||||||
| 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 > | |||||||
| Format | type_nsupertypes(+TYPE, -NUM) | ||||||
|---|---|---|---|---|---|---|---|
| Arguments |
| ||||||
| Return how many the supertypes TYPE has. | |||||||
| Format | type_unifiables(+TYPE, -LIST) | ||||||
|---|---|---|---|---|---|---|---|
| Arguments |
| ||||||
| Return a list of all unifiable type of TYPE. | |||||||
| Format | type_nunifiables(+TYPE, -NUM) | ||||||
|---|---|---|---|---|---|---|---|
| Arguments |
| ||||||
| Return how many the unifiable types TYPE has. | |||||||
| Format | type_directsubtypes(+TYPE, -LIST) | ||||||
|---|---|---|---|---|---|---|---|
| Arguments |
| ||||||
| 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 > | |||||||
| Format | type_directsupertypes(+TYPE, -LIST) | ||||||
|---|---|---|---|---|---|---|---|
| Arguments |
| ||||||
| Get a list of the direct supertypes of TYPE. | |||||||
> ?- type_directsupertypes(Isometric Right Angle Triangle, L). L : < Isometric, Right Angle Triangle > | |||||||
| Format | fs_compare(+FS1,+FS2,-$Result) | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Arguments |
| |||||||||
| Complete order of FS1 and FS2 | ||||||||||