Beispiel #1
0
        public static NodeGroup GetInstanceFromJson(JsonObject jsonEncodedNodeGroup, OntologyInfo uncompressOInfo)
        {
            // use the serialized version of the nodeGroup to populate a new nodeGroup
            NodeGroup retval = new NodeGroup();

            retval.AddJsonEncodedNodeGroup(jsonEncodedNodeGroup, uncompressOInfo);
            return(retval);
        }
Beispiel #2
0
        public static NodeGroup DeepCopy(NodeGroup source)
        {
            NodeGroup retval = new NodeGroup();

            retval.AddJsonEncodedNodeGroup(source.ToJson());

            // connection info
            SparqlConnection conn = new SparqlConnection();

            if (source.conn != null)
            {
                conn.FromJson(source.conn.ToJson());
                retval.SetSparqlConnection(conn);
            }
            return(retval);
        }
Beispiel #3
0
        public Node(String name, List <PropertyItem> p, List <NodeItem> n, String URI, NodeGroup ng)
        {
            // create a basic node
            this.nodeName    = name;
            this.fullURIname = URI;
            if (n != null)
            {
                this.nodes = n;
            }
            if (p != null)
            {
                this.props = p;
            }

            this.nodeGroup = ng;

            // set the sparqlId
            this.sparqlID = BelmontUtil.GenerateSparqlID(name, this.nodeGroup.GetSparqlNameHash());
        }
Beispiel #4
0
        public Node(String name, List <PropertyItem> p, List <NodeItem> n, String classURI, List <String> subclassNames, NodeGroup ng, OntologyInfo inflateOInfo)
        {
            this.nodeName      = name;
            this.fullURIname   = classURI;
            this.subclassNames = new List <String>(subclassNames);
            if (n != null)
            {
                this.nodes = n;
            }
            if (p != null)
            {
                this.props = p;
            }

            this.nodeGroup = ng;
            this.InflateAndValidate(inflateOInfo);

            // set the sparqlId
            this.sparqlID = BelmontUtil.GenerateSparqlID(name, this.nodeGroup.GetSparqlNameHash());
        }
Beispiel #5
0
        public NodeItem(JsonObject next, NodeGroup ng)
        {
            this.keyName      = next.GetNamedString("KeyName");
            this.valueTypeURI = next.GetNamedString("UriValueType");
            this.valueType    = next.GetNamedString("ValueType");
            this.connectedBy  = next.GetNamedString("ConnectBy");
            this.uriConnectBy = next.GetNamedString("UriConnectBy");
            this.connected    = next.GetNamedBoolean("Connected");

            // add the list of nodes this item attaches to on the far end
            JsonArray nodeSparqlIds = next.GetNamedArray("SnodeSparqlIDs");
            int       count         = nodeSparqlIds.Count;

            for (int i = 0; i < count; i++)
            {
                String currID = nodeSparqlIds.GetStringAt((uint)i);
                Node   curr   = ng.GetNodeBySparqlID(currID);
                if (curr == null)
                {   // add the node since we have not seen it before.
                    curr = new Node(currID, null, null, currID, ng);
                    curr.SetSparqlID(currID);
                    ng.AddOrphanedNode(curr);
                }
                // add it to list.
                this.nodes.Add(curr);
            }

            // optionals
            if (next.ContainsKey("SnodeOptionals"))
            {   // the incoming json defines optional nodes.
                JsonArray jsonOptional     = next.GetNamedArray("SnodeOptionals");
                int       optionalsCounter = jsonOptional.Count;
                for (int i = 0; i < optionalsCounter; i++)
                {   // get the optional marker used for each
                    int currOpt = (int)(jsonOptional.GetNumberAt((uint)i) / 1);
                    this.snodeOptionals.Add(currOpt);
                }
            }
            else
            {
                // set the values.
                int opt = NodeItem.OPTIONAL_FALSE;

                if (next.ContainsKey("isOptional"))
                {
                    int optVal = (int)next.GetNamedNumber("isOptional");
                }
                // set all of them
                for (int k = 0; k < this.nodes.Count; k++)
                {
                    this.snodeOptionals.Add(opt);
                }
            }

            // add the deletion flag information
            if (next.ContainsKey("DeletionMarkers"))
            {
                JsonArray jsonDelMarkers = next.GetNamedArray("DeletionMarkers");
                for (int g = 0; g < jsonDelMarkers.Count; g++)
                {
                    try
                    {
                        Boolean delVal = jsonDelMarkers.GetBooleanAt((uint)g);
                        this.deletionFlags.Add(delVal);
                    }
                    catch (Exception e)
                    {
                        this.deletionFlags.Add(false);
                    }
                }
            }
            else
            {   // set all the deletion flags to false, so they exist.
                for (int p = 0; p < this.nodes.Count; p++)
                {
                    this.deletionFlags.Add(false);
                }
            }
        }
Beispiel #6
0
 public Node(JsonObject nodeEncoded, NodeGroup ng, OntologyInfo inflateOInfo)
 {
     this.nodeGroup = ng;
     this.UpdateFromJson(nodeEncoded);
     this.InflateAndValidate(inflateOInfo);
 }
Beispiel #7
0
 public Node(JsonObject nodeEncoded, NodeGroup ng)
 {
     this.nodeGroup = ng;
     this.UpdateFromJson(nodeEncoded);
 }
Beispiel #8
0
        public Node(String jsonStr, NodeGroup ng)
        {   // create the JSON Object we need and then call the other constructor.
            JsonObject jObj = JsonObject.Parse(jsonStr);

            this.UpdateFromJson(jObj);
        }
Beispiel #9
0
 public static NodeGroup GetInstanceFromJson(JsonObject json)
 {
     return(NodeGroup.GetInstanceFromJson(json, null));
 }