schemap | Visualize your Rails schema as a D3 force graph | Application Framework library
kandi X-RAY | schemap Summary
kandi X-RAY | schemap Summary
Schemap (\skē-map) walks your ActiveRecord models and database tables to generate visual schemas using D3. Schemap is database agnostic.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of schemap
schemap Key Features
schemap Examples and Code Snippets
Community Discussions
Trending Discussions on schemap
QUESTION
I had previously asked where the Winery types are indexed. I noticed that in the serialization for the schema for Bool
, which is [4,6]
, the 4 is the version number, and 6 is the index of SBool in SchemaP. I verified the hypothesis using other "primitive" types like Integer (serialization: 16), Double (18), Text (20). Also, [Bool]
will be SVector SBool
, serialized to [4,2,6]
, which makes sense: the 2 is for SVector, the 6 is for SBool.
But SchemaP also contains constructors that I don't intuitively see how are used: SFix, SVar, STag and SLet. What are they, and which type would I need to construct the schema for, to see them used? Why is SLet at the end, but SFix at the beginning?
...ANSWER
Answered 2021-Feb-12 at 10:28SFix
looks like a µ quantifier for a recursive type. The type µx. T is the type T where x refers to the whole type µx. T. For example, a list data List a = Nil | Cons a (List a)
can be represented as L(a) = µr. 1 + a × r, where the recursive occurrence of the type is replaced with the variable r. You could probably see this with a recursive user-defined type like data BinTree a = Leaf | Branch a (BinTree a) (BinTree a)
.
This encoding doesn’t explicitly include a variable name, because the next constructor SVar
specifies that “SVar n
refers to the n
th innermost fixpoint”, where n
is an Int
in the synonym type Schema = SchemaP Int
. This is a De Bruijn index. If you had some nested recursive types like µx. µy. … = SFix (SFix …)
, then the inner variable would be referenced as SVar 0
and the outer one as SVar 1
within the body …
. This “relative” notation means you can freely reorganise terms without worrying about having to rename variables for capture-avoiding substitution.
SLet
is a let
binding, and since it’s specified as SLet !(SchemaP a) !(SchemaP a)
, I presume that SLet e1 e2
is akin to let x = e1 in e2
, where the variable is again implicit. So I suspect this may be a deficiency of the docs, and SVar
can also refer to Let
-bound variables. I don’t know how they use this constructor, but it could be used to make sharing explicit in the schema.
Finally, STag
appears to be a way to attach extra “tag” metadata within the schema, in some way that’s specific to the library.
The ordering of these constructors might be maintained for compatibility with earlier versions, so adding new constructors at the end would avoid disturbing the encoding, and I figure the STag
and SLet
constructors at the end were simply added later.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install schemap
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page