Example #1
0
        /// <summary>
        /// Removes the given standard annotation from the given ontology fact
        /// </summary>
        public RDFOntologyData RemoveStandardAnnotation(RDFSemanticsEnums.RDFOntologyStandardAnnotation standardAnnotation,
                                                        RDFOntologyFact ontologyFact,
                                                        RDFOntologyResource annotationValue)
        {
            if (ontologyFact != null && annotationValue != null)
            {
                switch (standardAnnotation)
                {
                //owl:versionInfo
                case RDFSemanticsEnums.RDFOntologyStandardAnnotation.VersionInfo:
                    this.Annotations.VersionInfo.RemoveEntry(new RDFOntologyTaxonomyEntry(ontologyFact, RDFVocabulary.OWL.VERSION_INFO.ToRDFOntologyAnnotationProperty(), annotationValue));
                    break;

                //owl:versionIRI
                case RDFSemanticsEnums.RDFOntologyStandardAnnotation.VersionIRI:
                    this.Annotations.VersionIRI.RemoveEntry(new RDFOntologyTaxonomyEntry(ontologyFact, RDFVocabulary.OWL.VERSION_IRI.ToRDFOntologyAnnotationProperty(), annotationValue));
                    break;

                //rdfs:comment
                case RDFSemanticsEnums.RDFOntologyStandardAnnotation.Comment:
                    this.Annotations.Comment.RemoveEntry(new RDFOntologyTaxonomyEntry(ontologyFact, RDFVocabulary.RDFS.COMMENT.ToRDFOntologyAnnotationProperty(), annotationValue));
                    break;

                //rdfs:label
                case RDFSemanticsEnums.RDFOntologyStandardAnnotation.Label:
                    this.Annotations.Label.RemoveEntry(new RDFOntologyTaxonomyEntry(ontologyFact, RDFVocabulary.RDFS.LABEL.ToRDFOntologyAnnotationProperty(), annotationValue));
                    break;

                //rdfs:seeAlso
                case RDFSemanticsEnums.RDFOntologyStandardAnnotation.SeeAlso:
                    this.Annotations.SeeAlso.RemoveEntry(new RDFOntologyTaxonomyEntry(ontologyFact, RDFVocabulary.RDFS.SEE_ALSO.ToRDFOntologyAnnotationProperty(), annotationValue));
                    break;

                //rdfs:isDefinedBy
                case RDFSemanticsEnums.RDFOntologyStandardAnnotation.IsDefinedBy:
                    this.Annotations.IsDefinedBy.RemoveEntry(new RDFOntologyTaxonomyEntry(ontologyFact, RDFVocabulary.RDFS.IS_DEFINED_BY.ToRDFOntologyAnnotationProperty(), annotationValue));
                    break;

                //owl:priorVersion
                case RDFSemanticsEnums.RDFOntologyStandardAnnotation.PriorVersion:
                    this.Annotations.PriorVersion.RemoveEntry(new RDFOntologyTaxonomyEntry(ontologyFact, RDFVocabulary.OWL.PRIOR_VERSION.ToRDFOntologyAnnotationProperty(), annotationValue));
                    break;

                //owl:imports
                case RDFSemanticsEnums.RDFOntologyStandardAnnotation.Imports:
                    this.Annotations.Imports.RemoveEntry(new RDFOntologyTaxonomyEntry(ontologyFact, RDFVocabulary.OWL.IMPORTS.ToRDFOntologyAnnotationProperty(), annotationValue));
                    break;

                //owl:backwardCompatibleWith
                case RDFSemanticsEnums.RDFOntologyStandardAnnotation.BackwardCompatibleWith:
                    this.Annotations.BackwardCompatibleWith.RemoveEntry(new RDFOntologyTaxonomyEntry(ontologyFact, RDFVocabulary.OWL.BACKWARD_COMPATIBLE_WITH.ToRDFOntologyAnnotationProperty(), annotationValue));
                    break;

                //owl:incompatibleWith
                case RDFSemanticsEnums.RDFOntologyStandardAnnotation.IncompatibleWith:
                    this.Annotations.IncompatibleWith.RemoveEntry(new RDFOntologyTaxonomyEntry(ontologyFact, RDFVocabulary.OWL.INCOMPATIBLE_WITH.ToRDFOntologyAnnotationProperty(), annotationValue));
                    break;
                }
            }
            return(this);
        }
