Return to Snippet

Revision: 16483
at August 6, 2009 05:35 by lynchjames


Initial Code
[
  Test{
    Title{
      "\"A_Contrived_Example\""
    },
    TypeList[
      Type{
        ConcreteClass{
          Name => "Blog"
        },
        PropertyList[
          Property{
            Name => "Title"
          },
          Property{
            Name{
              "CreatedDate"
            },
            DefaultValue{
              Value => "\"01/08/2009\""
            }
          },
          Property{
            Name{
              "Entries"
            },
            DefaultValue{
              ConcreteClass{
                Name => "Post"
              }
            },
            Relation{
              "ManyToOne"
            }
          },
          Property{
            Name{
              "Author"
            },
            DefaultValue{
              ConcreteClass{
                Name => "User"
              }
            }
          },
          Property{
            Name{
              "Commenters"
            },
            DefaultValue{
              ConcreteClass{
                Name => "User"
              }
            },
            Relation{
              "ManyToOne"
            }
          }
        ],
        null
      },
      Type{
        ConcreteClass{
          Name => "Post"
        },
        PropertyList[
          Property{
            Name => "Title"
          },
          Property{
            Name => "Content"
          },
          Property{
            Name{
              "PublicationDate"
            },
            DefaultValue{
              Value => "\"01/08/2009\""
            }
          },
          Property{
            Name{
              "Comments"
            },
            DefaultValue{
              ConcreteClass{
                Name => "Comment"
              }
            },
            Relation{
              "ManyToOne"
            }
          },
          Property{
            Name => "Tags",
            Relation => "ManyToOne"
          }
        ],
        null
      },
      Type{
        ConcreteClass{
          Name => "User"
        },
        PropertyList[
          Property{
            Name => "Username"
          },
          Property{
            Name => "Password"
          },
          Property{
            Name => "EmailAddress"
          },
          Property{
            Name{
              "PostCount"
            },
            DefaultValue{
              Value => "0"
            }
          }
        ],
        StatementList[
          CreateMethod{
            TargetMethod{
              Name{
                "Publish"
              },
              ConcreteClasses[
                ConcreteClass{
                  Name => "User"
                },
                ConcreteClass{
                  Name => "Post"
                }
              ]
            }
          },
          CreateMethod{
            TargetMethod{
              Name{
                "UnPublish"
              },
              ConcreteClasses[
                ConcreteClass{
                  Name => "User"
                },
                ConcreteClass{
                  Name => "Post"
                }
              ],
              Relation{
                "ManyToOne"
              }
            }
          },
          CreateMethod{
            TargetMethod{
              Name{
                "CommentOn"
              },
              ConcreteClasses[
                ConcreteClass{
                  Name => "User"
                },
                ConcreteClass{
                  Name => "Post"
                }
              ]
            }
          }
        ]
      },
      Type{
        ConcreteClass{
          Name => "Comment"
        },
        PropertyList[
          Property{
            Name{
              "Author"
            },
            DefaultValue{
              ConcreteClass{
                Name => "User"
              }
            }
          },
          Property{
            Name => "Content"
          },
          Property{
            Name{
              "CreatedDate"
            },
            DefaultValue{
              Value => "\"01/08/2009\""
            }
          }
        ],
        null
      }
    ],
    StatementList[
      When{
        TargetList[
          Target{
            TargetProperty{
              Name{
                "Username"
              },
              ConcreteClasses[
                ConcreteClass{
                  Name{
                    "User"
                  },
                  Instance{
                    Value => "Chris"
                  }
                }
              ],
              Operators[
                Operator{
                  Value => "=="
                }
              ],
              Value{
                "\"chriscanal\""
              }
            }
          },
          Target{
            TargetProperty{
              Name{
                "Title"
              },
              ConcreteClasses[
                ConcreteClass{
                  Name{
                    "Post"
                  },
                  Instance{
                    Value => "DSLs"
                  }
                }
              ],
              Operators[
                Operator{
                  Value => "=="
                }
              ],
              Value{
                "\"An Evening of DSLs\""
              }
            }
          },
          Target{
            TargetProperty{
              Name{
                "Author"
              },
              ConcreteClasses[
                ConcreteClass{
                  Name{
                    "Blog"
                  },
                  Instance{
                    Value => "ScotAltNet"
                  }
                }
              ],
              Operators[
                Operator{
                  Value => "=="
                }
              ],
              Value{
                "Chris"
              }
            }
          },
          Target{
            TargetMethod{
              Name{
                "Publish"
              },
              ConcreteClasses[
                ConcreteClass{
                  Name{
                    "User"
                  },
                  Instance{
                    Value => "Chris"
                  }
                },
                ConcreteClass{
                  Name{
                    "Post"
                  },
                  Instance{
                    Value => "DSLs"
                  }
                }
              ]
            }
          }
        ],
        Constraints[
          Constraint{
            Property{
              Name{
                "Entries"
              },
              ConcreteClass{
                Name{
                  "Blog"
                },
                Instance{
                  Value => "ScotAltNet"
                }
              },
              Count{
                Value{
                  "0"
                },
                Operators[
                  Operator{
                    Value => ">"
                  }
                ]
              }
            }
          },
          Constraint{
            ConcreteClassPropertyMapping{
              ConcreteClasses[
                ConcreteClass{
                  Name{
                    "Blog"
                  },
                  Instance{
                    Value => "ScotAltNet"
                  }
                },
                ConcreteClass{
                  Name{
                    "Post"
                  },
                  Instance{
                    Value => "DSLs"
                  }
                }
              ],
              Properties[
                Property{
                  Name => "Entries"
                },
                Property{
                  Name => "Title",
                  Relation => "LinqSubset"
                }
              ]
            },
            Operators[
              Operator{
                Value => "contains"
              }
            ]
          },
          Constraint{
            ConcreteClassPropertyMapping{
              ConcreteClasses[
                ConcreteClass{
                  Name{
                    "Post"
                  },
                  Instance{
                    Value => "DSLs"
                  }
                },
                ConcreteClass{
                  Name{
                    "Blog"
                  },
                  Instance{
                    Value => "ScotAltNet"
                  }
                }
              ],
              Properties[
                Property{
                  Name => "PublicationDate"
                },
                Property{
                  Name => "CreatedDate"
                }
              ]
            },
            Operators[
              Operator{
                Value => ">"
              }
            ]
          },
          Constraint{
            Property{
              Name{
                "PostCount"
              },
              ConcreteClass{
                Name{
                  "User"
                },
                Instance{
                  Value => "Chris"
                }
              },
              Operators[
                Operator{
                  Value => "=="
                }
              ],
              Value{
                "1"
              }
            }
          }
        ]
      }
    ]
  }
]

Initial URL


Initial Description


Initial Title
bdUnit Example MGraph Output

Initial Tags


Initial Language
Other