Exemplo n.º 1
0
        /// <summary>
        /// Checks if the skos:narrower/skos:narrowerTransitive/skos:narrowMatch relation can be added to the given aConcept with the given bConcept
        /// </summary>
        internal static Boolean CheckNarrowerRelation(RDFSKOSConceptScheme conceptScheme,
                                                      RDFSKOSConcept aConcept,
                                                      RDFSKOSConcept bConcept)
        {
            var canAddNarrowerRel = false;

            //Avoid clash with hierarchical relations
            canAddNarrowerRel = !conceptScheme.CheckHasBroaderConcept(aConcept, bConcept);

            //Avoid clash with associative relations
            if (canAddNarrowerRel)
            {
                canAddNarrowerRel = !conceptScheme.CheckHasRelatedConcept(aConcept, bConcept);
            }

            //Avoid clash with mapping relations
            if (canAddNarrowerRel)
            {
                canAddNarrowerRel = (!conceptScheme.CheckHasBroadMatchConcept(aConcept, bConcept) &&
                                     !conceptScheme.CheckHasCloseMatchConcept(aConcept, bConcept) &&
                                     !conceptScheme.CheckHasExactMatchConcept(aConcept, bConcept) &&
                                     !conceptScheme.CheckHasRelatedMatchConcept(aConcept, bConcept));
            }

            return(canAddNarrowerRel);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Checks if the skos:hiddenLabel/skosxl:hiddenLabel informations can be added to the given concept
        /// </summary>
        internal static Boolean CheckHiddenLabel(RDFSKOSConceptScheme conceptScheme,
                                                 RDFOntologyFact concept,
                                                 RDFOntologyLiteral literal)
        {
            var canAddHiddenLabelInfo = false;

            //Pairwise disjointness with skos:prefLabel/skosxl:prefLabel must be preserved
            canAddHiddenLabelInfo = !(conceptScheme.Annotations.PrefLabel.SelectEntriesBySubject(concept)
                                      .Any(x => x.TaxonomyObject.Equals(literal)));

            if (canAddHiddenLabelInfo)
            {
                canAddHiddenLabelInfo = !(conceptScheme.Relations.PrefLabel.SelectEntriesBySubject(concept)
                                          .Any(x => conceptScheme.Relations.LiteralForm.SelectEntriesBySubject(x.TaxonomyObject)
                                               .Any(y => y.TaxonomyObject.Equals(literal))));
            }

            //Pairwise disjointness with skos:altLabel/skosxl:altLabel must be preserved
            if (canAddHiddenLabelInfo)
            {
                canAddHiddenLabelInfo = !(conceptScheme.Annotations.AltLabel.SelectEntriesBySubject(concept)
                                          .Any(x => x.TaxonomyObject.Equals(literal)));
            }

            if (canAddHiddenLabelInfo)
            {
                canAddHiddenLabelInfo = !(conceptScheme.Relations.AltLabel.SelectEntriesBySubject(concept)
                                          .Any(x => conceptScheme.Relations.LiteralForm.SelectEntriesBySubject(x.TaxonomyObject)
                                               .Any(y => y.TaxonomyObject.Equals(literal))));
            }

            return(canAddHiddenLabelInfo);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Adds the given concept to the conceptScheme as top concept of the hierarchy
 /// </summary>
 public static RDFSKOSConceptScheme AddTopConceptRelation(this RDFSKOSConceptScheme conceptScheme,
                                                          RDFSKOSConcept concept)
 {
     if (conceptScheme != null && concept != null && !conceptScheme.Equals(concept))
     {
         //Add skos:hasTopConcept relation to the scheme
         conceptScheme.Relations.TopConcept.AddEntry(new RDFOntologyTaxonomyEntry(conceptScheme, RDFVocabulary.SKOS.HAS_TOP_CONCEPT.ToRDFOntologyObjectProperty(), concept));
     }
     return(conceptScheme);
 }
Exemplo n.º 4
0
 /// <summary>
 /// Adds the given literal form of the given label within the conceptScheme
 /// </summary>
 public static RDFSKOSConceptScheme AddLiteralFormAssertion(this RDFSKOSConceptScheme conceptScheme,
                                                            RDFSKOSLabel label,
                                                            RDFOntologyLiteral literal)
 {
     if (conceptScheme != null && label != null && literal != null)
     {
         //Add literalForm relation
         conceptScheme.Relations.LiteralForm.AddEntry(new RDFOntologyTaxonomyEntry(label, RDFVocabulary.SKOS.SKOSXL.LITERAL_FORM.ToRDFOntologyDatatypeProperty(), literal));
     }
     return(conceptScheme);
 }
Exemplo n.º 5
0
 /// <summary>
 /// Adds the given notation to the given concept within the conceptScheme
 /// </summary>
 public static RDFSKOSConceptScheme AddNotationRelation(this RDFSKOSConceptScheme conceptScheme,
                                                        RDFSKOSConcept concept,
                                                        RDFOntologyLiteral notationLiteral)
 {
     if (conceptScheme != null && concept != null && notationLiteral != null)
     {
         //Add skos:Notation relation to the scheme
         conceptScheme.Relations.Notation.AddEntry(new RDFOntologyTaxonomyEntry(concept, RDFVocabulary.SKOS.NOTATION.ToRDFOntologyDatatypeProperty(), notationLiteral));
     }
     return(conceptScheme);
 }
Exemplo n.º 6
0
 /// <summary>
 /// Adds the given literal as 'skos:example' annotation of the given concept within the conceptScheme
 /// </summary>
 public static RDFSKOSConceptScheme AddExampleAnnotation(this RDFSKOSConceptScheme conceptScheme,
                                                         RDFSKOSConcept concept,
                                                         RDFOntologyLiteral literal)
 {
     if (conceptScheme != null && concept != null && literal != null)
     {
         //Add example annotation to the scheme
         conceptScheme.Annotations.Example.AddEntry(new RDFOntologyTaxonomyEntry(concept, RDFVocabulary.SKOS.EXAMPLE.ToRDFOntologyAnnotationProperty(), literal));
     }
     return(conceptScheme);
 }
Exemplo n.º 7
0
 /// <summary>
 /// Adds a 'skos:semanticRelation' relation between the given concepts within the conceptScheme
 /// </summary>
 public static RDFSKOSConceptScheme AddSemanticRelation(this RDFSKOSConceptScheme conceptScheme,
                                                        RDFSKOSConcept aConcept,
                                                        RDFSKOSConcept bConcept)
 {
     if (conceptScheme != null && aConcept != null && bConcept != null && !aConcept.Equals(bConcept))
     {
         //Add skos:semanticRelation relation to the scheme
         conceptScheme.Relations.SemanticRelation.AddEntry(new RDFOntologyTaxonomyEntry(aConcept, RDFVocabulary.SKOS.SEMANTIC_RELATION.ToRDFOntologyObjectProperty(), bConcept));
     }
     return(conceptScheme);
 }
Exemplo n.º 8
0
 /// <summary>
 /// Adds the given literal as 'skos:scopeNote' annotation of the given concept within the conceptScheme
 /// </summary>
 public static RDFSKOSConceptScheme AddScopeNoteAnnotation(this RDFSKOSConceptScheme conceptScheme,
                                                           RDFSKOSConcept concept,
                                                           RDFOntologyLiteral literal)
 {
     if (conceptScheme != null && concept != null && literal != null)
     {
         //Add scopeNote annotation to the scheme
         conceptScheme.Annotations.ScopeNote.AddEntry(new RDFOntologyTaxonomyEntry(concept, RDFVocabulary.SKOS.SCOPE_NOTE.ToRDFOntologyAnnotationProperty(), literal));
     }
     return(conceptScheme);
 }
Exemplo n.º 9
0
 /// <summary>
 /// Adds the given literal as 'skos:definition' annotation of the given concept within the conceptScheme
 /// </summary>
 public static RDFSKOSConceptScheme AddDefinitionAnnotation(this RDFSKOSConceptScheme conceptScheme,
                                                            RDFSKOSConcept concept,
                                                            RDFOntologyLiteral literal)
 {
     if (conceptScheme != null && concept != null && literal != null)
     {
         //Add definition annotation to the scheme
         conceptScheme.Annotations.Definition.AddEntry(new RDFOntologyTaxonomyEntry(concept, RDFVocabulary.SKOS.DEFINITION.ToRDFOntologyAnnotationProperty(), literal));
     }
     return(conceptScheme);
 }
Exemplo n.º 10
0
        /// <summary>
        /// Enlists the skos:exactMatch concepts of the given concept within the given scheme
        /// </summary>
        public static RDFSKOSConceptScheme GetExactMatchConceptsOf(this RDFSKOSConceptScheme conceptScheme,
                                                                   RDFSKOSConcept concept)
        {
            var result = new RDFSKOSConceptScheme((RDFResource)conceptScheme.Value);

            if (concept != null && conceptScheme != null)
            {
                result = conceptScheme.GetExactMatchConceptsOfInternal(concept, null)
                         .RemoveConcept(concept);                //Safety deletion
            }
            return(result);
        }
Exemplo n.º 11
0
 /// <summary>
 /// Adds a 'skosxl:labelRelation' relation between the given labels within the conceptScheme
 /// </summary>
 public static RDFSKOSConceptScheme AddLabelRelation(this RDFSKOSConceptScheme conceptScheme,
                                                     RDFSKOSLabel aLabel,
                                                     RDFSKOSLabel bLabel)
 {
     if (conceptScheme != null && aLabel != null && bLabel != null && !aLabel.Equals(bLabel))
     {
         //Add skosxl:labelRelation relation to the scheme
         conceptScheme.Relations.LabelRelation.AddEntry(new RDFOntologyTaxonomyEntry(aLabel, RDFVocabulary.SKOS.SKOSXL.LABEL_RELATION.ToRDFOntologyObjectProperty(), bLabel));
         conceptScheme.Relations.LabelRelation.AddEntry(new RDFOntologyTaxonomyEntry(bLabel, RDFVocabulary.SKOS.SKOSXL.LABEL_RELATION.ToRDFOntologyObjectProperty(), aLabel)
                                                        .SetInference(RDFSemanticsEnums.RDFOntologyInferenceType.API));
     }
     return(conceptScheme);
 }
Exemplo n.º 12
0
 /// <summary>
 /// Adds a 'skos:broaderTransitive' relation between the given concepts within the conceptScheme
 /// </summary>
 public static RDFSKOSConceptScheme AddBroaderTransitiveRelation(this RDFSKOSConceptScheme conceptScheme,
                                                                 RDFSKOSConcept aConcept,
                                                                 RDFSKOSConcept bConcept)
 {
     if (conceptScheme != null && aConcept != null && bConcept != null && !aConcept.Equals(bConcept))
     {
         if (RDFSKOSChecker.CheckBroaderRelation(conceptScheme, aConcept, bConcept))
         {
             //Add skos:broaderTransitive relation to the scheme
             conceptScheme.Relations.BroaderTransitive.AddEntry(new RDFOntologyTaxonomyEntry(aConcept, RDFVocabulary.SKOS.BROADER_TRANSITIVE.ToRDFOntologyObjectProperty(), bConcept));
         }
     }
     return(conceptScheme);
 }
Exemplo n.º 13
0
        /// <summary>
        /// Enlists the skos:closeMatch concepts of the given concept within the given scheme
        /// </summary>
        public static RDFSKOSConceptScheme GetCloseMatchConceptsOf(this RDFSKOSConceptScheme conceptScheme,
                                                                   RDFSKOSConcept concept)
        {
            var result = new RDFSKOSConceptScheme((RDFResource)conceptScheme.Value);

            if (concept != null && conceptScheme != null)
            {
                foreach (var closeMatchConcept in conceptScheme.Relations.CloseMatch.SelectEntriesBySubject(concept))
                {
                    result.AddConcept((RDFSKOSConcept)closeMatchConcept.TaxonomyObject);
                }
            }
            return(result);
        }
Exemplo n.º 14
0
 /// <summary>
 /// Adds a 'skos:narrowMatch' relation between the given concepts within the conceptScheme
 /// </summary>
 public static RDFSKOSConceptScheme AddNarrowMatchRelation(this RDFSKOSConceptScheme conceptScheme,
                                                           RDFSKOSConcept aConcept,
                                                           RDFSKOSConcept bConcept)
 {
     if (conceptScheme != null && aConcept != null && bConcept != null && !aConcept.Equals(bConcept))
     {
         if (RDFSKOSChecker.CheckNarrowerRelation(conceptScheme, aConcept, bConcept))
         {
             //Add skos:narrowMatch relation to the scheme
             conceptScheme.Relations.NarrowMatch.AddEntry(new RDFOntologyTaxonomyEntry(aConcept, RDFVocabulary.SKOS.NARROW_MATCH.ToRDFOntologyObjectProperty(), bConcept));
         }
     }
     return(conceptScheme);
 }
Exemplo n.º 15
0
 /// <summary>
 /// Adds a 'skos:related' relation between the given concepts within the conceptScheme
 /// </summary>
 public static RDFSKOSConceptScheme AddRelatedRelation(this RDFSKOSConceptScheme conceptScheme,
                                                       RDFSKOSConcept aConcept,
                                                       RDFSKOSConcept bConcept)
 {
     if (conceptScheme != null && aConcept != null && bConcept != null && !aConcept.Equals(bConcept))
     {
         if (RDFSKOSChecker.CheckRelatedRelation(conceptScheme, aConcept, bConcept))
         {
             //Add skos:related relations to the scheme
             conceptScheme.Relations.Related.AddEntry(new RDFOntologyTaxonomyEntry(aConcept, RDFVocabulary.SKOS.RELATED.ToRDFOntologyObjectProperty(), bConcept));
             conceptScheme.Relations.Related.AddEntry(new RDFOntologyTaxonomyEntry(bConcept, RDFVocabulary.SKOS.RELATED.ToRDFOntologyObjectProperty(), aConcept)
                                                      .SetInference(RDFSemanticsEnums.RDFOntologyInferenceType.API));
         }
     }
     return(conceptScheme);
 }
Exemplo n.º 16
0
 /// <summary>
 /// Adds a 'skos:exactMatch' relation between the given concepts within the conceptScheme
 /// </summary>
 public static RDFSKOSConceptScheme AddExactMatchRelation(this RDFSKOSConceptScheme conceptScheme,
                                                          RDFSKOSConcept aConcept,
                                                          RDFSKOSConcept bConcept)
 {
     if (conceptScheme != null && aConcept != null && bConcept != null && !aConcept.Equals(bConcept))
     {
         if (RDFSKOSChecker.CheckCloseOrExactMatchRelation(conceptScheme, aConcept, bConcept))
         {
             //Add skos:exactMatch relation to the scheme
             conceptScheme.Relations.ExactMatch.AddEntry(new RDFOntologyTaxonomyEntry(aConcept, RDFVocabulary.SKOS.EXACT_MATCH.ToRDFOntologyObjectProperty(), bConcept));
             conceptScheme.Relations.ExactMatch.AddEntry(new RDFOntologyTaxonomyEntry(bConcept, RDFVocabulary.SKOS.EXACT_MATCH.ToRDFOntologyObjectProperty(), aConcept)
                                                         .SetInference(RDFSemanticsEnums.RDFOntologyInferenceType.API));
         }
     }
     return(conceptScheme);
 }
Exemplo n.º 17
0
 /// <summary>
 /// Adds the given literal as preferred label annotation of the given concept within the conceptScheme
 /// </summary>
 public static RDFSKOSConceptScheme AddPrefLabelAnnotation(this RDFSKOSConceptScheme conceptScheme,
                                                           RDFSKOSConcept concept,
                                                           RDFOntologyLiteral prefLabelLiteral)
 {
     if (conceptScheme != null && concept != null && prefLabelLiteral != null)
     {
         //Only plain literals are allowed as skos:prefLabel annotations
         if (prefLabelLiteral.Value is RDFPlainLiteral)
         {
             if (RDFSKOSChecker.CheckPrefLabel(conceptScheme, concept, prefLabelLiteral))
             {
                 //Add prefLabel annotation
                 conceptScheme.Annotations.PrefLabel.AddEntry(new RDFOntologyTaxonomyEntry(concept, RDFVocabulary.SKOS.PREF_LABEL.ToRDFOntologyAnnotationProperty(), prefLabelLiteral));
             }
         }
     }
     return(conceptScheme);
 }
Exemplo n.º 18
0
 /// <summary>
 /// Adds the "concept -> skos:hiddenLabel -> hiddenLabelLiteral" annotation to the concept scheme
 /// </summary>
 public static RDFSKOSConceptScheme AddHiddenLabelAnnotation(this RDFSKOSConceptScheme conceptScheme,
                                                             RDFSKOSConcept concept,
                                                             RDFOntologyLiteral hiddenLabelLiteral)
 {
     if (conceptScheme != null && concept != null && hiddenLabelLiteral != null)
     {
         //Only plain literals are allowed as skos:hiddenLabel annotations
         if (hiddenLabelLiteral.Value is RDFPlainLiteral)
         {
             if (RDFSKOSChecker.CheckHiddenLabel(conceptScheme, concept, hiddenLabelLiteral))
             {
                 //Add hiddenLabel annotation
                 conceptScheme.Annotations.HiddenLabel.AddEntry(new RDFOntologyTaxonomyEntry(concept, RDFVocabulary.SKOS.HIDDEN_LABEL.ToRDFOntologyAnnotationProperty(), hiddenLabelLiteral));
             }
         }
     }
     return(conceptScheme);
 }
 /// <summary>
 /// Builds a scheme lens for the given concept on the given scheme
 /// </summary>
 public RDFSKOSConceptSchemeLens(RDFSKOSConcept concept, RDFSKOSConceptScheme scheme)
 {
     if (concept != null)
     {
         if (scheme != null)
         {
             this.Concept = concept;
             this.Scheme  = scheme;
         }
         else
         {
             throw new RDFSemanticsException("Cannot create scheme lens because given \"scheme\" parameter is null");
         }
     }
     else
     {
         throw new RDFSemanticsException("Cannot create scheme lens because given \"concept\" parameter is null");
     }
 }
Exemplo n.º 20
0
        /// <summary>
        /// Enlists the narrower/narrowerTransitive concepts of the given concept within the given scheme
        /// </summary>
        public static RDFSKOSConceptScheme GetNarrowerConceptsOf(this RDFSKOSConceptScheme conceptScheme,
                                                                 RDFSKOSConcept concept)
        {
            var result = new RDFSKOSConceptScheme((RDFResource)conceptScheme.Value);

            if (concept != null && conceptScheme != null)
            {
                //Get skos:narrower concepts
                foreach (var narrowerConcept in conceptScheme.Relations.Narrower.SelectEntriesBySubject(concept))
                {
                    result.AddConcept((RDFSKOSConcept)narrowerConcept.TaxonomyObject);
                }

                //Get skos:narrowerTransitive concepts
                result = result.UnionWith(conceptScheme.GetNarrowerConceptsOfInternal(concept, null))
                         .RemoveConcept(concept);         //Safety deletion
            }
            return(result);
        }
        /// <summary>
        /// Checks if the skos:closeMatch/skos:exactMatch relation can be added to the given aConcept with the given bConcept
        /// </summary>
        internal static bool CheckCloseOrExactMatchRelation(RDFSKOSConceptScheme conceptScheme,
                                                            RDFSKOSConcept aConcept,
                                                            RDFSKOSConcept bConcept)
        {
            var canAddCloseOrExactMatchRel = false;

            //Avoid clash with hierarchical relations
            canAddCloseOrExactMatchRel = (!conceptScheme.CheckHasBroaderConcept(aConcept, bConcept) &&
                                          !conceptScheme.CheckHasNarrowerConcept(aConcept, bConcept));

            //Avoid clash with mapping relations
            if (canAddCloseOrExactMatchRel)
            {
                canAddCloseOrExactMatchRel = (!conceptScheme.CheckHasBroadMatchConcept(aConcept, bConcept) &&
                                              !conceptScheme.CheckHasNarrowMatchConcept(aConcept, bConcept) &&
                                              !conceptScheme.CheckHasRelatedMatchConcept(aConcept, bConcept));
            }

            return(canAddCloseOrExactMatchRel);
        }
Exemplo n.º 22
0
        /// <summary>
        /// Subsumes the "skos:narrowerTransitive" taxonomy to discover direct and indirect narrower concepts of the given scheme
        /// </summary>
        internal static RDFSKOSConceptScheme GetNarrowerConceptsOfInternal(this RDFSKOSConceptScheme conceptScheme,
                                                                           RDFSKOSConcept concept,
                                                                           Dictionary <long, RDFSKOSConcept> visitContext)
        {
            var result = new RDFSKOSConceptScheme((RDFResource)conceptScheme.Value);

            #region visitContext
            if (visitContext == null)
            {
                visitContext = new Dictionary <long, RDFSKOSConcept>()
                {
                    { concept.PatternMemberID, concept }
                };
            }
            else
            {
                if (!visitContext.ContainsKey(concept.PatternMemberID))
                {
                    visitContext.Add(concept.PatternMemberID, concept);
                }
                else
                {
                    return(result);
                }
            }
            #endregion

            //Transitivity of "skos:narrowerTransitive" taxonomy:
            //((A SKOS:NARROWERTRANSITIVE B)  &&  (B SKOS:NARROWERTRANSITIVE C))  =>  (A SKOS:NARROWERTRANSITIVE C)
            foreach (var nt in conceptScheme.Relations.NarrowerTransitive.SelectEntriesBySubject(concept))
            {
                result.AddConcept((RDFSKOSConcept)nt.TaxonomyObject);

                //Exploit skos:narrowerTransitive taxonomy
                result = result.UnionWith(conceptScheme.GetNarrowerConceptsOfInternal((RDFSKOSConcept)nt.TaxonomyObject, visitContext));
            }

            return(result);
        }
Exemplo n.º 23
0
        /// <summary>
        /// Adds the given label as hidden label of the given concept within the conceptScheme
        /// </summary>
        public static RDFSKOSConceptScheme AddHiddenLabelRelation(this RDFSKOSConceptScheme conceptScheme,
                                                                  RDFSKOSConcept concept,
                                                                  RDFSKOSLabel label,
                                                                  RDFOntologyLiteral hiddenLabelLiteral)
        {
            if (conceptScheme != null && concept != null && label != null && hiddenLabelLiteral != null)
            {
                //Only plain literals are allowed as skosxl:hiddenLabel assertions
                if (hiddenLabelLiteral.Value is RDFPlainLiteral)
                {
                    if (RDFSKOSChecker.CheckHiddenLabel(conceptScheme, concept, hiddenLabelLiteral))
                    {
                        //Add hiddenLabel relation
                        conceptScheme.Relations.HiddenLabel.AddEntry(new RDFOntologyTaxonomyEntry(concept, RDFVocabulary.SKOS.SKOSXL.HIDDEN_LABEL.ToRDFOntologyObjectProperty(), label));

                        //Add literalForm relation
                        conceptScheme.Relations.LiteralForm.AddEntry(new RDFOntologyTaxonomyEntry(label, RDFVocabulary.SKOS.SKOSXL.LITERAL_FORM.ToRDFOntologyDatatypeProperty(), hiddenLabelLiteral));
                    }
                }
            }
            return(conceptScheme);
        }
Exemplo n.º 24
0
        /// <summary>
        /// Subsumes the "skos:exactMatch" taxonomy to discover direct and indirect exactmatches of the given concept
        /// </summary>
        internal static RDFSKOSConceptScheme GetExactMatchConceptsOfInternal(this RDFSKOSConceptScheme conceptScheme,
                                                                             RDFSKOSConcept concept,
                                                                             Dictionary <long, RDFSKOSConcept> visitContext)
        {
            var result = new RDFSKOSConceptScheme((RDFResource)conceptScheme.Value);

            #region visitContext
            if (visitContext == null)
            {
                visitContext = new Dictionary <long, RDFSKOSConcept>()
                {
                    { concept.PatternMemberID, concept }
                };
            }
            else
            {
                if (!visitContext.ContainsKey(concept.PatternMemberID))
                {
                    visitContext.Add(concept.PatternMemberID, concept);
                }
                else
                {
                    return(result);
                }
            }
            #endregion

            // Transitivity of "skos:exactMatch" taxonomy:
            //((A SKOS:EXACTMATCH B)  &&  (B SKOS:EXACTMATCH C))  =>  (A SKOS:EXACTMATCH C)
            foreach (var em in conceptScheme.Relations.ExactMatch.SelectEntriesBySubject(concept))
            {
                result.AddConcept((RDFSKOSConcept)em.TaxonomyObject);
                result = result.UnionWith(conceptScheme.GetExactMatchConceptsOfInternal((RDFSKOSConcept)em.TaxonomyObject, visitContext));
            }

            return(result);
        }
Exemplo n.º 25
0
        /// <summary>
        /// Checks if the skos:prefLabel/skosxl:prefLabel informations can be added to the given concept
        /// </summary>
        internal static Boolean CheckPrefLabel(RDFSKOSConceptScheme conceptScheme,
                                               RDFOntologyFact concept,
                                               RDFOntologyLiteral literal)
        {
            var canAddPrefLabelInfo  = false;
            var prefLabelLiteralLang = ((RDFPlainLiteral)literal.Value).Language;

            //Plain literal without language tag: only one occurrence of this information is allowed
            if (String.IsNullOrEmpty(prefLabelLiteralLang))
            {
                //Check skos:prefLabel annotation
                canAddPrefLabelInfo = !(conceptScheme.Annotations.PrefLabel.SelectEntriesBySubject(concept)
                                        .Any(x => x.TaxonomyObject.Value is RDFPlainLiteral &&
                                             String.IsNullOrEmpty(((RDFPlainLiteral)x.TaxonomyObject.Value).Language)));
                //Check skosxl:prefLabel relation
                if (canAddPrefLabelInfo)
                {
                    canAddPrefLabelInfo = !(conceptScheme.Relations.PrefLabel.SelectEntriesBySubject(concept)
                                            .Any(x => conceptScheme.Relations.LiteralForm.SelectEntriesBySubject(x.TaxonomyObject)
                                                 .Any(y => y.TaxonomyObject.Value is RDFPlainLiteral &&
                                                      String.IsNullOrEmpty(((RDFPlainLiteral)y.TaxonomyObject.Value).Language))));
                }
            }

            //Plain literal with language tag: only one occurrence of this information per language tag is allowed
            else
            {
                //Check skos:prefLabel annotation
                canAddPrefLabelInfo = !(conceptScheme.Annotations.PrefLabel.SelectEntriesBySubject(concept)
                                        .Any(x => x.TaxonomyObject.Value is RDFPlainLiteral &&
                                             !String.IsNullOrEmpty(((RDFPlainLiteral)x.TaxonomyObject.Value).Language) &&
                                             (((RDFPlainLiteral)x.TaxonomyObject.Value).Language).Equals(prefLabelLiteralLang, StringComparison.OrdinalIgnoreCase)));

                //Check skosxl:prefLabel relation
                if (canAddPrefLabelInfo)
                {
                    canAddPrefLabelInfo = !(conceptScheme.Relations.PrefLabel.SelectEntriesBySubject(concept)
                                            .Any(x => conceptScheme.Relations.LiteralForm.SelectEntriesBySubject(x.TaxonomyObject)
                                                 .Any(y => y.TaxonomyObject.Value is RDFPlainLiteral &&
                                                      !String.IsNullOrEmpty(((RDFPlainLiteral)x.TaxonomyObject.Value).Language) &&
                                                      (((RDFPlainLiteral)x.TaxonomyObject.Value).Language).Equals(prefLabelLiteralLang, StringComparison.OrdinalIgnoreCase))));
                }
            }

            //Pairwise disjointness with skos:altLabel/skosxl:altLabel must be preserved
            if (canAddPrefLabelInfo)
            {
                //Check skos:altLabel annotation
                canAddPrefLabelInfo = !(conceptScheme.Annotations.AltLabel.SelectEntriesBySubject(concept)
                                        .Any(x => x.TaxonomyObject.Equals(literal)));

                //Check skosxl:altLabel relation
                if (canAddPrefLabelInfo)
                {
                    canAddPrefLabelInfo = !(conceptScheme.Relations.AltLabel.SelectEntriesBySubject(concept)
                                            .Any(x => conceptScheme.Relations.LiteralForm.SelectEntriesBySubject(x.TaxonomyObject)
                                                 .Any(y => y.TaxonomyObject.Equals(literal))));
                }
            }

            //Pairwise disjointness with skos:hiddenLabel/skosxl:hiddenLabel must be preserved
            if (canAddPrefLabelInfo)
            {
                //Check skos:hiddenLabel annotation
                canAddPrefLabelInfo = !(conceptScheme.Annotations.HiddenLabel.SelectEntriesBySubject(concept)
                                        .Any(x => x.TaxonomyObject.Equals(literal)));

                //Check skosxl:hiddenLabel assertion
                if (canAddPrefLabelInfo)
                {
                    canAddPrefLabelInfo = !(conceptScheme.Relations.HiddenLabel.SelectEntriesBySubject(concept)
                                            .Any(x => conceptScheme.Relations.LiteralForm.SelectEntriesBySubject(x.TaxonomyObject)
                                                 .Any(y => y.TaxonomyObject.Equals(literal))));
                }
            }

            return(canAddPrefLabelInfo);
        }
Exemplo n.º 26
0
 /// <summary>
 /// Checks if the given aConcept skos:exactMatch the given bConcept within the given scheme
 /// </summary>
 public static bool CheckHasExactMatchConcept(this RDFSKOSConceptScheme conceptScheme,
                                              RDFSKOSConcept aConcept,
                                              RDFSKOSConcept bConcept)
 {
     return(aConcept != null && bConcept != null && conceptScheme != null ? conceptScheme.GetExactMatchConceptsOf(aConcept).Concepts.ContainsKey(bConcept.PatternMemberID) : false);
 }
Exemplo n.º 27
0
        /// <summary>
        /// Builds a new union scheme from this scheme and a given one
        /// </summary>
        public RDFSKOSConceptScheme UnionWith(RDFSKOSConceptScheme conceptScheme)
        {
            var result = new RDFSKOSConceptScheme(new RDFResource());

            //Add concepts from this scheme
            foreach (var c    in this)
            {
                result.AddConcept(c);
            }

            //Add collections from this scheme
            foreach (var c    in this.Collections.Values)
            {
                result.AddCollection(c);
            }

            //Add ordered collections from this scheme
            foreach (var o    in this.OrderedCollections.Values)
            {
                result.AddOrderedCollection(o);
            }

            //Add labels from this scheme
            foreach (var l    in this.Labels.Values)
            {
                result.AddLabel(l);
            }

            //Add relations from this scheme
            result.Relations.TopConcept         = result.Relations.TopConcept.UnionWith(this.Relations.TopConcept);
            result.Relations.Broader            = result.Relations.Broader.UnionWith(this.Relations.Broader);
            result.Relations.BroaderTransitive  = result.Relations.BroaderTransitive.UnionWith(this.Relations.BroaderTransitive);
            result.Relations.BroadMatch         = result.Relations.BroadMatch.UnionWith(this.Relations.BroadMatch);
            result.Relations.Narrower           = result.Relations.Narrower.UnionWith(this.Relations.Narrower);
            result.Relations.NarrowerTransitive = result.Relations.NarrowerTransitive.UnionWith(this.Relations.NarrowerTransitive);
            result.Relations.NarrowMatch        = result.Relations.NarrowMatch.UnionWith(this.Relations.NarrowMatch);
            result.Relations.Related            = result.Relations.Related.UnionWith(this.Relations.Related);
            result.Relations.RelatedMatch       = result.Relations.RelatedMatch.UnionWith(this.Relations.RelatedMatch);
            result.Relations.SemanticRelation   = result.Relations.SemanticRelation.UnionWith(this.Relations.SemanticRelation);
            result.Relations.MappingRelation    = result.Relations.MappingRelation.UnionWith(this.Relations.MappingRelation);
            result.Relations.CloseMatch         = result.Relations.CloseMatch.UnionWith(this.Relations.CloseMatch);
            result.Relations.ExactMatch         = result.Relations.ExactMatch.UnionWith(this.Relations.ExactMatch);
            result.Relations.Notation           = result.Relations.Notation.UnionWith(this.Relations.Notation);
            result.Relations.PrefLabel          = result.Relations.PrefLabel.UnionWith(this.Relations.PrefLabel);
            result.Relations.AltLabel           = result.Relations.AltLabel.UnionWith(this.Relations.AltLabel);
            result.Relations.HiddenLabel        = result.Relations.HiddenLabel.UnionWith(this.Relations.HiddenLabel);
            result.Relations.LiteralForm        = result.Relations.LiteralForm.UnionWith(this.Relations.LiteralForm);
            result.Relations.LabelRelation      = result.Relations.LabelRelation.UnionWith(this.Relations.LabelRelation);

            //Add annotations from this scheme
            result.Annotations.PrefLabel     = result.Annotations.PrefLabel.UnionWith(this.Annotations.PrefLabel);
            result.Annotations.AltLabel      = result.Annotations.AltLabel.UnionWith(this.Annotations.AltLabel);
            result.Annotations.HiddenLabel   = result.Annotations.HiddenLabel.UnionWith(this.Annotations.HiddenLabel);
            result.Annotations.Note          = result.Annotations.Note.UnionWith(this.Annotations.Note);
            result.Annotations.ChangeNote    = result.Annotations.ChangeNote.UnionWith(this.Annotations.ChangeNote);
            result.Annotations.EditorialNote = result.Annotations.EditorialNote.UnionWith(this.Annotations.EditorialNote);
            result.Annotations.HistoryNote   = result.Annotations.HistoryNote.UnionWith(this.Annotations.HistoryNote);
            result.Annotations.ScopeNote     = result.Annotations.ScopeNote.UnionWith(this.Annotations.ScopeNote);
            result.Annotations.Definition    = result.Annotations.Definition.UnionWith(this.Annotations.Definition);
            result.Annotations.Example       = result.Annotations.Example.UnionWith(this.Annotations.Example);

            //Manage the given scheme
            if (conceptScheme != null)
            {
                //Add concepts from the given scheme
                foreach (var c in conceptScheme)
                {
                    result.AddConcept(c);
                }

                //Add collections from the given scheme
                foreach (var c in conceptScheme.Collections.Values)
                {
                    result.AddCollection(c);
                }

                //Add ordered collections from the given scheme
                foreach (var o in conceptScheme.OrderedCollections.Values)
                {
                    result.AddOrderedCollection(o);
                }

                //Add labels from the given scheme
                foreach (var l in conceptScheme.Labels.Values)
                {
                    result.AddLabel(l);
                }

                //Add relations from the given scheme
                result.Relations.TopConcept         = result.Relations.TopConcept.UnionWith(conceptScheme.Relations.TopConcept);
                result.Relations.Broader            = result.Relations.Broader.UnionWith(conceptScheme.Relations.Broader);
                result.Relations.BroaderTransitive  = result.Relations.BroaderTransitive.UnionWith(conceptScheme.Relations.BroaderTransitive);
                result.Relations.BroadMatch         = result.Relations.BroadMatch.UnionWith(conceptScheme.Relations.BroadMatch);
                result.Relations.Narrower           = result.Relations.Narrower.UnionWith(conceptScheme.Relations.Narrower);
                result.Relations.NarrowerTransitive = result.Relations.NarrowerTransitive.UnionWith(conceptScheme.Relations.NarrowerTransitive);
                result.Relations.NarrowMatch        = result.Relations.NarrowMatch.UnionWith(conceptScheme.Relations.NarrowMatch);
                result.Relations.Related            = result.Relations.Related.UnionWith(conceptScheme.Relations.Related);
                result.Relations.RelatedMatch       = result.Relations.RelatedMatch.UnionWith(conceptScheme.Relations.RelatedMatch);
                result.Relations.SemanticRelation   = result.Relations.SemanticRelation.UnionWith(conceptScheme.Relations.SemanticRelation);
                result.Relations.MappingRelation    = result.Relations.MappingRelation.UnionWith(conceptScheme.Relations.MappingRelation);
                result.Relations.CloseMatch         = result.Relations.CloseMatch.UnionWith(conceptScheme.Relations.CloseMatch);
                result.Relations.ExactMatch         = result.Relations.ExactMatch.UnionWith(conceptScheme.Relations.ExactMatch);
                result.Relations.Notation           = result.Relations.Notation.UnionWith(conceptScheme.Relations.Notation);
                result.Relations.PrefLabel          = result.Relations.PrefLabel.UnionWith(conceptScheme.Relations.PrefLabel);
                result.Relations.AltLabel           = result.Relations.AltLabel.UnionWith(conceptScheme.Relations.AltLabel);
                result.Relations.HiddenLabel        = result.Relations.HiddenLabel.UnionWith(conceptScheme.Relations.HiddenLabel);
                result.Relations.LiteralForm        = result.Relations.LiteralForm.UnionWith(conceptScheme.Relations.LiteralForm);
                result.Relations.LabelRelation      = result.Relations.LabelRelation.UnionWith(conceptScheme.Relations.LabelRelation);

                //Add annotations from the given scheme
                result.Annotations.PrefLabel     = result.Annotations.PrefLabel.UnionWith(conceptScheme.Annotations.PrefLabel);
                result.Annotations.AltLabel      = result.Annotations.AltLabel.UnionWith(conceptScheme.Annotations.AltLabel);
                result.Annotations.HiddenLabel   = result.Annotations.HiddenLabel.UnionWith(conceptScheme.Annotations.HiddenLabel);
                result.Annotations.Note          = result.Annotations.Note.UnionWith(conceptScheme.Annotations.Note);
                result.Annotations.ChangeNote    = result.Annotations.ChangeNote.UnionWith(conceptScheme.Annotations.ChangeNote);
                result.Annotations.EditorialNote = result.Annotations.EditorialNote.UnionWith(conceptScheme.Annotations.EditorialNote);
                result.Annotations.HistoryNote   = result.Annotations.HistoryNote.UnionWith(conceptScheme.Annotations.HistoryNote);
                result.Annotations.ScopeNote     = result.Annotations.ScopeNote.UnionWith(conceptScheme.Annotations.ScopeNote);
                result.Annotations.Definition    = result.Annotations.Definition.UnionWith(conceptScheme.Annotations.Definition);
                result.Annotations.Example       = result.Annotations.Example.UnionWith(conceptScheme.Annotations.Example);
            }
            return(result);
        }
Exemplo n.º 28
0
        /// <summary>
        /// Builds a new difference scheme from this scheme and a given one
        /// </summary>
        public RDFSKOSConceptScheme DifferenceWith(RDFSKOSConceptScheme conceptScheme)
        {
            var result = new RDFSKOSConceptScheme(new RDFResource());

            if (conceptScheme != null)
            {
                //Add difference concepts
                foreach (var c in this)
                {
                    if (!conceptScheme.Concepts.ContainsKey(c.PatternMemberID))
                    {
                        result.AddConcept(c);
                    }
                }

                //Add difference collections
                foreach (var c in this.Collections.Values)
                {
                    if (!conceptScheme.Collections.ContainsKey(c.PatternMemberID))
                    {
                        result.AddCollection(c);
                    }
                }

                //Add difference ordered collections
                foreach (var o in this.OrderedCollections.Values)
                {
                    if (!conceptScheme.OrderedCollections.ContainsKey(o.PatternMemberID))
                    {
                        result.AddOrderedCollection(o);
                    }
                }

                //Add difference labels
                foreach (var l in this.Labels.Values)
                {
                    if (!conceptScheme.Labels.ContainsKey(l.PatternMemberID))
                    {
                        result.AddLabel(l);
                    }
                }

                //Add difference relations
                result.Relations.TopConcept         = this.Relations.TopConcept.DifferenceWith(conceptScheme.Relations.TopConcept);
                result.Relations.Broader            = this.Relations.Broader.DifferenceWith(conceptScheme.Relations.Broader);
                result.Relations.BroaderTransitive  = this.Relations.BroaderTransitive.DifferenceWith(conceptScheme.Relations.BroaderTransitive);
                result.Relations.BroadMatch         = this.Relations.BroadMatch.DifferenceWith(conceptScheme.Relations.BroadMatch);
                result.Relations.Narrower           = this.Relations.Narrower.DifferenceWith(conceptScheme.Relations.Narrower);
                result.Relations.NarrowerTransitive = this.Relations.NarrowerTransitive.DifferenceWith(conceptScheme.Relations.NarrowerTransitive);
                result.Relations.NarrowMatch        = this.Relations.NarrowMatch.DifferenceWith(conceptScheme.Relations.NarrowMatch);
                result.Relations.Related            = this.Relations.Related.DifferenceWith(conceptScheme.Relations.Related);
                result.Relations.RelatedMatch       = this.Relations.RelatedMatch.DifferenceWith(conceptScheme.Relations.RelatedMatch);
                result.Relations.SemanticRelation   = this.Relations.SemanticRelation.DifferenceWith(conceptScheme.Relations.SemanticRelation);
                result.Relations.MappingRelation    = this.Relations.MappingRelation.DifferenceWith(conceptScheme.Relations.MappingRelation);
                result.Relations.CloseMatch         = this.Relations.CloseMatch.DifferenceWith(conceptScheme.Relations.CloseMatch);
                result.Relations.ExactMatch         = this.Relations.ExactMatch.DifferenceWith(conceptScheme.Relations.ExactMatch);
                result.Relations.Notation           = this.Relations.Notation.DifferenceWith(conceptScheme.Relations.Notation);
                result.Relations.PrefLabel          = this.Relations.PrefLabel.DifferenceWith(conceptScheme.Relations.PrefLabel);
                result.Relations.AltLabel           = this.Relations.AltLabel.DifferenceWith(conceptScheme.Relations.AltLabel);
                result.Relations.HiddenLabel        = this.Relations.HiddenLabel.DifferenceWith(conceptScheme.Relations.HiddenLabel);
                result.Relations.LiteralForm        = this.Relations.LiteralForm.DifferenceWith(conceptScheme.Relations.LiteralForm);
                result.Relations.LabelRelation      = this.Relations.LabelRelation.DifferenceWith(conceptScheme.Relations.LabelRelation);

                //Add difference annotations
                result.Annotations.PrefLabel     = this.Annotations.PrefLabel.DifferenceWith(conceptScheme.Annotations.PrefLabel);
                result.Annotations.AltLabel      = this.Annotations.AltLabel.DifferenceWith(conceptScheme.Annotations.AltLabel);
                result.Annotations.HiddenLabel   = this.Annotations.HiddenLabel.DifferenceWith(conceptScheme.Annotations.HiddenLabel);
                result.Annotations.Note          = this.Annotations.Note.DifferenceWith(conceptScheme.Annotations.Note);
                result.Annotations.ChangeNote    = this.Annotations.ChangeNote.DifferenceWith(conceptScheme.Annotations.ChangeNote);
                result.Annotations.EditorialNote = this.Annotations.EditorialNote.DifferenceWith(conceptScheme.Annotations.EditorialNote);
                result.Annotations.HistoryNote   = this.Annotations.HistoryNote.DifferenceWith(conceptScheme.Annotations.HistoryNote);
                result.Annotations.ScopeNote     = this.Annotations.ScopeNote.DifferenceWith(conceptScheme.Annotations.ScopeNote);
                result.Annotations.Definition    = this.Annotations.Definition.DifferenceWith(conceptScheme.Annotations.Definition);
                result.Annotations.Example       = this.Annotations.Example.DifferenceWith(conceptScheme.Annotations.Example);
            }
            else
            {
                //Add concepts from this scheme
                foreach (var c in this)
                {
                    result.AddConcept(c);
                }

                //Add collections from this scheme
                foreach (var c in this.Collections.Values)
                {
                    result.AddCollection(c);
                }

                //Add ordered collections from this scheme
                foreach (var o in this.OrderedCollections.Values)
                {
                    result.AddOrderedCollection(o);
                }

                //Add labels from this scheme
                foreach (var l in this.Labels.Values)
                {
                    result.AddLabel(l);
                }

                //Add relations from this scheme
                result.Relations.TopConcept         = result.Relations.TopConcept.UnionWith(this.Relations.TopConcept);
                result.Relations.Broader            = result.Relations.Broader.UnionWith(this.Relations.Broader);
                result.Relations.BroaderTransitive  = result.Relations.BroaderTransitive.UnionWith(this.Relations.BroaderTransitive);
                result.Relations.BroadMatch         = result.Relations.BroadMatch.UnionWith(this.Relations.BroadMatch);
                result.Relations.Narrower           = result.Relations.Narrower.UnionWith(this.Relations.Narrower);
                result.Relations.NarrowerTransitive = result.Relations.NarrowerTransitive.UnionWith(this.Relations.NarrowerTransitive);
                result.Relations.NarrowMatch        = result.Relations.NarrowMatch.UnionWith(this.Relations.NarrowMatch);
                result.Relations.Related            = result.Relations.Related.UnionWith(this.Relations.Related);
                result.Relations.RelatedMatch       = result.Relations.RelatedMatch.UnionWith(this.Relations.RelatedMatch);
                result.Relations.SemanticRelation   = result.Relations.SemanticRelation.UnionWith(this.Relations.SemanticRelation);
                result.Relations.MappingRelation    = result.Relations.MappingRelation.UnionWith(this.Relations.MappingRelation);
                result.Relations.CloseMatch         = result.Relations.CloseMatch.UnionWith(this.Relations.CloseMatch);
                result.Relations.ExactMatch         = result.Relations.ExactMatch.UnionWith(this.Relations.ExactMatch);
                result.Relations.Notation           = result.Relations.Notation.UnionWith(this.Relations.Notation);
                result.Relations.PrefLabel          = result.Relations.PrefLabel.UnionWith(this.Relations.PrefLabel);
                result.Relations.AltLabel           = result.Relations.AltLabel.UnionWith(this.Relations.AltLabel);
                result.Relations.HiddenLabel        = result.Relations.HiddenLabel.UnionWith(this.Relations.HiddenLabel);
                result.Relations.LiteralForm        = result.Relations.LiteralForm.UnionWith(this.Relations.LiteralForm);
                result.Relations.LabelRelation      = result.Relations.LabelRelation.UnionWith(this.Relations.LabelRelation);

                //Add annotations from this scheme
                result.Annotations.PrefLabel     = result.Annotations.PrefLabel.UnionWith(this.Annotations.PrefLabel);
                result.Annotations.AltLabel      = result.Annotations.AltLabel.UnionWith(this.Annotations.AltLabel);
                result.Annotations.HiddenLabel   = result.Annotations.HiddenLabel.UnionWith(this.Annotations.HiddenLabel);
                result.Annotations.Note          = result.Annotations.Note.UnionWith(this.Annotations.Note);
                result.Annotations.ChangeNote    = result.Annotations.ChangeNote.UnionWith(this.Annotations.ChangeNote);
                result.Annotations.EditorialNote = result.Annotations.EditorialNote.UnionWith(this.Annotations.EditorialNote);
                result.Annotations.HistoryNote   = result.Annotations.HistoryNote.UnionWith(this.Annotations.HistoryNote);
                result.Annotations.ScopeNote     = result.Annotations.ScopeNote.UnionWith(this.Annotations.ScopeNote);
                result.Annotations.Definition    = result.Annotations.Definition.UnionWith(this.Annotations.Definition);
                result.Annotations.Example       = result.Annotations.Example.UnionWith(this.Annotations.Example);
            }
            return(result);
        }
Exemplo n.º 29
0
 /// <summary>
 /// Checks if the given aConcept has related concept the given bConcept within the given scheme
 /// </summary>
 public static bool CheckHasRelatedConcept(this RDFSKOSConceptScheme data,
                                           RDFSKOSConcept aConcept,
                                           RDFSKOSConcept bConcept)
 {
     return(aConcept != null && bConcept != null && data != null ? data.GetRelatedConceptsOf(aConcept).Concepts.ContainsKey(bConcept.PatternMemberID) : false);
 }
        /// <summary>
        /// Builds a new intersection scheme from this scheme and a given one
        /// </summary>
        public RDFSKOSConceptScheme IntersectWith(RDFSKOSConceptScheme conceptScheme)
        {
            RDFSKOSConceptScheme result = new RDFSKOSConceptScheme(new RDFResource());

            if (conceptScheme != null)
            {
                //Add intersection concepts
                foreach (RDFSKOSConcept c in this)
                {
                    if (conceptScheme.Concepts.ContainsKey(c.PatternMemberID))
                    {
                        result.AddConcept(c);
                    }
                }

                //Add intersection collections
                foreach (RDFSKOSCollection c in this.Collections.Values)
                {
                    if (conceptScheme.Collections.ContainsKey(c.PatternMemberID))
                    {
                        result.AddCollection(c);
                    }
                }

                //Add intersection ordered collections
                foreach (RDFSKOSOrderedCollection o in this.OrderedCollections.Values)
                {
                    if (conceptScheme.OrderedCollections.ContainsKey(o.PatternMemberID))
                    {
                        result.AddOrderedCollection(o);
                    }
                }

                //Add intersection labels
                foreach (RDFSKOSLabel l in this.Labels.Values)
                {
                    if (conceptScheme.Labels.ContainsKey(l.PatternMemberID))
                    {
                        result.AddLabel(l);
                    }
                }

                //Add intersection relations
                result.Relations.TopConcept         = this.Relations.TopConcept.IntersectWith(conceptScheme.Relations.TopConcept);
                result.Relations.Broader            = this.Relations.Broader.IntersectWith(conceptScheme.Relations.Broader);
                result.Relations.BroaderTransitive  = this.Relations.BroaderTransitive.IntersectWith(conceptScheme.Relations.BroaderTransitive);
                result.Relations.BroadMatch         = this.Relations.BroadMatch.IntersectWith(conceptScheme.Relations.BroadMatch);
                result.Relations.Narrower           = this.Relations.Narrower.IntersectWith(conceptScheme.Relations.Narrower);
                result.Relations.NarrowerTransitive = this.Relations.NarrowerTransitive.IntersectWith(conceptScheme.Relations.NarrowerTransitive);
                result.Relations.NarrowMatch        = this.Relations.NarrowMatch.IntersectWith(conceptScheme.Relations.NarrowMatch);
                result.Relations.Related            = this.Relations.Related.IntersectWith(conceptScheme.Relations.Related);
                result.Relations.RelatedMatch       = this.Relations.RelatedMatch.IntersectWith(conceptScheme.Relations.RelatedMatch);
                result.Relations.SemanticRelation   = this.Relations.SemanticRelation.IntersectWith(conceptScheme.Relations.SemanticRelation);
                result.Relations.MappingRelation    = this.Relations.MappingRelation.IntersectWith(conceptScheme.Relations.MappingRelation);
                result.Relations.CloseMatch         = this.Relations.CloseMatch.IntersectWith(conceptScheme.Relations.CloseMatch);
                result.Relations.ExactMatch         = this.Relations.ExactMatch.IntersectWith(conceptScheme.Relations.ExactMatch);
                result.Relations.Notation           = this.Relations.Notation.IntersectWith(conceptScheme.Relations.Notation);
                result.Relations.PrefLabel          = this.Relations.PrefLabel.IntersectWith(conceptScheme.Relations.PrefLabel);
                result.Relations.AltLabel           = this.Relations.AltLabel.IntersectWith(conceptScheme.Relations.AltLabel);
                result.Relations.HiddenLabel        = this.Relations.HiddenLabel.IntersectWith(conceptScheme.Relations.HiddenLabel);
                result.Relations.LiteralForm        = this.Relations.LiteralForm.IntersectWith(conceptScheme.Relations.LiteralForm);
                result.Relations.LabelRelation      = this.Relations.LabelRelation.IntersectWith(conceptScheme.Relations.LabelRelation);

                //Add intersection annotations
                result.Annotations.PrefLabel     = this.Annotations.PrefLabel.IntersectWith(conceptScheme.Annotations.PrefLabel);
                result.Annotations.AltLabel      = this.Annotations.AltLabel.IntersectWith(conceptScheme.Annotations.AltLabel);
                result.Annotations.HiddenLabel   = this.Annotations.HiddenLabel.IntersectWith(conceptScheme.Annotations.HiddenLabel);
                result.Annotations.Note          = this.Annotations.Note.IntersectWith(conceptScheme.Annotations.Note);
                result.Annotations.ChangeNote    = this.Annotations.ChangeNote.IntersectWith(conceptScheme.Annotations.ChangeNote);
                result.Annotations.EditorialNote = this.Annotations.EditorialNote.IntersectWith(conceptScheme.Annotations.EditorialNote);
                result.Annotations.HistoryNote   = this.Annotations.HistoryNote.IntersectWith(conceptScheme.Annotations.HistoryNote);
                result.Annotations.ScopeNote     = this.Annotations.ScopeNote.IntersectWith(conceptScheme.Annotations.ScopeNote);
                result.Annotations.Definition    = this.Annotations.Definition.IntersectWith(conceptScheme.Annotations.Definition);
                result.Annotations.Example       = this.Annotations.Example.IntersectWith(conceptScheme.Annotations.Example);
            }
            return(result);
        }