Example #2
0
        /// <summary>
        /// Adds the given standard annotation to the given ontology fact
        /// </summary>
        public RDFOntologyData AddStandardAnnotation(RDFSemanticsEnums.RDFOntologyStandardAnnotation standardAnnotation,
                                                     RDFOntologyFact ontologyFact,
                                                     RDFOntologyResource annotationValue)
        {
            if (ontologyFact != null && annotationValue != null)
            {
                switch (standardAnnotation)
                {
                //owl:versionInfo
                case RDFSemanticsEnums.RDFOntologyStandardAnnotation.VersionInfo:
                    if (annotationValue.IsLiteral())
                    {
                        this.Annotations.VersionInfo.AddEntry(new RDFOntologyTaxonomyEntry(ontologyFact, RDFVocabulary.OWL.VERSION_INFO.ToRDFOntologyAnnotationProperty(), annotationValue));
                    }
                    else
                    {
                        RDFSemanticsEvents.RaiseSemanticsInfo(String.Format("Cannot annotate ontology fact with owl:versionInfo value '{0}' because it is not an ontology literal", annotationValue));
                    }
                    break;

                //owl:versionIRI
                case RDFSemanticsEnums.RDFOntologyStandardAnnotation.VersionIRI:
                    RDFSemanticsEvents.RaiseSemanticsInfo("Cannot annotate ontology fact with owl:versionIRI because it is reserved for ontologies");
                    break;

                //rdfs:comment
                case RDFSemanticsEnums.RDFOntologyStandardAnnotation.Comment:
                    if (annotationValue.IsLiteral())
                    {
                        this.Annotations.Comment.AddEntry(new RDFOntologyTaxonomyEntry(ontologyFact, RDFVocabulary.RDFS.COMMENT.ToRDFOntologyAnnotationProperty(), annotationValue));
                    }
                    else
                    {
                        RDFSemanticsEvents.RaiseSemanticsInfo(String.Format("Cannot annotate ontology fact with rdfs:comment value '{0}' because it is not an ontology literal", annotationValue));
                    }
                    break;

                //rdfs:label
                case RDFSemanticsEnums.RDFOntologyStandardAnnotation.Label:
                    if (annotationValue.IsLiteral())
                    {
                        this.Annotations.Label.AddEntry(new RDFOntologyTaxonomyEntry(ontologyFact, RDFVocabulary.RDFS.LABEL.ToRDFOntologyAnnotationProperty(), annotationValue));
                    }
                    else
                    {
                        RDFSemanticsEvents.RaiseSemanticsInfo(String.Format("Cannot annotate ontology fact with rdfs:label value '{0}' because it is not an ontology literal", annotationValue));
                    }
                    break;

                //rdfs:seeAlso
                case RDFSemanticsEnums.RDFOntologyStandardAnnotation.SeeAlso:
                    this.Annotations.SeeAlso.AddEntry(new RDFOntologyTaxonomyEntry(ontologyFact, RDFVocabulary.RDFS.SEE_ALSO.ToRDFOntologyAnnotationProperty(), annotationValue));
                    break;

                //rdfs:isDefinedBy
                case RDFSemanticsEnums.RDFOntologyStandardAnnotation.IsDefinedBy:
                    this.Annotations.IsDefinedBy.AddEntry(new RDFOntologyTaxonomyEntry(ontologyFact, RDFVocabulary.RDFS.IS_DEFINED_BY.ToRDFOntologyAnnotationProperty(), annotationValue));
                    break;

                //owl:priorVersion
                case RDFSemanticsEnums.RDFOntologyStandardAnnotation.PriorVersion:
                    RDFSemanticsEvents.RaiseSemanticsInfo("Cannot annotate ontology fact with owl:priorVersion because it is reserved for ontologies");
                    break;

                //owl:imports
                case RDFSemanticsEnums.RDFOntologyStandardAnnotation.Imports:
                    RDFSemanticsEvents.RaiseSemanticsInfo("Cannot annotate ontology fact with owl:imports because it is reserved for ontologies");
                    break;

                //owl:backwardCompatibleWith
                case RDFSemanticsEnums.RDFOntologyStandardAnnotation.BackwardCompatibleWith:
                    RDFSemanticsEvents.RaiseSemanticsInfo("Cannot annotate ontology fact with owl:backwardCompatibleWith because it is reserved for ontologies");
                    break;

                //owl:incompatibleWith
                case RDFSemanticsEnums.RDFOntologyStandardAnnotation.IncompatibleWith:
                    RDFSemanticsEvents.RaiseSemanticsInfo("Cannot annotate ontology fact with owl:incompatibleWith because it is reserved for ontologies");
                    break;
                }
            }
            return(this);
        }