├── LICENSE ├── README.md ├── config.xml ├── css └── xforms.css ├── migrate.xhtml ├── page-flow.xml ├── script ├── post-file.php └── scrape.php ├── xpl ├── delete-file.xpl ├── move-file.xpl ├── post-file.xpl ├── scrape.xpl ├── test-json.xpl └── xml-to-json.xpl └── xslt └── xml-to-json.xsl /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # academia-migrate 2 | 3 | I developed this application to migrate scholarly publications from the pseudo-open Academia.edu into Zenodo.org, which is a truly open platform for the dissemination of research data and publications. Zenodo is developed by CERN and backed by EU funding. This application extracts publication metadata (with PHP) from an Academia.edu user profile and facilitates import of this metadata (if there are associated document files) and re-upload of these document files into Zenodo. 4 | 5 | Despite Academia.edu's (poor) terms of service, Google's recent victory over academic publishers has demonstrated that metadata are not copyrightable, and can be freely harvested from the web. However, the document files cannot be harvested automatically (only authenticated users can download them), and so there needs to be an intermediate step in which Academia users re-upload their files into this system for posting via API into Zenodo. Upon completion of the migration process, these uploaded files will be deleted from this server. 6 | 7 | This framework relies on a PHP script for scraping metadata from Academia.edu and posting files at multipart/form-data. The remaining interactions are handled in Orbeon, an XForms processor. 8 | -------------------------------------------------------------------------------- /config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | dev 5 | 6 | -------------------------------------------------------------------------------- /css/xforms.css: -------------------------------------------------------------------------------- 1 | /* 2 | **************************************** 3 | LAYOUT 4 | **************************************** 5 | */ 6 | .submission { 7 | margin-left:auto; 8 | margin-right:auto; 9 | text-align:center; 10 | width:50%; 11 | } 12 | .alert-box { 13 | width:50%; 14 | margin:20px auto; 15 | padding:5px; 16 | border-radius:5px; 17 | border:1px solid gray; 18 | color:gray; 19 | } 20 | .result_metadata { 21 | border:0; 22 | float:left; 23 | } 24 | #form h3, #form h4, #form h5, #form h6 { 25 | display:inline; 26 | } 27 | .subsection { 28 | margin-bottom:10px; 29 | } 30 | .add { 31 | display:inline; 32 | margin-right:10px; 33 | } 34 | /* 35 | **************************************** 36 | ORBEON XFORM SPECIFIC STYLE 37 | **************************************** 38 | */ 39 | .orbeon .xforms-control { 40 | margin-bottom: 10px; 41 | } 42 | .orbeon .xforms-label { 43 | font-weight: bold; 44 | display: inline-block; 45 | min-width: 9em 46 | } 47 | .orbeon .xforms-select1-appearance-full .xforms-label { 48 | vertical-align: top 49 | } 50 | .orbeon .xforms-input input[type=text], .orbeon .xforms-textarea textarea, .orbeon .xforms-select1 select { 51 | width: 20em; 52 | margin-bottom: 2px; 53 | } 54 | .orbeon .xforms-repeat-selected-item-1 .form-td { 55 | background-color: #f5f5f5 56 | } 57 | .orbeon .xforms-items { 58 | display: inline-block 59 | } 60 | .trigger_container { 61 | margin-bottom:20px; 62 | } 63 | .xforms-trigger-appearance-minimal img { 64 | vertical-align: middle 65 | } 66 | .xforms-output { 67 | margin:0; 68 | } 69 | .xforms-output-output { 70 | padding:0; 71 | line-height:inherit; 72 | display:inline; 73 | font-size:inherit; 74 | color:black 75 | } 76 | .xforms-trigger { 77 | text-decoration:none; 78 | } 79 | .xforms-repeat-selected-item-1, .xforms-repeat-selected-item-2, .xforms-repeat-selected-item-3, .xforms-repeat-selected-item-4 { 80 | background:inherit; 81 | } 82 | .xforms-repeat-selected-item-2 { 83 | background:none; 84 | } 85 | .xxforms-dialog-body>a, .xxforms-dialog-body>span { 86 | width:100px; 87 | } 88 | .xbl-component { 89 | margin:5px 0; 90 | } -------------------------------------------------------------------------------- /migrate.xhtml: -------------------------------------------------------------------------------- 1 | 4 | 5 | Academia Migrate 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | false 20 | 21 | 22 | false 23 | 24 | false 25 | false 26 | 27 | 28 | 29 | false 30 | false 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | Creative Commons Attribution-ShareAlike 70 | Creative Commons Attribution 71 | Creative Commons Public Domain 72 | Creative Commons Non-Commercial 73 | Creative Commons Attribution-NoDerivs 74 | Creative Commons Attribution-NonCommercial 75 | Creative Commons Attribution-NonCommercial-NoDerivs 76 | Creative Commons Attribution-NonCommercial-ShareAlike 77 | 78 | 79 | 80 | 81 | 82 | publication 83 | poster 84 | presentation 85 | 86 | 87 | 88 | 89 | 90 | book 91 | section 92 | conferencepaper 93 | article 94 | patent 95 | preprint 96 | report 97 | softwaredocumentation 98 | thesis 99 | technicalnote 100 | workingpaper 101 | other 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | binary 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 163 | 164 | 165 | 166 | 167 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 195 | 196 | Unable to get response from Zenodo (incorrect access token?). 197 | 198 | 199 | 200 | 201 | 202 | 203 | 206 | 207 | Error posting deposition to Zenodo: 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 221 | 222 | Error posting file to Zenodo: 223 | 224 | 225 | 226 | 227 | 228 | 229 | 232 | 233 | Error publishing deposition in Zenodo: . 234 | 235 | 236 | 237 | 238 | Migration of content to Zenodo is 239 | complete. 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 250 | Error in receiving well-formed XML response from PHP script. 251 | 252 | 253 | 254 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 |
284 |
285 |
286 | 287 |
288 | 289 | Status: 290 | 291 |
292 |
293 |

