/* TID is a pointer to type, could be a oid or text (includes Postgres types and wildcards for RASQL) */ /* NodeID is a pointer to a Node, could be oid or text */ /* RecipeID is a pointer to a Recipe, could be oid or text */ * create Element (name = text, inports = TID[], outport = TID, doc = text, keywords = text[], icon = int4, /* punt for now */ elemtype = int4, /* no enumerated types, so number ingred, eye, recipe */ /* postgres should support getting "true" type for inherited relations*/ codeloc = text)\g * create Ingredient (functype = int4) inherits (Element)\g /* uses int4 for enumerated type of ingred: PQfunc, Cfunc, or cooked recipe*/ * create Eye () inherits (Element)\g * create UINode (loc = point, uitype = int4, /* one of Ingred, Eye, Delimiter, Template */ contents = text, /* name of Element this node represents */ belongs_to = RecipeID)\g /* name of Recipe this node is in */ * create IngredNode () inherits (UINode)\g * create EyeNode (name = text, master_of = text, /* name of the view of other EyeNodes this is master of */ slave_of = text) /* name of other EyeNode this is slaved to */ inherits (UINode)\g * create DelimitNode (dntype = int4) inherits (UINode)\g /* dntype is either Left or Right */ * create TemplateNode (num_matches = int4) /* num_matches is either One or Zero_or_More */ inherits (UINode)\g * create IngredTemplate () inherits (TemplateNode, Ingredient)\g * create EyeTemplate () inherits (TemplateNode, Eye)\g * create Edge (fromNode = NodeID, toNode = NodeID, toPort = int4)\g * create RecipeEdge (belongs_to = RecipeID) /* name of recipe this edge is in */ inherits (Edge)\g * create Recipe (nodes = text, /* name of view of nodes */ edges = text, /* name of view of edges */ is_query = bool, has_eyes = bool, sizing_func = text) inherits (Element)\g *************************************************** The first recipe: * append Ingredient (functype = 1, name = "read_landuse_map", /* inports = NULL, */ outport = "map", doc = "{"This function get a vector map out of the database."}", keywords = "{"landuse", "map"}", icon = 0, elemtype = 1, codeloc = "none")\g * append Ingredient (functype = 2, name = "elim_crop_areas", inports = {"map"}, outport = "map", doc = "{"This C func takes a landuse map and colors black the areas. we're not interested in. Eventually it should be a func with a param for what to color black, but right now crops are hardwired."}", keywords = "{"eliminate", "areas", "landuse"}", icon = 0, elemtype = 1, codeloc = "/fake/pathname.o")\g * append Ingredient (functype = 1, name = "read_AVHRR", /* inports = "none",*/ outport = "AVHRR", doc = "{"This func reads AVHRR data from the database. It should take a parameter which narrows down which AVHRR data it's getting."}", keywords = "{"AVHRR"}", icon = 0, elemtype = 1, codeloc = "none")\g * append Ingredient (functype = 2, name = "cross_landuse_n_AVHRR", inports = {"map", "AVHRR"} outport = "AVHRR", doc = "{"This C func takes a landuse map (possibly partially blacked out and intersects it with an AVHRR image to produce the AVHRR image of only the areas of interest."}", keywords = "{"intersect", "cross", "landuse", "AVHRR"}", icon = 0, elemtype = 1, codeloc = "/bogus/somepath.o")\g * append Ingredient (functype = 2, name = "clip_to_forest_areas", inports = {"AVHRR"}, outport = "AVHRR", doc = "This C func takes an AVHRR image and uses two IR and a crossover band to eliminate all but the forest regions from the image" keywords = "{"clip", "eliminate", "forest", "AVHRR", "band clipping"}", icon = 0, elemtype = 1, codeloc = "/fantasy/program.o")\g * append Ingredient (functype = 1, name = "select_thermal_band", inports = {"AVHRR"}, outport = "AVHRR.oneband", doc = "{"This is doable as a PQ func, I hope. Eventually which band ", "to pick should be a parameter, not hardwired to thermal as here."}", keywords = "{"select", "thermal", "AVHRR"}", icon = 0, elemtype = 1, codeloc = "none")\g * append IngredNode (loc = "(10,10)", uitype = 1, contents = "read_landuse_map", belongs_to = "smokey")\g * append IngredNode (loc = "(20,20)", uitype = 1, contents = "elim_crop_areas", belongs_to = "smokey")\g * append IngredNode (loc = "(10,20)", uitype = 1, contents = "read_AVHRR", belongs_to = "smokey")\g * append IngredNode (loc = "(30,30)", uitype = 1, contents = "cross_landuse_n_AVHRR", belongs_to = "smokey")\g * append IngredNode (loc = "(40,40)", uitype = 1, contents = "clip_to_forest_areas", belongs_to = "smokey")\g * append IngredNode (loc = "(50,50)", uitype = 1, contents = "select_thermal_band", belongs_to = "smokey")\g * append RecipeEdge (fromNode = "read_landuse_map", /* this specifies Node, not element */ toNode = "elim_crop_areas", toPort = 1, belongs_to = "smokey")\g * append RecipeEdge (fromNode = "elim_crop_areas", toNode = "cross_landuse_n_AVHRR", toPort = 1, belongs_to = "smokey")\g * append RecipeEdge (fromNode = "read_AVHRR", toNode = "cross_landuse_n_AVHRR", toPort = 2, belongs_to = "smokey")\g * append RecipeEdge (fromNode = "cross_landuse_n_AVHRR", toNode = "clip_to_forest_areas", toPort = 1, belongs_to = "smokey" )\g * append RecipeEdge (fromNode = "clip_to_forest_areas", toNode = "select_thermal_band", toPort = 1, belongs_to = "smokey")\g /* note that the name had to be truncated from smokey to smoke because a rulename is a char16, and the rule defining machinery prepends _RET (for a retrieve rule). */ * define view smoke_nodes (n.all) from n in IngredNode where n.belongs_to = "smokey"\g * define view smoke_edges (e.all) from e in RecipeEdge where e.belongs_to = "smokey"\g * append Recipe (name = "smokey", /* inports = NULL */ outport = "AVHRR.oneband", doc = "{"This recipe finds wildfires by combining AVHRR satellite data with landuse maps."}", keywords = "{"wildfires", "search", "AVHRR", "landuse"}", icon = 0, elemtype = 3, codeloc = "none", nodes = "smoke_nodes", edges = "smoke_edges", is_query = "false", has_eyes = "false", sizing_func = "none")\g