ASPL Manual v 1.00
© 2024 by SetSphere.COM
13. 16similarity calculates the similarities of one or more set variables
similarity a1 [a2 .. aN] where a1 [a2 .. aN] are set variables
A predicate can be used by ticking the similarity operation:
similarity`ffl a1 [a2 .. aN]
similarity`fflc a1 [a2 .. aN]
cosvar = similarity a1 [a2 .. aN] where cosvar is the COS variable
similarity
When specified by itself then get the similarity between the two objects on top of the answer stack
similarity cosStruc 1* ins:H_H_H ret:cosStruc
Use the similarity operator to compare one or many set variables. This operator is setadic (it comes first on the line) then it is followed by one or more set variables. However it can be preceded by a left variable and the equal sign, in which case the similarity result is assigned to the left variable and the result in saved in ASPL COS symbol table.
similarity EXAMPLE1We want to compare the similarity between directories on the UNIX file system.
The sample workspace WS1 holds the datasets of three directories /tmp/aa1,
Having defined the set variables a1, a2, and a3, we want to show the similarity between these three variables.
In this example we start ASPL by loading the sample workspace WS1 then issue the similarity operator to compare the set variables a1, a2, and a3.
The similarity operator can be associated with a predicate. Use the tick operator shown in the table below for compare the similarity according to a specific predicate.
For example, we will use sim`
c to get the similarity between variables a1, a2, and a3 taking into consideration the checksum attribute of their subgroups or elements.
We can also save the similarity results into COS variables. ASPL has a COS symbol table where COS variables are saved. You can display the content of the COS symbol table with the COS command, and you can even interrogate a COS variable by preceding it with the COS interrogation operator ?c.
The following operations summarize the usage of the similarity operator and the ?c operator.
similarity OPERATION1# aspl WS1
(start ASPL loading the sample workspace WS1)
① aspl>
sim a1 a2 a3
(show the similarity between a1, a2, and a3)
② aspl>
sim`c a1 a2 a3
(show the similarity between a1, a2, and a3 considering the checksum attribute)
③ aspl>
sima123 = sim a1 a2 a3
(assign to the COS variable sima123 the similarity result)
④ aspl>
cos
(print the COS symbol table)
⑤ aspl>
c d sima123
(print the internals of the COS variable sima123)
⑥ aspl>
?c sima123
(interrogate the COS variable sima123)
⑦ aspl>
cos sorted
(show the sorted COS symbol table to see if anything changed or archived)
The following figure shows the operations performed in this second example.
Figure eg-op-similarity-3.png
The interrogation of COS variable sima123 and its historical similarity is shown in figure FFFF. Since no change in the variables then the similarities remained the same and the COS variable remained the same without any historical.
Figure eg-op-similarity-4.png
similarity EXAMPLE2In the sample workspace RANDONEBITMIX we created random groups, subgroups, and elements, then saved their results into set variables. In this example we start ASPL loading the sample workspace RANDONEBITMIX and show the commands to interrogate the similarity of a set variable.
similarity OPERATION2# aspl RANDONEBITMIX
(start ASPL loading the sample workspace RANDONEBITMIX)
① aspl>
v
(print the symbol table)
② aspl>
sim mg123
(show the similarity of the set variable mg123)
③ aspl>
sim mg123 g1
(show the similarity of the set variables mg123 and g1)
④ aspl>
sim a1 a2 a3
(show the similarity between a1, a2, and a3)
⑤ aspl>
? mg123
(interrogate mg123)
⑥ aspl>
v sorted
(sort and view the symbol table )
⑦ aspl>
@sim mg123
(show the similarity or archived set variable mg123)
The following figure shows the operations performed in this first example.
Figure eg-op-similarity-1.png
The interrogation of set variable mg123 and its historical similarity is shown in figure FFFF.
Figure eg-op-similarity-2.png
● Tickable Predicates for similarity
The similarity is tickable with predicates that are shown in the following table:
a yellow note
similarity`_ similarity on the aggregated element containment names similarity`ffl similarity on the aggregated element containment names similarity`f similarity on the aggregated element names similarity`c similarity on the aggregated checksums of the named elements similarity`z similarity on the aggregated zsums of the named elements similarity`fflz similarity on the aggregated element containment names AND their zsums similarity`dosi similarity on the aggregated document similarities of the named elements similarity`h similarity on the aggregated entropies of the named elements similarity`c similarity on the aggregated checksums of the named elements similarity`fc similarity on the aggregated named elements AND their checksums similarity`fflc similarity on the aggregated element containment names AND their checksums similarity`fflmtm similarity on the aggregated element containment names AND their make time similarity`mtm similarity on the aggregated make times of the named elements similarity`fmtm similarity on the aggregated named elements AND their make times similarity`d similarity on the aggregated containment subgroups similarity`dmtm similarity on the aggregated containment subgroups AND the make times of the subgroups