diff --git a/Examples/SZNAltmetricDemoOSX/SZNAltmetricDemoOSX/SZNAppDelegate.h b/Examples/SZNAltmetricDemoOSX/SZNAltmetricDemoOSX/SZNAppDelegate.h index 812c812..3d21ff1 100644 --- a/Examples/SZNAltmetricDemoOSX/SZNAltmetricDemoOSX/SZNAppDelegate.h +++ b/Examples/SZNAltmetricDemoOSX/SZNAltmetricDemoOSX/SZNAppDelegate.h @@ -25,5 +25,8 @@ @end -@interface SZNArrayToStringTransformer: NSValueTransformer +@interface SZNArrayToStringWithCommaTransformer: NSValueTransformer +@end + +@interface SZNArrayToStringWithLineBreakTransformer: NSValueTransformer @end \ No newline at end of file diff --git a/Examples/SZNAltmetricDemoOSX/SZNAltmetricDemoOSX/SZNAppDelegate.m b/Examples/SZNAltmetricDemoOSX/SZNAltmetricDemoOSX/SZNAppDelegate.m index 0e4aaf9..c5b7de0 100644 --- a/Examples/SZNAltmetricDemoOSX/SZNAltmetricDemoOSX/SZNAppDelegate.m +++ b/Examples/SZNAltmetricDemoOSX/SZNAltmetricDemoOSX/SZNAppDelegate.m @@ -43,7 +43,7 @@ - (IBAction)openDetailsURL:(id)sender @end -@implementation SZNArrayToStringTransformer +@implementation SZNArrayToStringWithCommaTransformer + (Class)transformedValueClass { @@ -60,4 +60,23 @@ - (id)transformedValue:(id)value return (value == nil) ? nil : [(NSArray *)value componentsJoinedByString:@", "]; } +@end + +@implementation SZNArrayToStringWithLineBreakTransformer + ++ (Class)transformedValueClass +{ + return [NSArray class]; +} + ++ (BOOL)allowsReverseTransformation +{ + return NO; +} + +- (id)transformedValue:(id)value +{ + return (value == nil) ? nil : [(NSArray *)value componentsJoinedByString:@"\n"]; +} + @end \ No newline at end of file diff --git a/Examples/SZNAltmetricDemoOSX/SZNAltmetricDemoOSX/en.lproj/MainMenu.xib b/Examples/SZNAltmetricDemoOSX/SZNAltmetricDemoOSX/en.lproj/MainMenu.xib index fe2d42b..f9d0592 100644 --- a/Examples/SZNAltmetricDemoOSX/SZNAltmetricDemoOSX/en.lproj/MainMenu.xib +++ b/Examples/SZNAltmetricDemoOSX/SZNAltmetricDemoOSX/en.lproj/MainMenu.xib @@ -1302,7 +1302,7 @@ 15 2 - {{335, 390}, {653, 592}} + {{335, 390}, {653, 615}} 1954021376 SZNAltmetricDemoOSX NSWindow @@ -1316,7 +1316,7 @@ 265 - {{309, 544}, {119, 32}} + {{309, 567}, {119, 32}} @@ -1345,7 +1345,7 @@ 268 - {{17, 553}, {75, 17}} + {{17, 576}, {75, 17}} @@ -1382,7 +1382,7 @@ 266 - {{97, 550}, {210, 22}} + {{97, 573}, {210, 22}} @@ -1418,7 +1418,7 @@ 268 - {{29, 291}, {180, 27}} + {{29, 314}, {180, 27}} @@ -1451,7 +1451,7 @@ NeXT Encapsulated PostScript v1.2 pasteboard type NeXT TIFF v4.0 pasteboard type - {{29, 323}, {180, 180}} + {{29, 346}, {180, 180}} @@ -1472,7 +1472,7 @@ 266 - {{228, 479}, {408, 22}} + {{228, 502}, {408, 22}} @@ -1497,7 +1497,7 @@ 268 - {{228, 230}, {90, 17}} + {{228, 253}, {90, 17}} @@ -1518,7 +1518,7 @@ 266 - {{320, 230}, {316, 17}} + {{320, 253}, {316, 17}} @@ -1552,7 +1552,7 @@ 268 - {{228, 205}, {90, 17}} + {{228, 228}, {90, 17}} @@ -1573,7 +1573,7 @@ 266 - {{320, 205}, {316, 17}} + {{320, 228}, {316, 17}} @@ -1603,7 +1603,7 @@ 268 - {{228, 255}, {90, 17}} + {{228, 278}, {90, 17}} @@ -1624,7 +1624,7 @@ 266 - {{320, 255}, {316, 17}} + {{320, 278}, {316, 17}} @@ -1654,7 +1654,7 @@ 268 - {{241, 168}, {77, 17}} + {{241, 191}, {77, 17}} @@ -1675,7 +1675,7 @@ 266 - {{319, 168}, {199, 17}} + {{319, 191}, {199, 17}} @@ -1696,7 +1696,7 @@ 268 - {{238, 143}, {80, 17}} + {{238, 166}, {80, 17}} @@ -1717,7 +1717,7 @@ 266 - {{318, 143}, {200, 17}} + {{318, 166}, {200, 17}} @@ -1738,7 +1738,7 @@ 265 - {{517, 159}, {122, 32}} + {{517, 182}, {122, 32}} @@ -1763,10 +1763,10 @@ 265 - {{517, 134}, {122, 32}} + {{517, 157}, {122, 32}} - + _NS:9 YES @@ -1788,7 +1788,7 @@ 265 - {{430, 553}, {16, 16}} + {{430, 576}, {16, 16}} @@ -1799,7 +1799,7 @@ 268 - {{29, 252}, {103, 19}} + {{29, 275}, {103, 19}} @@ -1809,7 +1809,7 @@ 68157504 4195328 Mentioned by - + LucidaGrande 15 16 @@ -1824,7 +1824,7 @@ 268 - {{29, 227}, {38, 17}} + {{29, 250}, {38, 17}} @@ -1849,7 +1849,7 @@ 268 - {{69, 227}, {140, 17}} + {{69, 250}, {140, 17}} @@ -1870,7 +1870,7 @@ 268 - {{29, 202}, {38, 17}} + {{29, 225}, {38, 17}} @@ -1891,7 +1891,7 @@ 268 - {{69, 202}, {140, 17}} + {{69, 225}, {140, 17}} @@ -1912,7 +1912,7 @@ 268 - {{29, 177}, {38, 17}} + {{29, 200}, {38, 17}} @@ -1933,7 +1933,7 @@ 268 - {{69, 177}, {140, 17}} + {{69, 200}, {140, 17}} @@ -1954,7 +1954,7 @@ 268 - {{29, 152}, {38, 17}} + {{29, 175}, {38, 17}} @@ -1975,7 +1975,7 @@ 268 - {{69, 152}, {140, 17}} + {{69, 175}, {140, 17}} @@ -1996,7 +1996,7 @@ 268 - {{228, 442}, {90, 17}} + {{228, 465}, {90, 17}} @@ -2017,7 +2017,7 @@ 266 - {{320, 442}, {316, 17}} + {{320, 465}, {316, 17}} @@ -2038,7 +2038,7 @@ 268 - {{228, 417}, {90, 17}} + {{228, 440}, {90, 17}} @@ -2059,7 +2059,7 @@ 266 - {{320, 417}, {316, 17}} + {{320, 440}, {316, 17}} @@ -2080,7 +2080,7 @@ 268 - {{228, 392}, {90, 17}} + {{228, 415}, {90, 17}} @@ -2101,7 +2101,7 @@ 266 - {{320, 392}, {316, 17}} + {{320, 415}, {316, 17}} @@ -2122,7 +2122,7 @@ 268 - {{228, 367}, {90, 17}} + {{228, 390}, {90, 17}} @@ -2143,7 +2143,7 @@ 266 - {{320, 367}, {316, 17}} + {{320, 390}, {316, 17}} @@ -2164,7 +2164,7 @@ 268 - {{228, 342}, {90, 17}} + {{228, 365}, {90, 17}} @@ -2185,7 +2185,7 @@ 266 - {{320, 342}, {316, 17}} + {{320, 365}, {316, 17}} @@ -2206,7 +2206,7 @@ 268 - {{228, 317}, {90, 17}} + {{228, 340}, {90, 17}} @@ -2227,7 +2227,7 @@ 266 - {{320, 317}, {316, 17}} + {{320, 340}, {316, 17}} @@ -2248,7 +2248,7 @@ 268 - {{228, 280}, {90, 17}} + {{228, 303}, {90, 17}} @@ -2269,7 +2269,7 @@ 266 - {{320, 280}, {316, 17}} + {{320, 303}, {316, 17}} @@ -2287,239 +2287,281 @@ NO - + 268 - {{257, 106}, {61, 17}} + {{257, 129}, {61, 17}} - + _NS:1535 YES - + 68157504 71304192 Subjects: _NS:1535 - + NO - + 266 - {{318, 106}, {318, 17}} + {{318, 129}, {318, 17}} - + _NS:1535 YES - + 69206081 272631808 #### _NS:1535 - + NO - + 268 - {{209, 81}, {109, 17}} + {{209, 104}, {109, 17}} - + _NS:1535 YES - + 68157504 71304192 Scopus subjects: _NS:1535 - + NO - + 266 - {{318, 81}, {318, 17}} + {{318, 104}, {318, 17}} - + _NS:1535 YES - + 69206081 272631808 #### _NS:1535 - + NO - + 268 - {{29, 113}, {85, 19}} + {{29, 136}, {85, 19}} - + _NS:1535 YES - + 68157504 4195328 Readers on - + _NS:1535 - + NO - + 268 - {{29, 88}, {38, 17}} + {{29, 111}, {38, 17}} - + _NS:1535 YES - + 67108928 -2076178432 ## _NS:1535 - + NO - + 268 - {{69, 88}, {140, 17}} + {{69, 111}, {140, 17}} - + _NS:1535 YES - + 68157504 4195328 Mendeley _NS:1535 - + NO - + 268 - {{29, 63}, {38, 17}} + {{29, 86}, {38, 17}} - + _NS:1535 YES - + 67108928 -2076178432 ## _NS:1535 - + NO - + 268 - {{69, 63}, {140, 17}} + {{69, 86}, {140, 17}} - + _NS:1535 YES - + 68157504 4195328 CiteULike _NS:1535 - + NO - + 268 - {{29, 38}, {38, 17}} + {{29, 61}, {38, 17}} - + _NS:1535 YES - + 67108928 -2076178432 ## _NS:1535 - + NO - + 268 - {{69, 38}, {140, 17}} + {{69, 61}, {140, 17}} - + _NS:1535 YES - + 68157504 4195328 Connotea _NS:1535 - + + + + + NO + + + + 268 + {{267, 67}, {53, 17}} + + + + _NS:1535 + YES + + 68157504 + 71304192 + Quotes: + + _NS:1535 + + + + + NO + + + + 266 + {{320, 33}, {318, 51}} + + + + _NS:1535 + YES + + 69206081 + 272632064 + IyMjIwojIyMjCiMjIyM + + _NS:1535 + NO - {653, 592} + {653, 615} @@ -3679,50 +3721,50 @@ value: selection.self.subjects - + - + value: selection.self.subjects value selection.self.subjects NSValueTransformerName - SZNArrayToStringTransformer + SZNArrayToStringWithCommaTransformer 2 - 736 + 773 value: selection.self.scopusSubjects - + - + value: selection.self.scopusSubjects value selection.self.scopusSubjects NSValueTransformerName - SZNArrayToStringTransformer + SZNArrayToStringWithCommaTransformer 2 - 741 + 774 value: selection.self.readers.mendeley - + - + value: selection.self.readers.mendeley value @@ -3739,10 +3781,10 @@ value: selection.self.readers.citeulike - + - + value: selection.self.readers.citeulike value @@ -3759,10 +3801,10 @@ value: selection.self.readers.connotea - + - + value: selection.self.readers.connotea value @@ -3776,6 +3818,26 @@ 765 + + + value: selection.self.quotes + + + + + + value: selection.self.quotes + value + selection.self.quotes + + NSValueTransformerName + SZNArrayToStringWithLineBreakTransformer + + 2 + + + 775 + @@ -4343,17 +4405,19 @@ - - - - - - - - - - - + + + + + + + + + + + + + @@ -5408,146 +5472,172 @@ 724 - + - + 725 - + - + 726 - - + + 727 - - + + 730 - + - + 733 - - + + 737 - + - + 738 - - + + 747 - + - + 748 - - + + 749 - + - + 750 - + - + 751 - - + + 752 - - + + 755 - + - + 756 - + - + 757 - - + + 758 - - + + 760 - + - + 761 - + - + 762 - - + + 763 - - + + + + + 767 + + + + + + + + 768 + + + + + + + + 769 + + + + + 770 + + @@ -5812,7 +5902,11 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -5824,7 +5918,7 @@ - 766 + 775 diff --git a/Examples/SZNAltmetricDemoOSX/SZNAltmetricDemoOSXTests/classes/SZNAltmetricArticleTests.m b/Examples/SZNAltmetricDemoOSX/SZNAltmetricDemoOSXTests/classes/SZNAltmetricArticleTests.m index 9d54b28..c6b51ae 100644 --- a/Examples/SZNAltmetricDemoOSX/SZNAltmetricDemoOSXTests/classes/SZNAltmetricArticleTests.m +++ b/Examples/SZNAltmetricDemoOSX/SZNAltmetricDemoOSXTests/classes/SZNAltmetricArticleTests.m @@ -23,6 +23,7 @@ - (void)testArticleFromRespondeDictionary STAssertEqualObjects(article.addedOn, [NSDate dateWithTimeIntervalSince1970:1324491937], @"Added on not extracted"); STAssertEqualObjects(article.identifier, @"502878", @"Identifier not extracted"); + STAssertEqualObjects(article.altmetricJIdentifier, @"4f6fa62f3cf058f6100082d3", @"J Identifier not extracted"); STAssertEqualObjects(article.ADSBibcode, @"2011natur.480..426v", @"ADS not extracted"); STAssertEqualObjects(article.citedByAccountsCount, @(393), @"Cited by accounts not extracted"); STAssertEqualObjects(article.citedByFacebookWallsCount, @(12), @"Cited by Facebook walls not extracted"); @@ -39,6 +40,10 @@ - (void)testArticleFromRespondeDictionary STAssertEqualObjects(article.score, @(353.626), @"Score not extracted"); STAssertEqualObjects(article.subjects, @[@"science"], @"Subjects not extracteds"); STAssertEqualObjects(article.scopusSubjects, @[], @"Scopus subjects not extracteds"); + NSArray *quotes = @[@"Take a look...", @"Third...", @"Nature..."]; + STAssertEqualObjects(article.quotes, quotes, @"Quotes not extracteds"); + NSArray *ISSNs = @[@"0028-0836", @"1744-7933"]; + STAssertEqualObjects(article.ISSNs, ISSNs, @"ISSNs not extracteds"); STAssertEqualObjects(article.imageSmallURL.absoluteString, @"http://fastly.altmetric.com/?size=64&score=354&types=bfgttttt", @"Image small URL not extracted"); STAssertEqualObjects(article.imageMediumURL.absoluteString, @"http://fastly.altmetric.com/?size=100&score=354&types=bfgttttt", @"Image medium URL not extracted"); STAssertEqualObjects(article.imageLargeURL.absoluteString, @"http://fastly.altmetric.com/?size=180&score=354&types=bfgttttt", @"Image large URL not extracted"); diff --git a/Examples/SZNAltmetricDemoOSX/SZNAltmetricDemoOSXTests/resources/article.json b/Examples/SZNAltmetricDemoOSX/SZNAltmetricDemoOSXTests/resources/article.json index ce44bee..ec943b7 100644 --- a/Examples/SZNAltmetricDemoOSX/SZNAltmetricDemoOSXTests/resources/article.json +++ b/Examples/SZNAltmetricDemoOSX/SZNAltmetricDemoOSXTests/resources/article.json @@ -4,10 +4,9 @@ "pmid":"22193080", "nlmid":"0410462", "tq":[ - "Take a look back at the year in science with our review of the biggest stories of 2011", - "Third: Our round-up of the year in research and science policy +interactive timeline", - "Nature's 'year in science' review is really rather essential @NatureNews", - "Scientific Paper Trail 2011 #HigherEd"], + "Take a look...", + "Third...", + "Nature..."], "ads_id":"2011natur.480..426v", "arxiv_id": "arXiv-123", "altmetric_jid":"4f6fa62f3cf058f6100082d3", diff --git a/SZNAltmetric/SZNAltmetricArticle.h b/SZNAltmetric/SZNAltmetricArticle.h index 1912541..6e9fbdb 100644 --- a/SZNAltmetric/SZNAltmetricArticle.h +++ b/SZNAltmetric/SZNAltmetricArticle.h @@ -34,6 +34,11 @@ */ @property (copy, nonatomic) NSString *identifier; +/** + The Altmetric J Identifier of the article. + */ +@property (copy, nonatomic) NSString *altmetricJIdentifier; + /** The title of the article. */ @@ -99,6 +104,11 @@ */ @property (strong, nonatomic) NSNumber *score; +/** + The ISSNs of the article. + */ +@property (strong, nonatomic) NSArray *ISSNs; + /** The Altmetric image URL of the article (large). */ @@ -159,6 +169,11 @@ */ @property (strong, nonatomic) NSArray *scopusSubjects; +/** + The quotes of the article. + */ +@property (strong, nonatomic) NSArray *quotes; + /** The readers count of the article. */ diff --git a/SZNAltmetric/SZNAltmetricArticle.m b/SZNAltmetric/SZNAltmetricArticle.m index fee102d..4496067 100644 --- a/SZNAltmetric/SZNAltmetricArticle.m +++ b/SZNAltmetric/SZNAltmetricArticle.m @@ -30,6 +30,7 @@ + (SZNAltmetricArticle *)articleWithAPIResponseObject:(id)responseObject SZNAltmetricArticle *article = [SZNAltmetricArticle new]; article.addedOn = [NSDate dateWithTimeIntervalSince1970:[responseObject[@"added_on"] doubleValue]]; article.identifier = [NSString stringWithFormat:@"%@", responseObject[@"altmetric_id"]]; + article.altmetricJIdentifier = [NSString stringWithFormat:@"%@", responseObject[@"altmetric_jid"]]; article.ADSBibcode = responseObject[@"ads_id"]; article.citedByAccountsCount = responseObject[@"cited_by_accounts_count"]; article.citedByFacebookWallsCount = responseObject[@"cited_by_fbwalls_count"]; @@ -46,6 +47,8 @@ + (SZNAltmetricArticle *)articleWithAPIResponseObject:(id)responseObject article.score = responseObject[@"score"]; article.subjects = responseObject[@"subjects"]; article.scopusSubjects = responseObject[@"scopus_subjects"]; + article.quotes = responseObject[@"tq"]; + article.ISSNs = responseObject[@"issns"]; article.imageLargeURL = [NSURL URLWithString:responseObject[@"images"][@"large"]]; article.imageMediumURL = [NSURL URLWithString:responseObject[@"images"][@"medium"]]; article.imageSmallURL = [NSURL URLWithString:responseObject[@"images"][@"small"]];