internal static Snak FromContract(Contracts.Snak snak) { Debug.Assert(snak != null); var inst = new Snak(snak.Property); inst.LoadFromContract(snak); return(inst); }
/// <summary> /// Initializes a new <see cref="Claim"/> instance with the main snak set to property id. /// </summary> /// <param name="mainSnakPropertyId">The property ID of the auto-constructed main snak.</param> /// <exception cref="ArgumentNullException"><paramref name="mainSnakPropertyId"/> is <c>null</c>.</exception> public Claim(string mainSnakPropertyId) { if (mainSnakPropertyId == null) { throw new ArgumentNullException(nameof(mainSnakPropertyId)); } MainSnak = new Snak(mainSnakPropertyId); }
internal static Claim FromContract(Contracts.Claim claim) { Debug.Assert(claim != null); if (claim.MainSnak == null) { throw new ArgumentException("Invalid claim. MainSnak is null.", nameof(claim)); } var inst = new Claim(Snak.FromContract(claim.MainSnak)); inst.LoadFromContract(claim); return(inst); }
/// <summary> /// Initializes a new <see cref="Claim"/> instance with the main snak set to property id and value. /// </summary> /// <param name="propertyId">The property ID of the auto-constructed main snak.</param> /// <param name="dataValue">The data value of the main snak.</param> /// <param name="dataType">The data type of the main snak.</param> /// <exception cref="ArgumentNullException"><paramref name="propertyId"/> or <paramref name="dataType"/> is <c>null</c>.</exception> public Claim(string propertyId, object dataValue, WikibaseDataType dataType) { MainSnak = new Snak(propertyId, dataValue, dataType); }
/// <summary> /// Initializes a new <see cref="Claim"/> instance with the specified main snak. /// </summary> /// <param name="mainSnak">The main snak containing the property and value of the claim.</param> /// <exception cref="ArgumentNullException"><paramref name="mainSnak"/> is <c>null</c>.</exception> public Claim(Snak mainSnak) { MainSnak = mainSnak ?? throw new ArgumentNullException(nameof(mainSnak)); }