예제 #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);
        }
        /// <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);
        }