/// <summary>Determines whether two TypedLiteral instances are equal.</summary> /// <returns>True if the two TypedLiterals are equal, False otherwise</returns> /// <remarks>Two typed literal nodes are equal if their lexical values compare equal character by character and their datatype URI references are equal character by character..</remarks> public override bool Equals(object other) { if (other == null) { return(false); } if (this.GetType() != other.GetType()) { return(false); } if (GetHashCode() != other.GetHashCode()) { return(false); } TypedLiteral specific = (TypedLiteral)other; if (!itsLexicalValue.Equals(specific.itsLexicalValue)) { return(false); } if (!itsDataTypeUriRef.Equals(specific.itsDataTypeUriRef)) { return(false); } return(true); }
public bool EffectiveBooleanValue(object value) { if (value.Equals(true)) { return(true); } if (value.Equals(false)) { return(false); } if (value is TypedLiteral) { TypedLiteral specific = (TypedLiteral)value; if (specific.GetDataType().Equals(XSD_BOOLEAN)) { return(0 == theComparer.Compare("true", specific.GetLabel())); } else if (specific.GetDataType().Equals(XSD_STRING)) { return(0 != specific.GetLabel().Length); } else if (specific.GetDataType().Equals(XSD_INTEGER)) { return(0 != Convert.ToInt32(specific.GetLabel())); } else if (specific.GetDataType().Equals(XSD_DECIMAL)) { return(0 != Convert.ToDecimal(specific.GetLabel())); } else if (specific.GetDataType().Equals(XSD_DOUBLE)) { return(0.0 != Convert.ToDouble(specific.GetLabel())); } else if (specific.GetDataType().Equals(XSD_FLOAT)) { return(0.0 != Convert.ToSingle(specific.GetLabel())); } } else if (value is PlainLiteral) { return(0 != ((PlainLiteral)value).GetLabel().Length); } return(false); }
public virtual Statement MakeStatement(BlankNode subject, UriRef predicate, TypedLiteral value) { return(new Statement(subject, predicate, value)); }