/// <summary> /// Builds a new union data from this data and a given one /// </summary> public RDFOntologyData UnionWith(RDFOntologyData ontologyData) { var result = new RDFOntologyData(); //Add facts from this data foreach (var f in this) { result.AddFact(f); } //Add literals from this data foreach (var l in this.Literals.Values) { result.AddLiteral(l); } //Add relations from this data result.Relations.ClassType = result.Relations.ClassType.UnionWith(this.Relations.ClassType); result.Relations.SameAs = result.Relations.SameAs.UnionWith(this.Relations.SameAs); result.Relations.DifferentFrom = result.Relations.DifferentFrom.UnionWith(this.Relations.DifferentFrom); result.Relations.Assertions = result.Relations.Assertions.UnionWith(this.Relations.Assertions); //Add annotations from this data result.Annotations.VersionInfo = result.Annotations.VersionInfo.UnionWith(this.Annotations.VersionInfo); result.Annotations.Comment = result.Annotations.Comment.UnionWith(this.Annotations.Comment); result.Annotations.Label = result.Annotations.Label.UnionWith(this.Annotations.Label); result.Annotations.SeeAlso = result.Annotations.SeeAlso.UnionWith(this.Annotations.SeeAlso); result.Annotations.IsDefinedBy = result.Annotations.IsDefinedBy.UnionWith(this.Annotations.IsDefinedBy); result.Annotations.CustomAnnotations = result.Annotations.CustomAnnotations.UnionWith(this.Annotations.CustomAnnotations); //Manage the given data if (ontologyData != null) { //Add facts from the given data foreach (var f in ontologyData) { result.AddFact(f); } //Add literals from the given data foreach (var l in ontologyData.Literals.Values) { result.AddLiteral(l); } //Add relations from the given data result.Relations.ClassType = result.Relations.ClassType.UnionWith(ontologyData.Relations.ClassType); result.Relations.SameAs = result.Relations.SameAs.UnionWith(ontologyData.Relations.SameAs); result.Relations.DifferentFrom = result.Relations.DifferentFrom.UnionWith(ontologyData.Relations.DifferentFrom); result.Relations.Assertions = result.Relations.Assertions.UnionWith(ontologyData.Relations.Assertions); //Add annotations from the given data result.Annotations.VersionInfo = result.Annotations.VersionInfo.UnionWith(ontologyData.Annotations.VersionInfo); result.Annotations.Comment = result.Annotations.Comment.UnionWith(ontologyData.Annotations.Comment); result.Annotations.Label = result.Annotations.Label.UnionWith(ontologyData.Annotations.Label); result.Annotations.SeeAlso = result.Annotations.SeeAlso.UnionWith(ontologyData.Annotations.SeeAlso); result.Annotations.IsDefinedBy = result.Annotations.IsDefinedBy.UnionWith(ontologyData.Annotations.IsDefinedBy); result.Annotations.CustomAnnotations = result.Annotations.CustomAnnotations.UnionWith(ontologyData.Annotations.CustomAnnotations); } return(result); }
/// <summary> /// Checks if the given aFact is differentFrom the given bFact within the given data /// </summary> public static Boolean IsDifferentFactFrom(RDFOntologyFact aFact, RDFOntologyFact bFact, RDFOntologyData data) { return(aFact != null && bFact != null && data != null ? EnlistDifferentFactsFrom(aFact, data).Facts.ContainsKey(bFact.PatternMemberID) : false); }
/// <summary> /// Checks if the given afact can be set differentfrom the given bfact /// </summary> internal static Boolean CheckDifferentFromCompatibility(RDFOntologyData ontologyData, RDFOntologyFact aFact, RDFOntologyFact bFact) { return(!ontologyData.CheckIsSameFactAs(aFact, bFact)); }
/// <summary> /// Checks if the given aFact is sameAs the given bFact within the given data /// </summary> public static Boolean IsSameFactAs(RDFOntologyFact aFact, RDFOntologyFact bFact, RDFOntologyData data) { return(aFact != null && bFact != null && data != null ? EnlistSameFactsAs(aFact, data).Facts.ContainsKey(bFact.PatternMemberID) : false); }