Academia Migrate

294 | 295 | 296 | 297 |
298 |
299 |

Background

300 |

For the full explanation of my reasoning behind this project, see Open 302 | Access, Academia.edu, and why I'm all-in on Zenodo.org on the American Numismatic Society blog.

303 |

This application extracts publication metadata from an Academia.edu user profile web page and facilitates import of this metadata 304 | (if there are associated document files) and re-upload of these document files into Zenodo. Despite Academia.edu's (poor) terms 305 | of service, Google's recent victory over academic publishers has demonstrated that metadata are not copyrightable, and can be 306 | freely harvested from the web. However, the document files cannot be harvested automatically (only authenticated users can 307 | download them), and so there needs to be an intermediate step in which Academia users re-upload their files into this system for 308 | posting via API into Zenodo. Upon completion of the migration process, these uploaded files will be deleted from this 309 | server.

310 |

It should be noted that an Academia.edu profile seems to only include as many as seven publications of a certain type (papers, 311 | talks, etc.). As a result, this framework will only migrate those documents embedded ino the user profile. Users with many 312 | publications may need to re-run this migration over several iterations, importing seven papers at a time, deleting them from 313 | Academia.edu, and re-running the migration on the next seven documents in the profile. I apologize for the inconvenience, but 314 | Academia.edu is purposely designed to thwart harvesting.

315 |

The code is open source at https://github.com/ewg118/academia-migrate. 316 | It relies on a PHP script for scraping metadata from Academia.edu and posting files at multipart/form-data. The 317 | remaining interactions are handled in Orbeon, an XForms processor. Please submit issues to 318 | Github. The HTML on Academia.edu may change from time to time, and the scraping script may require revision.

319 |

Prerequesites

320 |
    321 |
  1. An Academia.edu profile.
  2. 322 |
  3. A Zenodo.org account and activated access token (see next page).
  4. 323 |
324 | 328 | 329 | Begin 330 | 331 | 332 |
333 |
334 | 335 | 336 | 337 |
338 |
339 |
340 | 341 | 342 |

