/// <summary> /// Adds the given ontology fact to the enumerate members of this /// </summary> public RDFOntologyEnumerateClass AddEnumerateMember(RDFOntologyFact enumerateMember) { if (enumerateMember != null) { //Maintain consistency against specified category of members: all resources or all literals if( (this.Category == RDFSemanticsEnums.RDFOntologyEnumerateClassCategory.ResourceEnumeration && enumerateMember.IsObjectFact()) || (this.Category == RDFSemanticsEnums.RDFOntologyEnumerateClassCategory.LiteralEnumeration && enumerateMember.IsLiteralFact())) { if (!this.EnumerateMembers.ContainsKey(enumerateMember.PatternMemberID)) { this.EnumerateMembers.Add(enumerateMember.PatternMemberID, enumerateMember); } } } return this; }
/// <summary> /// Removes the given resource fact from the "rdfs:isDefinedBy" annotations about this ontology resource /// </summary> public RDFOntologyResource RemoveIsDefinedBy(RDFOntologyFact isDefinedBy) { if (isDefinedBy != null && isDefinedBy.IsObjectFact()) { if (this.IsDefinedBy.ContainsKey(isDefinedBy.PatternMemberID)) { this.IsDefinedBy.Remove(isDefinedBy.PatternMemberID); } } return this; }
/// <summary> /// Removes the given resource fact from the "rdfs:seeAlso" annotations about this ontology resource /// </summary> public RDFOntologyResource RemoveSeeAlso(RDFOntologyFact seeAlso) { if (seeAlso != null && seeAlso.IsObjectFact()) { if (this.SeeAlso.ContainsKey(seeAlso.PatternMemberID)) { this.SeeAlso.Remove(seeAlso.PatternMemberID); } } return this; }
/// <summary> /// Adds the given resource fact to the "rdfs:isDefinedBy" annotations about this ontology resource /// </summary> public RDFOntologyResource AddIsDefinedBy(RDFOntologyFact isDefinedBy) { if (isDefinedBy != null && isDefinedBy.IsObjectFact()) { //Cannot make axioms on annotation properties if (!(this is RDFOntologyProperty && ((RDFOntologyProperty)this).IsAnnotationProperty())) { //Cannot assign attributes to literal ontology facts if (!(this is RDFOntologyFact && ((RDFOntologyFact)this).IsLiteralFact())) { if (!this.IsDefinedBy.ContainsKey(isDefinedBy.PatternMemberID)) { this.IsDefinedBy.Add(isDefinedBy.PatternMemberID, isDefinedBy); } } } } return this; }
/// <summary> /// Adds the given resource fact to the "rdfs:seeAlso" annotations about this ontology resource /// </summary> public RDFOntologyResource AddSeeAlso(RDFOntologyFact seeAlso) { if (seeAlso != null && seeAlso.IsObjectFact()) { //Cannot make axioms on annotation properties if (!(this is RDFOntologyProperty && ((RDFOntologyProperty)this).IsAnnotationProperty())) { //Cannot assign attributes to literal ontology facts if (!(this is RDFOntologyFact && ((RDFOntologyFact)this).IsLiteralFact())) { if (!this.SeeAlso.ContainsKey(seeAlso.PatternMemberID)) { this.SeeAlso.Add(seeAlso.PatternMemberID, seeAlso); } } } } return this; }
/// <summary> /// Adds the given ontology attribute to the attributes of this /// </summary> public RDFOntologyFact AddOntologyAttribute(RDFOntologyProperty attrProperty, RDFOntologyFact attrValue) { if (attrProperty != null && attrValue != null) { //Attributes can only be assigned to resource ontology facts if (this.IsObjectFact()) { //Maintain disjointness between property model and reserved RDF/RDFS/OWL vocabularies if ( (!attrProperty.ToString().StartsWith(RDFVocabulary.RDF.BASE_URI.ToString(), StringComparison.Ordinal)) && (!attrProperty.ToString().StartsWith(RDFVocabulary.RDFS.BASE_URI.ToString(), StringComparison.Ordinal)) && (!attrProperty.ToString().StartsWith(RDFVocabulary.OWL.BASE_URI.ToString(), StringComparison.Ordinal)) ) { //Check consistence of property type against range fact type if( (attrProperty.IsObjectProperty() && attrValue.IsObjectFact()) || (attrProperty.IsDatatypeProperty() && attrValue.IsLiteralFact())) { var attr = new RDFOntologyAttribute(attrProperty, attrValue); if (!this.OntologyAttributes.ContainsKey(attr.AttributeID)) { this.OntologyAttributes.Add(attr.AttributeID, attr); } } } } } return this; }
/// <summary> /// Adds the given ontology fact to the ontology facts different from this /// </summary> public RDFOntologyFact AddDifferentFrom(RDFOntologyFact differentFrom) { if (differentFrom != null) { //Maintain taxonomy consistence if (!this.Equals(differentFrom)) { //Attributes can only be assigned to resource ontology facts if (this.IsObjectFact() && differentFrom.IsObjectFact()) { //Maintain consistence of "owl:differentFrom" against "owl:sameAs" if (!this.SameAs.ContainsKey(differentFrom.PatternMemberID)) { if (!this.DifferentFrom.ContainsKey(differentFrom.PatternMemberID)) { this.DifferentFrom.Add(differentFrom.PatternMemberID, differentFrom); //Maintain consistence of "owl:differentFrom" differentFrom.AddDifferentFrom(this); } } } } } return this; }