Example #1
0
        /// <summary>
        /// Reads the data for XML deserialization.
        /// </summary>
        /// <param name="reader">XML Reader.</param>
        public void ReadXml(XmlReader reader)
        {
            reader.Read();
            _subject   = reader.DeserializeNode();
            _predicate = reader.DeserializeNode();
            _object    = reader.DeserializeNode();

            // Compute Hash Code
            _hashcode = (_subject.GetHashCode().ToString() + _predicate.GetHashCode().ToString() + _object.GetHashCode().ToString()).GetHashCode();
        }
Example #2
0
        /// <summary>
        /// Reads the data for XML deserialization (.Net serialization not the official SPARQL results serialization)
        /// </summary>
        /// <param name="reader">XML Reader</param>
        public void ReadXml(XmlReader reader)
        {
            // <result> may be empty
            if (reader.IsEmptyElement)
            {
                return;
            }

            // Otherwise expect some values
            reader.Read();
            while (reader.Name.Equals("binding"))
            {
                // Get the attribute name
                reader.MoveToAttribute("name");
                String var = reader.Value;
                reader.MoveToElement();

                if (reader.IsEmptyElement)
                {
                    // May be empty indicating a null
                    this._resultValues.Add(var, null);
                }
                else
                {
                    // Otherwise expect a deserializable node
                    reader.Read();
                    INode value = reader.DeserializeNode();
                    this._resultValues.Add(var, value);
                }
                // Read to the next binding
                reader.Read();
            }
            reader.Read();
        }