public ActionResult Item(string id) { var sparql = @" PREFIX : <urn:> PREFIX skos: <http://www.w3.org/2004/02/skos/core#> CONSTRUCT { ?scheme a skos:ConceptScheme ; skos:prefLabel ?schemeLabel ; skos:hasTopConcept ?concept ; skos:editorialNote ?editorialNote ; skos:notation ?notation ; skos:definition ?definition ; skos:scopeNote ?scopeNote . ?concept a skos:Concept ; skos:prefLabel ?conceptLabel ; . } WHERE { BIND(@parameter AS ?scheme) ?scheme a skos:ConceptScheme ; skos:prefLabel ?schemePrefLabel ; skos:hasTopConcept ?concept ; . ?concept skos:prefLabel ?conceptPrefLabel ; . BIND(STR(?schemePrefLabel) AS ?schemeLabel) BIND(STR(?conceptPrefLabel) AS ?conceptLabel) OPTIONAL { ?scheme skos:definition ?definition . } OPTIONAL { ?scheme skos:editorialNote ?editorialNote . } OPTIONAL { ?scheme skos:notation ?notation . } OPTIONAL { ?scheme skos:scopeNote ?scopeNote . } } "; var graph = new Skos(this.VocabularyService.Execute(sparql, new Uri(Program.BaseUri, id))); return(this.View(graph.ConceptSchemes.Single(cs => cs.Id == id))); }
public ActionResult Item(string id) { var sparql = @" PREFIX : <urn:> PREFIX skos: <http://www.w3.org/2004/02/skos/core#> CONSTRUCT { ?concept <urn:selected> true ; a skos:Concept ; skos:prefLabel ?conceptLabel ; skos:altLabel ?altLabel ; skos:definition ?definition ; skos:editorialNote ?editorialNote ; skos:historyNote ?historyNote ; skos:notation ?notation ; skos:narrower ?narrower ; skos:broader ?broader ; skos:inScheme ?scheme ; skos:topConceptOf ?topConceptOf; skos:scopeNote ?scopeNote; skos:related ?related . ?narrower a skos:Concept ; skos:prefLabel ?narrowerLabel . ?broader a skos:Concept ; skos:prefLabel ?broaderLabel . ?related a skos:Concept ; skos:prefLabel ?relatedLabel . ?scheme a skos:ConceptScheme ; skos:prefLabel ?schemeLabel . ?parent a skos:Collection ; skos:member ?concept ; skos:prefLabel ?parentLabel . } WHERE { BIND(@parameter AS ?concept) ?concept a skos:Concept ; skos:prefLabel ?conceptPrefLabel . BIND(STR(?conceptPrefLabel) AS ?conceptLabel) OPTIONAL { ?concept skos:altLabel ?conceptAltLabel . BIND(STR(?conceptAltLabel) AS ?altLabel) } OPTIONAL { ?concept skos:definition ?definition . } OPTIONAL { ?concept skos:editorialNote ?editorialNote . } OPTIONAL { ?concept skos:historyNote ?historyNote . } OPTIONAL { ?concept skos:notation ?notation . } OPTIONAL { ?concept skos:topConceptOf ?topConceptOf . } OPTIONAL { ?concept skos:scopeNote ?scopeNote . } OPTIONAL { ?narrower ^skos:narrower ?concept ; skos:prefLabel ?narrowerPrefLabel . BIND(STR(?narrowerPrefLabel) AS ?narrowerLabel) } OPTIONAL { ?broader ^skos:broader ?concept ; skos:prefLabel ?broaderPrefLabel . BIND(STR(?broaderPrefLabel) AS ?broaderLabel) } OPTIONAL { ?related ^skos:related ?concept ; skos:prefLabel ?relatedPrefLabel . BIND(STR(?relatedPrefLabel) AS ?relatedLabel) } OPTIONAL { ?scheme ^skos:inScheme ?concept ; skos:prefLabel ?schemePrefLabel . BIND(STR(?schemePrefLabel) AS ?schemeLabel) } OPTIONAL { ?parent skos:member ?concept ; skos:prefLabel ?parentPrefLabel . BIND(STR(?parentPrefLabel) AS ?parentLabel) } } "; var graph = new Skos(this.VocabularyService.Execute(sparql, new Uri(Program.BaseUri, id))); return(this.View(graph.Concepts.Single(c => c.Id == id))); }
public ActionResult Tree(string id) { var sparql = @" PREFIX : <urn:> PREFIX skos: <http://www.w3.org/2004/02/skos/core#> CONSTRUCT { ?scheme a skos:ConceptScheme ; skos:prefLabel ?schemeLabel ; skos:hasTopConcept ?topConcept ; . ?concept a skos:Concept ; skos:narrower ?narrower ; skos:prefLabel ?conceptLabel ; . } WHERE { BIND(@parameter AS ?scheme) { ?scheme a skos:ConceptScheme ; skos:prefLabel ?schemePrefLabel ; skos:hasTopConcept ?topConcept ; . BIND(STR(?schemePrefLabel) AS ?schemeLabel) } UNION { ?concept skos:inScheme ?scheme ; skos:prefLabel ?conceptPrefLabel ; . BIND(STR(?conceptPrefLabel) AS ?conceptLabel) OPTIONAL { ?narrower ^skos:narrower ?concept ; skos:inScheme ?scheme ; . } } } "; var g = new Skos(this.VocabularyService.Execute(sparql, new Uri(Program.BaseUri, id))); foreach (var scheme in g.ConceptSchemes) { foreach (var topConcept in scheme.HasTopConcept) { CutCycles(topConcept); } } return(this.View(g.ConceptSchemes.Single(cs => cs.Id == id))); }
public ActionResult Item(string id) { var sparql = @" PREFIX : <urn:> PREFIX skos: <http://www.w3.org/2004/02/skos/core#> CONSTRUCT { ?collection <urn:selected> true ; a skos:Collection ; skos:prefLabel ?collectionLabel ; skos:member ?concept ; skos:member ?child ; . ?concept a skos:Concept ; skos:prefLabel ?conceptLabel ; . ?parent a skos:Collection ; skos:member ?collection ; skos:prefLabel ?parentLabel ; . ?child a skos:Collection ; skos:prefLabel ?childLabel ; . } WHERE { BIND(@parameter AS ?collection) ?collection skos:prefLabel ?collectionPrefLabel ; . BIND(STR(?collectionPrefLabel) AS ?collectionLabel) OPTIONAL { ?concept a skos:Concept ; ^skos:member ?collection ; skos:prefLabel ?conceptPrefLabel ; . BIND(STR(?conceptPrefLabel) AS ?conceptLabel) } OPTIONAL { ?parent a skos:Collection ; skos:member ?collection ; skos:prefLabel ?parentPrefLabel ; . BIND(STR(?parentPrefLabel) AS ?parentLabel) } OPTIONAL { ?child a skos:Collection ; ^skos:member ?collection ; skos:prefLabel ?childPrefLabel ; . BIND(STR(?childPrefLabel) AS ?childLabel) } } "; var skos = new Skos(this.VocabularyService.Execute(sparql, new Uri(Program.BaseUri, id))); var collection = skos.Collections.SingleOrDefault(c => c.Id == id); if (collection is null) { return(NotFound()); } return(View(collection)); }