Exemplo n.º 1
0
        /// <summary>
        /// Checks if the skos:broader/skos:broaderTransitive/skos:broadMatch relation can be added to the given aConcept with the given bConcept
        /// </summary>
        internal static Boolean CheckBroaderRelation(RDFSKOSConceptScheme conceptScheme,
                                                     RDFSKOSConcept aConcept,
                                                     RDFSKOSConcept bConcept)
        {
            var canAddBroaderRel = false;

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

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

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

            return(canAddBroaderRel);
        }
        /// <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);
        }