/// <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> /// Adds the given literal fact to the "owl:versionInfo" annotations about this ontology resource /// </summary> public RDFOntologyResource AddVersionInfo(RDFOntologyFact versionInfo) { if (versionInfo != null && versionInfo.IsLiteralFact()) { //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.VersionInfo.ContainsKey(versionInfo.PatternMemberID)) { this.VersionInfo.Add(versionInfo.PatternMemberID, versionInfo); } } } } return this; }
/// <summary> /// Removes the given literal fact from the "rdfs:label" annotations about this ontology resource /// </summary> public RDFOntologyResource RemoveLabel(RDFOntologyFact label) { if (label != null && label.IsLiteralFact()) { if (this.Label.ContainsKey(label.PatternMemberID)) { this.Label.Remove(label.PatternMemberID); } } return this; }
/// <summary> /// Removes the given literal fact from the "rdfs:comment" annotations about this ontology resource /// </summary> public RDFOntologyResource RemoveComment(RDFOntologyFact comment) { if (comment != null && comment.IsLiteralFact()) { if (this.Comment.ContainsKey(comment.PatternMemberID)) { this.Comment.Remove(comment.PatternMemberID); } } return this; }
/// <summary> /// Removes the given literal fact from the "owl:versionInfo" annotations about this ontology resource /// </summary> public RDFOntologyResource RemoveVersionInfo(RDFOntologyFact versionInfo) { if (versionInfo != null && versionInfo.IsLiteralFact()) { if (this.VersionInfo.ContainsKey(versionInfo.PatternMemberID)) { this.VersionInfo.Remove(versionInfo.PatternMemberID); } } return this; }
/// <summary> /// Adds the given literal fact to the "rdfs:label" annotations about this ontology resource /// </summary> public RDFOntologyResource AddLabel(RDFOntologyFact label) { if (label != null && label.IsLiteralFact()) { //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.Label.ContainsKey(label.PatternMemberID)) { this.Label.Add(label.PatternMemberID, label); } } } } return this; }
/// <summary> /// Adds the given literal fact to the "rdfs:comment" annotations about this ontology resource /// </summary> public RDFOntologyResource AddComment(RDFOntologyFact comment) { if (comment != null && comment.IsLiteralFact()) { //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.Comment.ContainsKey(comment.PatternMemberID)) { this.Comment.Add(comment.PatternMemberID, comment); } } } } 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; }