/// <summary> /// Gets an ontology data representation of this collection /// </summary> public RDFOntologyData ToRDFOntologyData() { var result = new RDFOntologyData(); //Collection result.AddFact(this); result.AddClassTypeRelation(this, RDFVocabulary.SKOS.COLLECTION.ToRDFOntologyClass()); //Concepts foreach (var cn in this.Concepts.Values) { result.AddFact(cn); result.AddClassTypeRelation(cn, RDFVocabulary.SKOS.CONCEPT.ToRDFOntologyClass()); result.AddAssertionRelation(this, RDFVocabulary.SKOS.MEMBER.ToRDFOntologyObjectProperty(), cn); } //Collections foreach (var cl in this.Collections.Values) { result.AddAssertionRelation(this, RDFVocabulary.SKOS.MEMBER.ToRDFOntologyObjectProperty(), cl); result = result.UnionWith(cl.ToRDFOntologyData()); } return(result); }
/// <summary> /// Gets an ontology data representation of this collection /// </summary> public RDFOntologyData ToRDFOntologyData() { var result = new RDFOntologyData(); //OrderedCollection result.AddFact(this); result.AddClassTypeRelation(this, RDFVocabulary.SKOS.ORDERED_COLLECTION.ToRDFOntologyClass()); result.AddAssertionRelation(this, RDFVocabulary.SKOS.MEMBER_LIST.ToRDFOntologyObjectProperty(), this.Representative); //Representative result.AddFact(this.Representative); //Concepts var reifSubj = new RDFOntologyFact((RDFResource)this.Representative.Value); if (this.ConceptsCount == 0) { result.Relations.ClassType.AddEntry(new RDFOntologyTaxonomyEntry(reifSubj, RDFVocabulary.RDF.TYPE.ToRDFOntologyObjectProperty(), RDFVocabulary.RDF.LIST.ToRDFOntologyClass())); result.Relations.Assertions.AddEntry(new RDFOntologyTaxonomyEntry(reifSubj, RDFVocabulary.RDF.FIRST.ToRDFOntologyObjectProperty(), RDFVocabulary.RDF.NIL.ToRDFOntologyFact())); result.Relations.Assertions.AddEntry(new RDFOntologyTaxonomyEntry(reifSubj, RDFVocabulary.RDF.REST.ToRDFOntologyObjectProperty(), RDFVocabulary.RDF.NIL.ToRDFOntologyFact())); } else { var itemCounter = 0; var conceptsEnum = this.ConceptsEnumerator; while (conceptsEnum.MoveNext()) { result.AddFact(conceptsEnum.Current.Item2); result.AddClassTypeRelation(conceptsEnum.Current.Item2, RDFVocabulary.SKOS.CONCEPT.ToRDFOntologyClass()); //first result.Relations.ClassType.AddEntry(new RDFOntologyTaxonomyEntry(reifSubj, RDFVocabulary.RDF.TYPE.ToRDFOntologyObjectProperty(), RDFVocabulary.RDF.LIST.ToRDFOntologyClass())); result.Relations.Assertions.AddEntry(new RDFOntologyTaxonomyEntry(reifSubj, RDFVocabulary.RDF.FIRST.ToRDFOntologyObjectProperty(), conceptsEnum.Current.Item2)); //rest itemCounter++; if (itemCounter < this.ConceptsCount) { var newReifSubj = new RDFOntologyFact(new RDFResource()); result.Relations.Assertions.AddEntry(new RDFOntologyTaxonomyEntry(reifSubj, RDFVocabulary.RDF.REST.ToRDFOntologyObjectProperty(), newReifSubj)); reifSubj = newReifSubj; } else { result.Relations.Assertions.AddEntry(new RDFOntologyTaxonomyEntry(reifSubj, RDFVocabulary.RDF.REST.ToRDFOntologyObjectProperty(), RDFVocabulary.RDF.NIL.ToRDFOntologyFact())); } } } return(result); }
/// <summary> /// Gets an ontology data representation of this scheme /// </summary> public RDFOntologyData ToRDFOntologyData() { var result = new RDFOntologyData(); //ConceptScheme result.AddFact(this); result.AddClassTypeRelation(this, RDFVocabulary.SKOS.CONCEPT_SCHEME.ToRDFOntologyClass()); //Concepts foreach (var c in this) { result.AddFact(c); result.AddClassTypeRelation(c, RDFVocabulary.SKOS.CONCEPT.ToRDFOntologyClass()); result.AddAssertionRelation(c, RDFVocabulary.SKOS.IN_SCHEME.ToRDFOntologyObjectProperty(), this); } //Collections foreach (var c in this.Collections.Values) { result.AddAssertionRelation(c, RDFVocabulary.SKOS.IN_SCHEME.ToRDFOntologyObjectProperty(), this); result = result.UnionWith(c.ToRDFOntologyData()); } //OrderedCollections foreach (var o in this.OrderedCollections.Values) { result.AddAssertionRelation(o, RDFVocabulary.SKOS.IN_SCHEME.ToRDFOntologyObjectProperty(), this); result = result.UnionWith(o.ToRDFOntologyData()); } //Labels foreach (var l in this.Labels.Values) { result.AddFact(l); result.AddClassTypeRelation(l, RDFVocabulary.SKOS.SKOSXL.LABEL.ToRDFOntologyClass()); result.AddAssertionRelation(l, RDFVocabulary.SKOS.IN_SCHEME.ToRDFOntologyObjectProperty(), this); } //Assertions result.Relations.Assertions = result.Relations.Assertions.UnionWith(this.Relations.TopConcept) .UnionWith(this.Relations.Broader) .UnionWith(this.Relations.BroaderTransitive) .UnionWith(this.Relations.BroadMatch) .UnionWith(this.Relations.Narrower) .UnionWith(this.Relations.NarrowerTransitive) .UnionWith(this.Relations.NarrowMatch) .UnionWith(this.Relations.Related) .UnionWith(this.Relations.RelatedMatch) .UnionWith(this.Relations.SemanticRelation) .UnionWith(this.Relations.MappingRelation) .UnionWith(this.Relations.CloseMatch) .UnionWith(this.Relations.ExactMatch) .UnionWith(this.Relations.Notation) .UnionWith(this.Relations.PrefLabel) .UnionWith(this.Relations.AltLabel) .UnionWith(this.Relations.HiddenLabel) .UnionWith(this.Relations.LiteralForm) .UnionWith(this.Relations.LabelRelation); //Annotations result.Annotations.CustomAnnotations = result.Annotations.CustomAnnotations.UnionWith(this.Annotations.PrefLabel) .UnionWith(this.Annotations.AltLabel) .UnionWith(this.Annotations.HiddenLabel) .UnionWith(this.Annotations.Note) .UnionWith(this.Annotations.ChangeNote) .UnionWith(this.Annotations.EditorialNote) .UnionWith(this.Annotations.HistoryNote) .UnionWith(this.Annotations.ScopeNote) .UnionWith(this.Annotations.Definition) .UnionWith(this.Annotations.Example); return(result); }