示例#1
0
        public void EvaluateReturnsTrueIfSubExpressionReturnsTypedLiteral()
        {
            IsLiteral expression = new IsLiteral(new GraphMemberExpression(new TypedLiteral("scooby", "http://example.com/dog")));
            Bindings  bindings   = new Bindings();

            Assert.AreEqual(true, expression.Evaluate(bindings));
        }
示例#2
0
        public void EvaluateReturnsFalseIfSubExpressionDoesntReturnPlainLiteralOrTypedLiteral()
        {
            IsLiteral expression = new IsLiteral(new GraphMemberExpression(new BlankNode()));
            Bindings  bindings   = new Bindings();

            Assert.AreEqual(false, expression.Evaluate(bindings));
        }
示例#3
0
        public void EvaluateReturnsTrueIfSubExpressionReturnsPlainLiteral()
        {
            IsLiteral expression = new IsLiteral(new GraphMemberExpression(new PlainLiteral("scooby")));
            Bindings  bindings   = new Bindings();

            Assert.AreEqual(true, expression.Evaluate(bindings));
        }
示例#4
0
        /// <summary>
        /// Equality comparison. Unlike the Match operation, the Equals operation requires direct value equality.
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public override bool Equals(object obj)
        {
            var other = obj as Triple;

            if (other == null)
            {
                return(false);
            }
            return((Subject == null && other.Subject == null || Subject != null && Subject.Equals(other.Subject)) &&
                   (Predicate == null && other.Predicate == null ||
                    Predicate != null && Predicate.Equals(other.Predicate)) &&
                   IsLiteral.Equals(other.IsLiteral) &&
                   (Object == null && other.Object == null || Object != null && Object.Equals(other.Object)) &&
                   (Graph == null && other.Graph == null || Graph != null && Graph.Equals(other.Graph)) &&
                   (DataType == null && other.DataType == null ||
                    DataType != null && DataType.Equals(other.DataType)) &&
                   (LangCode == null && other.LangCode == null ||
                    LangCode != null && LangCode.Equals(other.LangCode)));
        }