@@ -9,7 +9,7 @@ const wikidata = require("./wikidata")
99function mapIdentifier ( id ) {
1010 return {
1111 uri : "http://www.wikidata.org/entity/" + id ,
12- notation : [ id ]
12+ notation : [ id ] ,
1313 }
1414}
1515
@@ -27,7 +27,7 @@ function mapSimpleDescriptions (descriptions) {
2727 const scopeNote = languages . reduce ( ( notes , lang ) => {
2828 notes [ lang ] = [ descriptions [ lang ] ]
2929 return notes
30- } , { "-" : [ ] }
30+ } , { "-" : [ ] } ,
3131 )
3232 return { scopeNote }
3333 } else {
@@ -48,11 +48,11 @@ function mapMappingClaims (claims, options = {}) {
4848 list . forEach ( mapping => {
4949 mapping . fromScheme = {
5050 uri : wikidata . uri ,
51- notation : wikidata . notation
51+ notation : wikidata . notation ,
5252 }
5353 mapping . toScheme = {
5454 uri : scheme . uri ,
55- notation : scheme . notation
55+ notation : scheme . notation ,
5656 }
5757 mapping . from = { memberSet : [ ] }
5858 if ( from ) {
@@ -71,7 +71,9 @@ function mapMappingClaims (claims, options = {}) {
7171}
7272
7373function mapSimpleClaims ( claims ) {
74- if ( ! claims ) return { }
74+ if ( ! claims ) {
75+ return { }
76+ }
7577
7678 const mediaUrl = media => "http://commons.wikimedia.org/wiki/Special:FilePath/" + encodeURIComponent ( media )
7779
@@ -92,7 +94,7 @@ function mapSimpleClaims (claims) {
9294 P576 : [ "endDate" , false ] ,
9395 P625 : [ "location" , false , ( coord ) => {
9496 return { type : "Point" , coordinates : [ coord [ 1 ] , coord [ 0 ] ] } // lon, lat
95- } ]
97+ } ] ,
9698 }
9799
98100 var concept = { }
@@ -101,7 +103,9 @@ function mapSimpleClaims (claims) {
101103 const propertyClaims = claims [ property ]
102104
103105 var mapping = mappings [ property ]
104- if ( ! mapping ) continue
106+ if ( ! mapping ) {
107+ continue
108+ }
105109
106110 const field = mapping . shift ( )
107111
@@ -127,39 +131,41 @@ function mapSimpleClaims (claims) {
127131}
128132
129133function mapSimpleSitelinks ( sitelinks ) {
130- if ( ! sitelinks ) return { }
134+ if ( ! sitelinks ) {
135+ return { }
136+ }
131137
132138 // TODO: get sitelinks-matrix and filter by language?
133139 return {
134140 occurrences : [
135141 {
136- database : { " uri" : "http://www.wikidata.org/entity/Q2013" } ,
142+ database : { uri : "http://www.wikidata.org/entity/Q2013" } ,
137143 relation : "http://schema.org/about" ,
138- count : Object . keys ( sitelinks ) . length
139- }
144+ count : Object . keys ( sitelinks ) . length ,
145+ } ,
140146 ] ,
141147 subjectOf : Object . keys ( sitelinks ) . map ( site => {
142148 try {
143149 return {
144- url : wdk . getSitelinkUrl ( site , sitelinks [ site ] )
150+ url : wdk . getSitelinkUrl ( site , sitelinks [ site ] ) ,
145151 }
146152 } catch ( e ) {
147153 // just ignore unkown sites
148154
149155 }
150- } ) . filter ( site => site )
156+ } ) . filter ( site => site ) ,
151157 }
152158}
153159
154160function mapInfo ( entity ) {
155161 const type = [
156162 "http://www.w3.org/2004/02/skos/core#Concept" ,
157- entityTypes [ entity . type ]
163+ entityTypes [ entity . type ] ,
158164 ]
159165 return {
160166 modified : entity . modified ,
161167 type,
162- inScheme : [ { uri : wikidata . uri } ]
168+ inScheme : [ { uri : wikidata . uri } ] ,
163169 }
164170}
165171
@@ -171,7 +177,7 @@ function mapSimpleEntity (entity) {
171177 mapSimpleDescriptions ( entity . descriptions ) ,
172178 mapSimpleClaims ( entity . claims ) ,
173179 mapSimpleSitelinks ( entity . sitelinks ) ,
174- mapInfo ( entity )
180+ mapInfo ( entity ) ,
175181 )
176182}
177183
@@ -194,5 +200,5 @@ module.exports = {
194200 mapSitelinks : sitelinks => mapSimpleSitelinks ( wdk . simplify . sitelinks ( sitelinks ) ) ,
195201 mapEntity : entity => mapSimpleEntity ( wdk . simplify . entity ( entity ) ) ,
196202 mapInfo,
197- mapMappingClaims
203+ mapMappingClaims,
198204}
0 commit comments