Validate Zenodo.org Access Token

343 |

After registering your Zenodo.org account, request an access token, and grant 344 | privileges for deposit:write and deposit:actions. At this time, we cannot support Zenodo's OAuth API 345 | as we cannot support HTTPS. However, your access token is not saved or transmitted in any way except to interact with the Zenodo 346 | API. It is secure.

347 | 348 | Token 349 | 350 | 351 | Validate 352 | 353 | 354 | 355 | 356 | 357 |
358 |

The access token is valid. 359 | Proceed 360 |

361 |
362 |
363 |
364 | 365 | 366 | 367 |

Parse Academia.edu Data

368 | 369 | 370 | 371 |

Copy and paste the URL for your Academia.edu profile in the input below and click "Get Record." E.g., 372 | https://numismatics.academia.edu/EthanGruber. The "Get Records" button will activate when the 373 | Profile URL is valid. Note: if you are certain the URL is correct but the button does not activate, 374 | please create a Github issue and paste your profile URL, as there is a pattern matching problem.

375 |
376 | 377 | Profile URL 378 | URL doesn't match expression for an Academia.edu profile 379 | 380 | 381 | 383 | 385 | 386 | 387 | 388 | Get Records 389 | 390 | 391 | 392 | 393 |
394 |
395 | 396 |

Error

397 |

398 |
399 | 400 | 401 |
402 | 403 | Alert: No records have been selected for migration
404 |
405 |

Records

406 |

The records shown below have associated document files on Academia. By default, all records are designated for 407 | migration, but you can uncheck the box to the left of each record to disable import. Any record designated for 408 | migration must have a new uploaded file, and exclamation points next to text inputs indicate required content.

409 |

Since these metadata are parsed from the HTML page for your profile itself, I am uncertain how many publications will 410 | appear on the page. It appears there maybe 11 of each under the Papers and Talks categories. The record list 411 | therefore may be incomplete.

412 |

Fields

413 |

Below is a brief description of the available fields:

414 |
Required
415 |
416 |
License
417 |
Select appropriate Creative Commons license.
418 |
Upload Type
419 |
'publication' (default), 'poster', and 'presentation' are the most common types from Academia.edu
420 |
Publication Type
421 |
When upload type is 'publication', the publication type must be selected. 'article', 'thesis', 'section', and 422 | 'conferencepaper' allow additional fields about the parent publication
423 |
Publication Date
424 |
Use the date picker to select the date. It does need to conform to a particular day, and not an approximate year 425 | or month.
426 |
Abstract
427 |
Required by Zenodo
428 |
Creators
429 |
Name and Affilation are required. First creator cannot be deleted. It is presumed to be the Academia.edu and 430 | Zenodo account holder.
431 |
432 |
Optional
433 |
434 |
Keywords
435 |
Extracted from Academia.edu, but can be deleted migration to Zenodo. Use Zenodo interface for inserted new 436 | keywords.
437 |
Journal Information
438 |
If the Publication Type is 'article', then the Journal Title, Volume, Issue, and Pages may be entered. The Title 439 | is required, if inserted. Others are optional.
440 |
Conference Information
441 |
If the Publication Type is 'conferencepaper', then the Conference Title, Place, and Dates may be added. These 442 | are required if added.
443 |
Thesis University
444 |
If the Publication Type is 'thesis', the Thesis University may be added.
445 |
Book Title
446 |
If the Publication Type is 'section', the Book Title may be added.
447 |
448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 471 | 744 | 797 | 798 | 799 | 800 |
MigrateRecordFile Upload
462 | 463 | 464 | 465 | 467 | 468 | 469 | 470 | 472 |

473 | 474 | 475 | 476 | 477 |

