Example #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:related/skos:relatedMatch relation can be added to the given aConcept with the given bConcept
        /// </summary>
        internal static bool CheckRelatedRelation(RDFSKOSConceptScheme conceptScheme,
                                                  RDFSKOSConcept aConcept,
                                                  RDFSKOSConcept bConcept)
        {
            var canAddRelatedRel = false;

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

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

            return(canAddRelatedRel);
        }