Beispiel #1
0
 int IComparable.CompareTo(object other)
 {
     return(FluentCompare <Triple>
            .Arguments(this, other)
            .By(t => t.Subject)
            .By(t => t.Predicate)
            .By(t => t.Object)
            .End());
 }
Beispiel #2
0
 int IComparable.CompareTo(object other)
 {
     return(FluentCompare <EntityQuad>
            .Arguments(this, other)
            .By(t => t.EntityId)
            .By(t => t.Graph)
            .By(t => t.Subject)
            .By(t => t.Predicate)
            .By(t => t.Object)
            .End());
 }
Beispiel #3
0
        int IComparable <INode> .CompareTo(INode other)
        {
            var compare = FluentCompare <Node> .Arguments(this, other);

            if ((IsUri || IsBlank))
            {
                if ((IsUri) && (other.IsUri))
                {
                    return(compare.By(n => n.Uri.AbsoluteUri).End());
                }

                if ((IsBlank) && (other.IsBlank))
                {
                    return(compare.By(n => n.BlankNode).End());
                }

                if (((IsUri) && (!other.IsUri)) || (IsBlank && other.IsLiteral))
                {
                    // blank node is more than literal node
                    // Uri node is more than blank node
                    return(1);
                }

                // Literal node is always less then URI and blanks
                return(-1);
            }

            if (other.IsLiteral)
            {
                return(compare.By(n => n.Literal, StringComparer.Ordinal)
                       .By(n => n.DataType, new AbsoluteUriComparer())
                       .By(n => n.Language, StringComparer.OrdinalIgnoreCase).End());
            }

            // Literal node is always less then URI and blanks
            return(-1);
        }