====== Extent visibility ======
When looking for matches, queries only consider Node that are in their set of visible [[:01_user_documentation:06_graph:06_extent|extents]].
{{page>:01_user_documentation:06_graph:06_extent::02_index&noheader}}
===== Default visibility =====
Every query whose visibility is not explicitly declared will use the default visibility. The default value for RGG models is 127 (i.e. 0b1111111).
The default extent visibility can be set with:
{de.grogra.rgg.model.Runtime.INSTANCE.currentGraph().setVisibleExtents( 0b1111111 );}
===== Explicit visibility declaration =====
It is also possible to change the extent visibility for only one query. The extent visibility can declared explicitly with: '' @ VAL ; QVDECL; QUERY '' where VAL is the visibility value. (QVDECL is the query variable [[:01_user_documentation:07_rgg_xl:02_xl:03_query:02_query_variable:01_declaration|declaration]], and QUERY the query).
For example:
void rule() [
@5; A ==> B; // match all A in the extents 1, 2, and 3
@1; A ==> B; // match all A in the extent 1
A ==> B; // match all A in the default extents (i.e. 1 to 7)
]
void meth(){
(* @21; F *); // match all F in the extents 1, 3, and 5
}
===== Example =====
For instance, let's consider the following method in an empty project. Notice that we set the visible extent value to 1:
public void run(){
de.grogra.rgg.model.Runtime.INSTANCE.currentGraph().setVisibleExtents(1);
println((*Node*));
}
The method output:
de.grogra.rgg.RGGRoot[id=99]@2e86af42
de.grogra.rgg.Axiom[id=100]@59f1c976
Only the "normal" nodes are visible.
Let's change the visible extent value to **255**. Now the method output:
de.grogra.graph.impl.Node[id=0]@5add4889
de.grogra.graph.impl.Node[id=1]@4f690d55
de.grogra.rgg.RGGRoot[id=103]@621de1a6
Model[id=101]@331e288e
parameters[id=102]@cd97a89
de.grogra.rgg.Axiom[id=104]@4cface1f
Some additional nodes are now visible:
* the roots (id 0 and 1). id 0 is the root of the main graph. id 1 is the root of the meta graph.
* the nodes from the meta graph: the compiled version of the files: Model, and parameters.
Notice that:
* Once the setVisibleExtents is called. The value remains until a new value is set.
* setVisibleExtents use as parameter the decimal value of a binary number of 8 values where each 1 mean that the index is visible, the 0 to 7 index visibility are defined from left to right. E.g. to have all indexes visible, we use 11111111 (eight 1), which is equal in decimal to 255. To have all indexes visible except for the 1rst one, we use 11111110 (=254). The default value is 01111111 (=127).