File tree Expand file tree Collapse file tree 1 file changed +13
-10
lines changed
Expand file tree Collapse file tree 1 file changed +13
-10
lines changed Original file line number Diff line number Diff line change @@ -494,16 +494,8 @@ func (p *TripleAggregateToWikiPageConverter) convertUriToWikiTitle(uri string, u
494494 // Conversion strategies:
495495 // 1. Existing wiki title (in wiki, or cache)
496496 // 2. Use configured title-deciding properties
497- for _ , titleProp := range titleProperties {
498- if aggr != nil {
499- for _ , tr := range aggr .Triples {
500- if tr .Pred .String () == titleProp {
501- factTitle = tr .Obj .String ()
502- }
503- }
504- } else {
505- factTitle = ""
506- }
497+ if aggr != nil {
498+ factTitle = p .findTitleInTriples (aggr .Triples )
507499 }
508500
509501 // 3. Shorten URI namespace to alias (e.g. http://purl.org/dc -> dc:)
@@ -535,6 +527,17 @@ func (p *TripleAggregateToWikiPageConverter) convertUriToWikiTitle(uri string, u
535527 return pageTitle , factTitle
536528}
537529
530+ func (p * TripleAggregateToWikiPageConverter ) findTitleInTriples (triples []rdf.Triple ) string {
531+ for _ , titleProp := range titleProperties {
532+ for _ , tr := range triples {
533+ if tr .Pred .String () == titleProp {
534+ return tr .Obj .String ()
535+ }
536+ }
537+ }
538+ return ""
539+ }
540+
538541// --------------------------------------------------------------------------------
539542// CategoryFilterer
540543// --------------------------------------------------------------------------------
You can’t perform that action at this time.
0 commit comments