public Entity(NTriple.NTriple nTriple) { const int CategoryNameGroupIndex = 1; Regex categoriNameRegex = new Regex(@"http://dbpedia.org/resource/Category:(\w+)"); this.Name = categoriNameRegex.Match(nTriple.Triple.Item1).Groups[CategoryNameGroupIndex].Value; if (nTriple.Triple.Item2.Contains("http://www.w3.org/2004/02/skos/core#broader")) { this.Parent = categoriNameRegex.Match(nTriple.Triple.Item3).Groups[CategoryNameGroupIndex].Value; } }
public Individual(NTriple.NTriple nTriple) { Regex regex = new Regex(@"http://dbpedia.org/resource/(\w+)"); this.Name = regex.Match(nTriple.Triple.Item1).Groups[1].Value; if (nTriple.Triple.Item2.Contains("http://purl.org/dc/terms/subject")) { regex = new Regex(@"http://dbpedia.org/resource/Category:(\w+)"); this.Category = regex.Match(nTriple.Triple.Item3).Groups[1].Value; } }