478 |
479 | 480 | 481 | 482 | Journal Title 483 | 484 | 486 | 488 | 490 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | Conference Information 499 | 500 | 502 | 504 | 506 | 507 | 508 | 509 | 510 | 511 | 512 | Thesis University 513 | 514 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | Book TItle 523 | 524 | 526 | 527 | 528 | 529 |
530 |
531 | 532 | Access Right 533 | 534 |
535 |
536 | 537 | License 538 | 539 | 540 | 541 | 542 | 543 |
544 |
545 | 546 | Upload Type 547 | 548 | 549 | 550 | 551 | 552 | 553 | 554 | 555 | 559 | 560 | 561 | 562 | 563 | 564 | 565 |
566 | 567 |
568 | 569 | Publication Type 570 | 571 | 572 | 573 | 574 | 575 |
576 |
577 |
578 | 579 | Publication Date 580 | Required 581 | ISO8601: YYYY-MM-DD 582 | 583 | 585 | 587 | 588 | 589 |
590 |
591 | 592 | Abstract 593 | Required 594 | 595 |
596 | 597 |
598 |

Creators

599 | 600 | 601 |
602 |
Creator
603 | 604 | 605 | 606 | 607 | 608 | 609 | 610 | 611 | 612 |
613 | 614 | Name 615 | Required 616 | 617 |
618 | 619 |
620 | 621 | Affiliation 622 | Required 623 | 624 |
625 |
626 |
627 |
628 |
629 |
630 | 631 | 632 |
633 |

Conference Information

634 |
635 | 636 | Conference Title 637 | Required 638 | 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | 648 | 649 |
650 | 651 |
652 | 653 | Conference Dates 654 | Required 655 | 656 |
657 |
658 | 659 |
660 | 661 | Conference Place 662 | Required 663 | 664 |
665 |
666 |
667 |
668 | 669 | 670 |
671 |

Journal Information

672 |
673 | 674 | Journal Title 675 | Required 676 | 677 | 678 | 679 | 680 | 681 | 682 | 683 | 684 | 685 |
686 | 687 |
688 | 689 | Journal Volume 690 | 691 |
692 |
693 | 694 |
695 | 696 | Journal Issue 697 | 698 |
699 |
700 | 701 |
702 | 703 | Journal Pages 704 | 705 |
706 |
707 |
708 |
709 | 710 |
711 | 712 | Thesis University 713 | Required 714 | 715 |
716 |
717 | 718 |
719 | 720 | Book Title 721 | Required 722 | 723 |
724 |
725 | 726 |
727 |

Keywords

728 |
729 | 730 | 731 | 732 | 733 | 734 | 735 | 736 | 737 | 738 | 739 | 740 |
741 |
742 |
743 |
745 | 746 |
747 | 748 | Alert: There must be an uploaded document.
749 | 750 | 751 | 752 | 753 | There must be an upload 754 | 755 |
756 | 757 | 758 | 759 | 760 | 761 |
762 | 763 | Alert: There may be a special character in your filename that might 764 | result in an upload error.
765 |
766 |
767 | 768 | filename 769 | 770 |
771 |
772 | 773 | mediatype 774 | 775 |
776 |
777 | 778 | Delete 779 | File 780 | 781 | 782 | 783 | 785 | 786 | 787 | 788 | 789 | 790 | 791 | 792 | 793 |
794 |
795 |
796 |
801 | 802 | 803 | 804 | 805 | Upload 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 829 | 830 | 831 | 832 | 833 | 835 | 836 | 837 | 838 | 839 | 840 | 841 | 842 | 843 | 844 | 845 | 846 | 847 | 848 | 850 | 851 | 852 | 853 | 854 | 856 | 857 | 858 | 859 | 860 | 861 | 862 | 863 | 864 | 865 | 866 | 868 | 869 | 870 | 873 | 874 | 875 | 876 | 877 | 878 | 879 | 880 | 881 | 882 |
883 | 884 | Alert: No records have been selected for migration.
885 |
886 |
887 |
888 |
889 |
890 | 891 |

Migration Complete

892 |

The migration has completed successfully. Below is a list of migrated documents:

893 |
    894 | 895 |
  • 896 | 897 |
  • 898 |
    899 |
900 |
901 | 902 |

Migration Errors

903 |

