Esempio n. 1
0
 public static EdgeStatement EdgeBetweenNodes(NodeStatement.NodeID from, NodeStatement.NodeID to)
 {
     EdgeStatement edge = new EdgeStatement();
     edge.nodeID = from;
     edge.rhs = new EdgeRHS();
     edge.rhs.nodeID = to;
     return edge;
 }
Esempio n. 2
0
 // returns a list of statements because we may need to declare node attribute statments
 // or other things to describe the WME
 public IEnumerable<Statement> GetStatement()
 {
     List<Statement> statements = new List<Statement>();
     if (IsIdentifier())
     {
         // add an edge statement
         EdgeStatement statement = EdgeStatement.EdgeBetweenNodes(ID, value);
         statement.attributes.Add(new StringAttribute("label", attribute.Replace("-", "_")));
         statements.Add(statement);
     }
     else
     {
         // get a new id for the value
         string newID = getNewID();
         // make edge statement
         EdgeStatement statement = EdgeStatement.EdgeBetweenNodes(ID, newID);
         statement.attributes.Add(new StringAttribute("label", attribute.Replace("-", "_")));
         statements.Add(statement);
         // add a node attribute statement to label the child
         NodeStatement nodeStatement = new NodeStatement(newID);
         nodeStatement.attributes.Add(new StringAttribute("label", value.Replace("-", "_")));
         statements.Add(nodeStatement);
     }
     return statements;
 }