Beispiel #1
0
        /// <summary>
        /// Builds a new difference taxonomy from this taxonomy and a given one
        /// </summary>
        internal RDFOntologyTaxonomy DifferenceWith(RDFOntologyTaxonomy taxonomy)
        {
            var result = new RDFOntologyTaxonomy(this.Category);

            if (taxonomy != null)
            {
                //Add difference entries
                foreach (var te in this)
                {
                    if (!taxonomy.ContainsEntry(te))
                    {
                        result.AddEntry(te);
                    }
                }
            }
            else
            {
                //Add entries from this taxonomy
                foreach (var te in this)
                {
                    result.AddEntry(te);
                }
            }
            return(result);
        }
Beispiel #2
0
        /// <summary>
        /// Builds a new union taxonomy from this taxonomy and a given one
        /// </summary>
        internal RDFOntologyTaxonomy UnionWith(RDFOntologyTaxonomy taxonomy)
        {
            var result = new RDFOntologyTaxonomy(this.Category);

            //Add entries from this taxonomy
            foreach (var te in this)
            {
                result.AddEntry(te);
            }

            //Manage the given taxonomy
            if (taxonomy != null)
            {
                //Add entries from the given taxonomy
                foreach (var te in taxonomy)
                {
                    result.AddEntry(te);
                }
            }
            return(result);
        }
Beispiel #3
0
        /// <summary>
        /// Gets a taxonomy with the entries having the specified ontology resource as object
        /// </summary>
        public RDFOntologyTaxonomy SelectEntriesByObject(RDFOntologyResource objectResource)
        {
            var resultTaxonomy = new RDFOntologyTaxonomy(this.Category);

            if (objectResource != null)
            {
                foreach (var te   in this.Where(tEntry => tEntry.TaxonomyObject.Equals(objectResource)))
                {
                    resultTaxonomy.AddEntry(te);
                }
            }
            return(resultTaxonomy);
        }
Beispiel #4
0
        /// <summary>
        /// Builds a new intersection taxonomy from this taxonomy and a given one
        /// </summary>
        internal RDFOntologyTaxonomy IntersectWith(RDFOntologyTaxonomy taxonomy)
        {
            var result = new RDFOntologyTaxonomy(this.Category);

            if (taxonomy != null)
            {
                //Add intersection triples
                foreach (var te in this)
                {
                    if (taxonomy.ContainsEntry(te))
                    {
                        result.AddEntry(te);
                    }
                }
            }
            return(result);
        }