The migration has run into errors. Some files may have uploaded successfully and others not. Please check your Zenodo profile. 904 | Please email ewg4xuva [at] gmail {.} com with a description of your upload process. If you have a Github profile, please create 905 | an issue here.

906 |
907 | 908 | 909 |
910 | 911 | Alert: This XForms engine does not support JSON processing.
912 |
913 |
914 |
915 |
916 |
917 |
918 | 919 | 920 | 921 | -------------------------------------------------------------------------------- /page-flow.xml: -------------------------------------------------------------------------------- 1 | 2 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /script/post-file.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /script/scrape.php: -------------------------------------------------------------------------------- 1 | openURI('php://output'); 24 | $writer->startDocument('1.0','UTF-8'); 25 | $writer->setIndent(true); 26 | $writer->setIndentString(" "); 27 | 28 | //validate URI 29 | if (preg_match('/https?:\/\/[^\.]+\.academia.edu\/[A-Za-z]+/', $uri)){ 30 | //initiate curl 31 | $ch = curl_init(); 32 | curl_setopt($ch, CURLOPT_URL, $uri); 33 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 34 | $output = curl_exec($ch); 35 | 36 | if(curl_exec($ch) !== FALSE) { 37 | process_html($output, $writer); 38 | } 39 | else { 40 | $writer->startElement('response'); 41 | $writer->writeElement('error', 'Unable to retrieve data from Academia.edu URI.'); 42 | $writer->endElement(); 43 | } 44 | 45 | curl_close($ch); 46 | } else { 47 | $writer->startElement('response'); 48 | $writer->writeElement('error', 'URI does not validate.'); 49 | $writer->endElement(); 50 | } 51 | 52 | function process_html($output, $writer) { 53 | //get creator metadata 54 | preg_match('/\.User\.set_viewed\((.*)\);\n/', $output, $matches); 55 | $ids = array(); 56 | 57 | if (isset($matches[1])){ 58 | $user = json_decode(trim($matches[1])); 59 | 60 | $userId = $user->id; 61 | $userName = $user->display_name; 62 | $url = $user->url; 63 | 64 | //process works 65 | preg_match_all('/workJSON:\s?(.*),\n/', $output, $works); 66 | 67 | 68 | $count = 0; 69 | $writer->startElement('response'); 70 | $writer->writeAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance'); 71 | $writer->writeElement('id', $userId); 72 | $writer->writeElement('name', $userName); 73 | $writer->writeElement('url', $url); 74 | if (isset($works[1])){ 75 | $writer->startElement('records'); 76 | foreach ($works[1] as $work){ 77 | $obj = json_decode(trim($work)); 78 | //only gather those papers where the owner_id is the current user id. 79 | 80 | //Note: 17 Feb - gather all publications, including those in which the current user is not owner (tagged co-author) 81 | //$obj->owner_id == $userId && 82 | if (!in_array($obj->id, $ids)) { 83 | //only process papers, etc. that have associated document/presentation files 84 | if ($obj->attachments) { 85 | //add id into array of ids to prevent processing of duplicates in a page 86 | $ids[] = $obj->id; 87 | //gather metadata 88 | $metadata = $obj->metadata; 89 | 90 | //begin record metadata 91 | $writer->startElement('record'); 92 | 93 | //by default, set migrate to boolean(true) to enable file upload and document migration 94 | $writer->writeAttribute('migrate', 'true'); 95 | $writer->writeElement('id', $obj->id); 96 | $writer->writeElement('title', $obj->title); 97 | $writer->writeElement('url', $obj->internal_url); 98 | $writer->writeElement('access_right', 'open'); 99 | $writer->writeElement('license', 'cc-by'); 100 | 101 | if (isset($obj->section)){ 102 | if ($obj->section == 'Papers'){ 103 | $writer->writeElement('upload_type', 'publication'); 104 | 105 | //if there are conference dates, then automatically set the publication_type as 'conferencepaper', othewise assume 106 | //it is an article 107 | if (isset($metadata->conference_start_date) || isset($metadata->conference_end_date)){ 108 | $writer->writeElement('publication_type', 'conferencepaper'); 109 | } else { 110 | $writer->writeElement('publication_type', 'article'); 111 | } 112 | } else if ($obj->section == 'Talks'){ 113 | $writer->writeElement('upload_type', 'presentation'); 114 | } 115 | } else { 116 | //set defaults if there is no section 117 | $writer->writeElement('upload_type', 'publication'); 118 | if (isset($metadata->conference_start_date) || isset($metadata->conference_end_date)){ 119 | $writer->writeElement('publication_type', 'conferencepaper'); 120 | } else { 121 | $writer->writeElement('publication_type', 'article'); 122 | } 123 | } 124 | 125 | //description is mandator, extract from academia abstract when possible, otherwise create blank element 126 | if (isset($metadata->abstract)){ 127 | $writer->writeElement('description', preg_replace( "/\r|\n/", "", $metadata->abstract)); 128 | } else { 129 | $writer->writeElement('description'); 130 | } 131 | 132 | //publication date is mandatory 133 | if (isset($metadata->publication_date)){ 134 | foreach ($metadata->publication_date as $k=>$v){ 135 | if ($k != 'errors'){ 136 | if (is_int($v)){ 137 | $writer->writeElement('publication_' . $k, $v); 138 | } else { 139 | $writer->writeElement('publication_' . $k, ''); 140 | } 141 | } 142 | } 143 | } else { 144 | $writer->writeElement('publication_day'); 145 | $writer->writeElement('publication_month'); 146 | $writer->writeElement('publication_year'); 147 | } 148 | 149 | //write empty publication_date element, to be manipulated in the XForms engine 150 | $writer->writeElement('publication_date'); 151 | $writer->writeElement('publication_date_valid', 'false'); 152 | 153 | if (isset($metadata->conference_start_date) || isset($metadata->conference_end_date)){ 154 | $date = ''; 155 | $date .= normalize_date($metadata->conference_start_date); 156 | if (isset($metadata->conference_start_date)){ 157 | $date .= ' - '; 158 | } 159 | $date .= normalize_date($metadata->conference_end_date); 160 | 161 | if (isset($date)){ 162 | $writer->writeElement('conference_dates', $date); 163 | } 164 | 165 | //extract journal title, publication name, or organization as the conference title 166 | if (isset($metadata->journal_name)){ 167 | $writer->writeElement('conference_title', $metadata->journal_name); 168 | } else if (isset($metadata->organization)){ 169 | $writer->writeElement('conference_title', $metadata->organization); 170 | } else if (isset($metadata->publication_name)){ 171 | $writer->writeElement('conference_title', $metadata->publication_name); 172 | } 173 | } 174 | 175 | //assume location is the conference location 176 | if (isset($metadata->location)){ 177 | //insert mandatory conference title if there's a location, but no conference dates 178 | if (!isset($metadata->conference_start_date) == 0 && !isset($metadata->conference_end_date)){ 179 | $writer->writeElement('conference_title', ''); 180 | } 181 | 182 | $writer->writeElement('conference_place', $metadata->location); 183 | } 184 | 185 | //insert journal title if conference dates are not used 186 | if (!isset($metadata->conference_start_date) && !isset($metadata->conference_end_date)){ 187 | if (isset($metadata->journal_name)){ 188 | $writer->writeElement('journal_title', $metadata->journal_name); 189 | } else if (isset($metadata->publication_name)){ 190 | $writer->writeElement('journal_title', $metadata->publication_name); 191 | } 192 | } 193 | 194 | //begin creators 195 | $writer->startElement('creators'); 196 | //insert creator for self 197 | $writer->startElement('creator'); 198 | if (isset($user->department->university->name)){ 199 | $writer->writeAttribute('affiliation', $user->department->university->name); 200 | } 201 | $writer->text($userName); 202 | $writer->endElement(); 203 | 204 | //list co-authors 205 | if (is_array($obj->co_author_tags)){ 206 | foreach ($obj->co_author_tags as $creator){ 207 | $writer->startElement('creator'); 208 | $writer->writeAttribute('affiliation', $creator->affiliation); 209 | $writer->text($creator->name); 210 | $writer->endElement(); 211 | } 212 | } 213 | 214 | //end creators 215 | $writer->endElement(); 216 | 217 | //keywords 218 | if ($obj->research_interests){ 219 | $writer->startElement('keywords'); 220 | foreach ($obj->research_interests as $keyword){ 221 | $writer->writeElement('keyword', $keyword->name); 222 | } 223 | $writer->endElement(); 224 | } 225 | 226 | //create file element 227 | $writer->startElement('file'); 228 | $writer->writeAttribute('xsi:type', 'xs:anyURI'); 229 | $writer->writeAttribute('filename', ''); 230 | $writer->writeAttribute('mediatype', ''); 231 | $writer->writeAttribute('size'); 232 | $writer->writeAttribute('encoded_filename', ''); 233 | $writer->writeAttribute('filename_valid', 'false'); 234 | $writer->endElement(); 235 | 236 | //end individual record 237 | $writer->endElement(); 238 | } 239 | } 240 | $count++; 241 | } 242 | //end records 243 | $writer->endElement(); 244 | } else { 245 | $writer->writeElement('error', 'No works associated with this user id were parsed.'); 246 | } 247 | 248 | //end response 249 | $writer->endElement(); 250 | 251 | //var_dump($obj); 252 | } else { 253 | $writer->startElement('response'); 254 | $writer->writeElement('error', 'Unable to parse creator metadata to extract user id.'); 255 | $writer->endElement(); 256 | } 257 | } 258 | 259 | //accept year, month, day integer values and return a human readable date 260 | function normalize_date($date){ 261 | $string = ''; 262 | if (is_int($date->day)){ 263 | $string .= $date->day; 264 | } 265 | 266 | if (is_int($date->month)){ 267 | if (is_int($date->day)) { 268 | $string .= ' '; 269 | } 270 | switch ($date->month){ 271 | case 1: 272 | $string .= 'January'; 273 | break; 274 | case 2: 275 | $string .= 'February'; 276 | break; 277 | case 3: 278 | $string .= 'March'; 279 | break; 280 | case 4: 281 | $string .= 'April'; 282 | break; 283 | case 5: 284 | $string .= 'May'; 285 | break; 286 | case 6: 287 | $string .= 'June'; 288 | break; 289 | case 7: 290 | $string .= 'July'; 291 | break; 292 | case 8: 293 | $string .= 'August'; 294 | break; 295 | case 9: 296 | $string .= 'September'; 297 | break; 298 | case 10: 299 | $string .= 'October'; 300 | break; 301 | case 11: 302 | $string .= 'November'; 303 | break; 304 | case 12: 305 | $string .= 'December'; 306 | break; 307 | } 308 | } 309 | 310 | if (is_int($date->year)){ 311 | $string .= (is_int($date->month) || is_int($date->day) ? ' ' : '') . $date->year; 312 | } 313 | 314 | return $string; 315 | } 316 | 317 | //$writer->endElement(); 318 | //echo $output; 319 | 320 | ?> -------------------------------------------------------------------------------- /xpl/delete-file.xpl: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | application/xml 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /xpl/move-file.xpl: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | application/xml 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /xpl/post-file.xpl: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | /request 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | http://localhost/cgi-bin/post-file.php 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | text 45 | application/json 46 | utf-8 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /xpl/scrape.xpl: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | /request 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | http://localhost/cgi-bin/scrape.php 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | application/xml 41 | utf-8 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /xpl/test-json.xpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | {"test":true} 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | application/json 30 | utf-8 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /xpl/xml-to-json.xpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /xslt/xml-to-json.xsl: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | _ 26 | json 27 | 28 | 29 | 30 | 31 | 32 | object 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | <_> 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | <_ type="object"> 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 72 | 73 | 74 | 75 | 76 | 77 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | --------------------------------------------------------------------------------