pyCEURmake API Documentation
ceur_ws
Conference
Bases: JSONAble
Represents a conference
Source code in ceurws/ceur_ws.py
778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 | |
getSamples()
staticmethod
get sample records of the entity
Source code in ceurws/ceur_ws.py
783 784 785 786 787 788 789 790 791 792 793 794 795 796 | |
ConferenceManager
Bases: EntityManager, JSONAbleList
Contains multiple ceurws sessions
Source code in ceurws/ceur_ws.py
799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 | |
Editor
Bases: JSONAble
Represents a volume editor
Source code in ceurws/ceur_ws.py
729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 | |
getSamples()
staticmethod
get sample records of the entity
Source code in ceurws/ceur_ws.py
734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 | |
EditorManager
Bases: EntityManager, JSONAbleList
Contains multiple ceurws editors
Source code in ceurws/ceur_ws.py
760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 | |
Paper
Bases: JSONAble
Represents a paper
Source code in ceurws/ceur_ws.py
543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 | |
__str__()
return my string representation
Returns:
| Name | Type | Description |
|---|---|---|
str |
my text representation |
Source code in ceurws/ceur_ws.py
617 618 619 620 621 622 623 624 625 | |
getSamples()
staticmethod
get sample records of the entity
Source code in ceurws/ceur_ws.py
567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 | |
PaperManager
Bases: EntityManager, JSONAbleList
Contains multiple ceurws papers
Source code in ceurws/ceur_ws.py
628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 | |
Session
Bases: JSONAble
Represents a session in ceur-ws
Source code in ceurws/ceur_ws.py
650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 | |
__init__(id, title, position, papers)
constructor
Source code in ceurws/ceur_ws.py
655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 | |
getSamples()
staticmethod
get sample records of the entity
Source code in ceurws/ceur_ws.py
671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 | |
SessionManager
Bases: EntityManager, JSONAbleList
Contains multiple ceurws sessions
Source code in ceurws/ceur_ws.py
710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 | |
Volume
Bases: JSONAble
Represents a volume in ceur-ws
Source code in ceurws/ceur_ws.py
21 22 23 24 25 26 27 28 29 30 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 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 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 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 | |
papers
property
papers of this volume
sessions
property
writable
sessions of this volume
__init__(number=None, url=None, title=None, fullTitle=None, acronym=None, lang=None, location=None, country=None, countryWikidataId=None, region=None, city=None, cityWikidataId=None, ordinal=None, date=None, dateFrom=None, dateTo=None, pubYear=None, pubDate=None, submitDate=None, valid=True, conference=None, editors=None, sessions=None, virtualEvent=False, submittedBy=None)
constructor
Source code in ceurws/ceur_ws.py
26 27 28 29 30 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 70 71 72 73 74 75 76 77 78 79 80 81 | |
extractAndSetLocation(locationStr)
Extracts the location from the given string and returns the found city and country ToDo: Once the EventReferenceParser from cc is updated to support city country combinations switch to it Args: locationStr: string to extract the locations from
Source code in ceurws/ceur_ws.py
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 | |
extractDates(dateStr, durationThreshold=11)
" Extracts the start and end time from the given string optimized for the format of the loctime property Args: dateStr: string to extract the dates from durationThreshold: number of days allowed between two extracted dates
Source code in ceurws/ceur_ws.py
231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 | |
extractValuesFromVolumePage(timeout=3)
extract values from the given volume page
Source code in ceurws/ceur_ws.py
363 364 365 366 367 368 369 370 371 372 373 374 | |
getSubmittingEditor()
Returns the Editor that submitted the volume
Source code in ceurws/ceur_ws.py
376 377 378 379 380 381 382 383 384 385 386 | |
getVolumeNumber()
get number of the volume
Source code in ceurws/ceur_ws.py
112 113 114 115 116 117 | |
getVolumeUrl()
get the url of the volume page
Source code in ceurws/ceur_ws.py
119 120 121 122 123 124 125 126 127 | |
getVolumeUrlOf(number)
staticmethod
get the volume url of the given volume number Args: number: volume number
Source code in ceurws/ceur_ws.py
129 130 131 132 133 134 135 136 137 138 139 140 141 | |
get_loctime()
get the loctime
Source code in ceurws/ceur_ws.py
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | |
isVirtualEvent()
Returns True if the event is a virtual event
Source code in ceurws/ceur_ws.py
143 144 145 146 147 | |
normalize()
Tries to normalize the properties e.g. breaking loctime into designated location and time properties Example: 'Vienna, Austria, July 25th, 2022'
Source code in ceurws/ceur_ws.py
149 150 151 152 153 154 | |
rankLocations(locationStr, locations)
staticmethod
rank the given locations to find the best match to the given location string Args: locationStr: location string locations: list of locations objects
Source code in ceurws/ceur_ws.py
308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 | |
removePartsMatching(value, pattern, separator=',')
staticmethod
Removes parts from the given value matching the pattern
Source code in ceurws/ceur_ws.py
295 296 297 298 299 300 301 302 303 304 305 306 | |
resolveLoctime()
Resolve the loctime property by breaking it down to city, region, country, dateFrom, and dateTo
Source code in ceurws/ceur_ws.py
175 176 177 178 179 180 181 182 183 184 185 186 187 | |
VolumeManager
Bases: EntityManager, JSONAbleList
Contains multiple ceurws volumes
Source code in ceurws/ceur_ws.py
389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 | |
getIndexHtml(force=False)
get the index html
Source code in ceurws/ceur_ws.py
526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 | |
load()
load the volumeManager
Source code in ceurws/ceur_ws.py
408 409 410 411 412 413 414 415 416 | |
loadFromBackup()
load from the SQLITE Cache file
Source code in ceurws/ceur_ws.py
418 419 420 421 422 | |
loadFromIndexHtml(parser_config=None, vol_limit=None)
load my content from the index.html file
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parser_config
|
ParserConfig
|
the parser Configuration to use |
None
|
Source code in ceurws/ceur_ws.py
502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 | |
recreate(parser_config)
recreate me by a full parse of all volume files
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parser_config
|
ParserConfig
|
parser configuration |
required |
Source code in ceurws/ceur_ws.py
439 440 441 442 443 444 445 446 447 | |
update(parser_config)
update me by a checking for recently added volumes
Source code in ceurws/ceur_ws.py
424 425 426 427 428 429 | |
update_or_recreate(parser_config)
recreate or update me by parsing the index.html file
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parser_config
|
ParserConfig
|
parser configuration |
required |
Source code in ceurws/ceur_ws.py
449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 | |
ceur_ws_web_cmd
Created on 2024-02-22
@author: wf
CeurWsCmd
Bases: WebserverCmd
command line handling for CEUR-WS Volume browser
Source code in ceurws/ceur_ws_web_cmd.py
22 23 24 25 26 27 28 29 30 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 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 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 | |
__init__()
constructor
Source code in ceurws/ceur_ws_web_cmd.py
27 28 29 30 31 32 33 | |
getArgParser(description, version_msg)
override the default argparser call
Source code in ceurws/ceur_ws_web_cmd.py
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 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | |
handle_args(args)
handle the command line arguments
Source code in ceurws/ceur_ws_web_cmd.py
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 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 | |
main(argv=None)
main call
Source code in ceurws/ceur_ws_web_cmd.py
151 152 153 154 155 156 157 | |
config
CEURWS
CEUR-WS
Source code in ceurws/config.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | |
get_home_path()
staticmethod
Get home path
Source code in ceurws/config.py
13 14 15 16 17 18 19 20 21 | |
make_sparql(endpoint_url, method='POST', agent=None, calls_per_minute=None)
Build a :class:lodstorage.sparql.SPARQL client with a proper UA
and rate-limit, avoiding the 403 response that Wikimedia returns for
the default urllib User-Agent.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
endpoint_url
|
str
|
SPARQL endpoint URL. |
required |
method
|
str
|
HTTP method, default |
'POST'
|
agent
|
str | None
|
optional UA override; defaults to :data: |
None
|
calls_per_minute
|
int | None
|
optional rate-limit override; defaults to
:data: |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
Configured |
SPARQL
|
class: |
Source code in ceurws/config.py
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 | |
dblp
Created on 2024-03-09
@author: wf
DblpAuthorIdentifier
dataclass
represents an author id available in dblp and the corresponding property in wikidata
Source code in ceurws/dblp.py
435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 | |
all()
classmethod
returns all available identifiers
Source code in ceurws/dblp.py
446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 | |
getAllAsMap()
classmethod
return all all available identifiers as map
Source code in ceurws/dblp.py
474 475 476 477 478 479 480 481 482 | |
getWikidataIdQueryPart(id_name, value, var)
classmethod
Generates for the given identifier the wikidata query Args: id_name: name of the identifier value: the identifier value var: name of the variable which should have the id
Source code in ceurws/dblp.py
484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 | |
DblpAuthors
Bases: DblpManager
Manage all authors of DBLP indexed volumes.
Source code in ceurws/dblp.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | |
load(force_query=False)
load my authors
Source code in ceurws/dblp.py
64 65 66 67 68 69 70 71 72 73 74 | |
DblpEditors
Bases: DblpManager
Manage all editors of DBLP indexed volumes.
Source code in ceurws/dblp.py
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | |
load(force_query=False)
load my editors
Source code in ceurws/dblp.py
86 87 88 89 90 91 92 93 94 95 96 | |
DblpEndpoint
provides queries and a dblp endpoint to execute them
Source code in ceurws/dblp.py
212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 | |
__init__(endpoint, debug=False)
constructor
Source code in ceurws/dblp.py
220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 | |
convertEntityIdToUrlId(entityId)
Convert the given entityId to the id used in the url Note: use with care this conversion does not always work Args: entityId: id of the entity Example: conf/aaai/2022 → conf/aaai/aaai2022
Returns str - id used in the url None - if the given entityId can not be converted
Source code in ceurws/dblp.py
349 350 351 352 353 354 355 356 357 358 359 360 361 362 | |
getDblpIdByVolumeNumber(number)
Get the dblp entity id by given volume number Args: number: volume number
Source code in ceurws/dblp.py
304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 | |
getDblpUrlByDblpId(entityId=None)
Get the dblp url for given entity id Args: entityId: volume url
Source code in ceurws/dblp.py
327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 | |
getEditorsOfVolume(number)
Get the editors for the given volume number Args: number: number of the volume if none query for all ceur-ws editors
Returns:
| Type | Description |
|---|---|
list[dict]
|
list of dictionaries where a dict represents one editor containing all identifiers of the editor |
Source code in ceurws/dblp.py
383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 | |
get_ceur_proceeding(volume_number)
get ceur proceeding by volume number from dblp Args: volume_number: number of the volume
Source code in ceurws/dblp.py
294 295 296 297 298 299 300 301 302 | |
get_ceur_volume_papers(volume_number)
Get all papers published in CEUR-WS from dblp
Source code in ceurws/dblp.py
285 286 287 288 289 290 291 292 | |
get_lod(cache_name, query_name, force_query=False)
Get the list of dictionaries for the given cache and query names, optionally forcing a query.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cache_name
|
str
|
The name of the cache to load or store the LOD. |
required |
query_name
|
str
|
The name of the query to execute if the data is not cached or forced to query. |
required |
force_query
|
bool
|
If True, forces the query execution even if the data is cached. Defaults to False. |
False
|
Returns:
| Type | Description |
|---|---|
list
|
List[Dict]: The list of dictionaries loaded either from cache or by executing the SPARQL query. |
Source code in ceurws/dblp.py
251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 | |
load_all(force_query=False)
load all managers
Source code in ceurws/dblp.py
244 245 246 247 248 249 | |
toDblpUrl(entityId, withPostfix=False)
Convert the given id to the corresponding dblp url Args: entityId: dblp event id withPostfix: If True add the postfix ".html"
Returns:
| Type | Description |
|---|---|
str | None
|
dblp url of None if the url can not be generated for the given input |
Source code in ceurws/dblp.py
364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 | |
DblpManager
Manage DBLP entities.
Attributes:
| Name | Type | Description |
|---|---|---|
endpoint |
DblpEndpoint
|
The endpoint for DBLP queries. |
cache_name |
str
|
The name of the cache to use. |
query_name |
str
|
The name of the query to execute. |
Source code in ceurws/dblp.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | |
__init__(endpoint, cache_name, query_name)
Initializes the DBLP Manager with the given endpoint, cache name, and query name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
endpoint
|
DblpEndpoint
|
The endpoint for DBLP queries. |
required |
cache_name
|
str
|
The name of the cache to use. |
required |
query_name
|
str
|
The name of the query to execute. |
required |
Source code in ceurws/dblp.py
32 33 34 35 36 37 38 39 40 41 42 43 | |
load(force_query=False)
Loads a list of dictionaries from the DBLP endpoint.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
force_query
|
bool
|
If True, forces a new query to the endpoint. Defaults to False. |
False
|
Source code in ceurws/dblp.py
45 46 47 48 49 50 51 52 | |
DblpPapers
Bases: DblpManager
manage all CEUR-WS papers indexed by dblp
Source code in ceurws/dblp.py
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 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 | |
load(force_query=False)
load my editors
Source code in ceurws/dblp.py
111 112 113 114 115 116 117 118 119 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 | |
DblpVolumes
Bases: DblpManager
Manage all DBLP indexed volumes.
Source code in ceurws/dblp.py
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 | |
load(force_query=False)
load my volumes
Source code in ceurws/dblp.py
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 | |
indexparser
Created on 11.08.2022
@author: wf
IndexHtmlParser
Bases: Textparser
CEUR-WS Index.html parser
Source code in ceurws/indexparser.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 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 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 | |
__init__(htmlText, config=None)
Constructor
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
htmlText
|
str
|
the HTML text of the index page |
required |
Source code in ceurws/indexparser.py
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | |
find(startLine, compiledPattern, step=1)
find the next line with the given compiled regular expression pattern
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
startLine
|
int
|
index of the line to start search |
required |
compiledPattern
|
Pattern
|
the compiled regular expression pattern to search for |
required |
step
|
int
|
the steps to take e.g. +1 for forward -1 for backwards |
1
|
Return
int: the line number of the line or None if nothing was found
Source code in ceurws/indexparser.py
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | |
findVolume(volCount, startLine, expectedTr=3, progress=10)
find Volume lines from the given startLine
Parameters:
| Name | Type | Description | Default | ||||
|---|---|---|---|---|---|---|---|
volCount
|
int
|
the volumeCount before the startLine |
required | ||||
startLine
|
int
|
index of the line to search |
required | ||||
expectedTr
|
int
|
number of
|
3
|
progress
|
int
|
how often to show the progress
|
10
|
Returns:
| Type | Description |
|---|---|
tuple[int | None, int | None]
|
endLine of the volume html or None |
Source code in ceurws/indexparser.py
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | |
getInfo(volume, info, pattern, line)
get the info for the given patterns trying to match the pattern on the given line
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
volume
|
dict
|
the result dict |
required |
info
|
str
|
the name of the dict key to fill |
required |
pattern
|
regexp
|
the regular expression to check |
required |
line
|
str
|
the line to check |
required |
Source code in ceurws/indexparser.py
229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 | |
parse(vol_limit=None)
parse my html code for Volume info
Source code in ceurws/indexparser.py
311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 | |
parseVolume(volCount, fromLine, toLine, verbose)
parse a volume from the given line range
Source code in ceurws/indexparser.py
271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 | |
setSeeAlsoVolumes(volume, firstLine, lastLine)
Extract and set the volume numbers form the see also list Example result {"seealso": ["Vol-3067"]}
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
volume
|
dict
|
the volumeRecord to modify |
required |
lineIndex
|
where to start setting the volumeTitle |
required |
Source code in ceurws/indexparser.py
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | |
setVolumeName(volume, line)
set the volume name
Source code in ceurws/indexparser.py
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | |
setVolumeNumber(volume, href)
set the volumen number
Source code in ceurws/indexparser.py
142 143 144 145 146 147 148 149 150 | |
setVolumeTitle(volume, lineIndex)
set the volume title
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
volume
|
dict
|
the volumeRecord to modify |
required |
lineIndex
|
int
|
where to start setting the volumeTitle |
required |
Source code in ceurws/indexparser.py
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 | |
ParserConfig
parser configuration
Source code in ceurws/indexparser.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | |
__init__(progress_bar=None, down_to_volume=1, force_download=False, verbose=False, debug=False)
Initializes the ParserConfig with a progress bar, volume threshold, and debug mode setting.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
progress_bar
|
An instance of a Progressbar class to be used for showing progress during parsing. |
required | |
down_to_volume
|
int
|
The volume threshold for parsing. Only volumes equal to or less than this value will be considered. Defaults to 1. |
1
|
force_download
|
bool
|
if True download the file to parse |
False
|
verbose
|
bool
|
if True give verbose feedback |
False
|
debug
|
bool
|
Indicates whether debugging mode is enabled. If True, additional debug information will be provided during parsing. Defaults to False. |
False
|
Source code in ceurws/indexparser.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | |
location
Created on 2023-07-15
@author: wf
LocationLookup
Class for location lookup.
Source code in ceurws/location.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 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 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | |
__init__()
Constructor for LocationLookup.
Source code in ceurws/location.py
41 42 43 44 45 46 47 48 49 | |
getCityByWikiDataId(wikidataID)
Get the city for the given wikidataID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wikidataID
|
str
|
The wikidata ID. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
City |
The city with the given wikidataID. |
Source code in ceurws/location.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | |
initPredefinedLocations()
classmethod
Initialize predefined locations.
Source code in ceurws/location.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | |
lookup(locationText, logFile=sys.stdout)
Lookup a location based on the given locationText.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
locationText
|
str
|
The location to lookup. |
required |
logFile
|
file
|
The log file to write the output. |
stdout
|
Returns:
| Name | Type | Description |
|---|---|---|
City |
The located city based on the locationText. |
Source code in ceurws/location.py
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | |
lookupGeograpy(locationText)
Lookup the given location by the given locationText.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
locationText
|
str
|
The location to lookup. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
City |
The located city based on the locationText. |
Source code in ceurws/location.py
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | |
lookupNominatim(locationText)
Lookup the location for the given locationText (if any).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
locationText
|
str
|
The location text to search for. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
City |
The location found by Nominatim. |
Source code in ceurws/location.py
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | |
loctime
Created on 2023-12-22
@author: wf
LoctimeParser
A parser class for handling loctime lookups. This class provides methods to load, parse, and update loctime data using a dictionary of dictionaries structure.
Attributes:
| Name | Type | Description |
|---|---|---|
filepath |
str
|
The file path to the loctime YAML configuration. |
lookups |
dict
|
The loaded lookup dictionaries from the YAML file. |
multi_word |
dict
|
A dictionary to handle multi-word keys. |
multi_word_lookups |
dict
|
A version of lookups with keys as concatenated words. |
counters |
dict
|
A dictionary of Counter objects for various categories. |
year_pattern |
Pattern
|
A compiled regex pattern to match 4-digit years. |
total_loctimes |
int
|
The total count of processed loctimes. |
Source code in ceurws/loctime.py
18 19 20 21 22 23 24 25 26 27 28 29 30 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 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 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 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 | |
__init__(filepath=None)
Initializes the LoctimeParser object, setting up paths, loading lookups, and initializing counters and patterns.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filepath
|
Path
|
The path to the loctime YAML file. Defaults to a predefined path if None is provided. |
None
|
Raises: FileNotFoundError: Raises an error if the specified YAML file does not exist.
Source code in ceurws/loctime.py
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 | |
create_pareto_analysis(level=3, outof=5)
Creates a Pareto analysis for each category in the lookups and returns the percentage table for the distribution across the specified levels.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
level
|
int
|
The number of segments to divide the data into within the top "outof" parts. |
3
|
outof
|
int
|
1 out of n value e.g. on level 1 we have 1:5 which leads to the original pareto 80:20 percent rule, on level 2 we have 80:(20=16:4) percent which is equivalent to 80/96 thresholds percent on level 3 we have 80:(20=16:4=(3.2:0.8) percent which leads to 80%,96%,99.2% thresholds |
5
|
Source code in ceurws/loctime.py
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 | |
get_parts(loctime)
Splits the loctime string into parts and subparts, considering multi-word entries.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
loctime
|
str
|
The loctime string to split. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
list |
A list of parts and subparts. |
Source code in ceurws/loctime.py
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | |
load()
Loads the lookup data from the YAML file specified by the filepath attribute.
This method attempts to open and read the YAML file, converting its contents into a dictionary. If the file is empty or does not exist, it returns an empty dictionary.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
A dictionary representing the loaded data from the YAML file. If the file is empty or non-existent, an empty dictionary is returned. |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If the specified file does not exist. |
YAMLError
|
If there is an error parsing the YAML file. |
Source code in ceurws/loctime.py
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | |
parse(loctime)
Alternative parse of CEUR-WS loctimes using lookups
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
loctime
|
str
|
The loctime string to parse. |
required |
Source code in ceurws/loctime.py
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | |
save()
Saves the current lookup dictionary to a YAML file.
Source code in ceurws/loctime.py
102 103 104 105 106 107 108 109 110 111 112 113 | |
setup()
Prepares the parser by initializing multi-word handling and creating a modified version of the lookup dictionaries with keys as concatenated words. This method sets up the 'multi_word' and 'multi_word_lookups' dictionaries to facilitate the parsing process, especially for multi-word keys.
Source code in ceurws/loctime.py
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | |
update_lookup_counts()
to be called ffter processing all loctimes and updating counters update lookup dicts with new counts
Source code in ceurws/loctime.py
178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | |
PercentageTable
A class for creating a table that displays values and their corresponding percentages of a total.
Attributes:
| Name | Type | Description |
|---|---|---|
total |
float
|
The total value used for calculating percentages. |
column_title |
str
|
The title for the first column in the table. |
digits |
int
|
The number of decimal places for rounding percentages. |
rows |
list
|
A list of dictionaries representing rows in the table. |
Source code in ceurws/loctime.py
247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 | |
__init__(column_title, total, digits)
Initializes the PercentageTable with a title for the column, a total value, and specified precision for percentages.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
column_title
|
str
|
The title for the first column. |
required |
total
|
float
|
The total value for calculating percentages. |
required |
digits
|
int
|
The precision for percentage values. |
required |
Source code in ceurws/loctime.py
258 259 260 261 262 263 264 265 266 267 268 269 270 271 | |
add_value(row_title, value)
Adds a row to the table with the given title and value, calculating the percentage of the total.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
row_title
|
str
|
The title for the row. |
required |
value
|
float
|
The value for the row, which is used to calculate its percentage of the total. |
required |
Source code in ceurws/loctime.py
273 274 275 276 277 278 279 280 281 282 | |
generate_table(tablefmt='grid')
Generates a string representation of the table using the tabulate library.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The string representation of the table with headers and formatted rows. |
Source code in ceurws/loctime.py
284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 | |
models
ceur
Created on 2024-03-17
CEUR Workshop Proceedings (CEUR-WS.org)
Metamodel @author: wf
Paper
Bases: SQLModel
Represents a paper with details such as authors, volume number, and title.
Source code in ceurws/models/ceur.py
60 61 62 63 64 65 66 67 68 69 70 71 72 | |
Volume
Bases: SQLModel
a single CEUR-WS Volume
Source code in ceurws/models/ceur.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 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 | |
dblp
Created on 2023 @author: Tim Holzheim
refactored 2024-03-09 by wf
DblpPaper
a paper indexed by dblp.org
Source code in ceurws/models/dblp.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | |
DblpProceeding
a proceeding indexed by dblp.org
Source code in ceurws/models/dblp.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | |
DblpScholar
a scholar indexed by dblp.org
example: Tim Berners-Lee https://dblp.org/pid/b/TimBernersLee.html
Source code in ceurws/models/dblp.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | |
namedqueries
Created on 2023-03-21
@author: wf
NamedQueries
get named queries
Source code in ceurws/namedqueries.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 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 70 71 72 73 74 | |
__init__(wikiId='cr')
Source code in ceurws/namedqueries.py
17 18 19 20 21 22 23 24 | |
query()
run query
Source code in ceurws/namedqueries.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | |
toQueryManager()
convert me to a QueryManager
Source code in ceurws/namedqueries.py
47 48 49 50 51 52 53 54 55 56 57 58 59 | |
papertocparser
Created on 2023-03-22
@author: wf
PaperTocParser
Bases: Textparser
parser for paper table of contents
Source code in ceurws/papertocparser.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 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 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | |
__init__(number, soup, debug=False)
constructor
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
number
|
str
|
the volume number |
required |
soup
|
BeautifulSoup
|
the parser input |
required |
debug
|
bool
|
if True print out debug info |
False
|
Source code in ceurws/papertocparser.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | |
parsePapers()
parse the toc to papers
Source code in ceurws/papertocparser.py
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | |
sql_cache
Created on 2024-03-16 @author: wf
Cached
Manage cached entities.
Source code in ceurws/sql_cache.py
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 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 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 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | |
__init__(clazz, sparql, sql_db, query_name, max_errors=0, debug=False)
Initializes the Manager with class reference, SPARQL endpoint URL, SQL database connection string, query name, and an optional debug flag. Args: clazz (type[Any]): The class reference for the type of objects managed by this manager. sparql (SPARQL): a SPARQL endpoint. sql_db (SqlDB): SQL database object query_name (str): The name of the query to be executed. debug (bool, optional): Flag to enable debug mode. Defaults to False.
Source code in ceurws/sql_cache.py
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 | |
check_local_cache()
Checks if there is data in the local cache (SQL database).
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if there is at least one record in the local SQL cache table |
Source code in ceurws/sql_cache.py
87 88 89 90 91 92 93 94 95 96 | |
fetch_from_local()
Fetches data from the local SQL database.
Source code in ceurws/sql_cache.py
98 99 100 101 102 103 104 105 106 107 108 | |
fetch_or_query(qm, force_query=False)
Fetches data from the local cache if available. If the data is not in the cache or if force_query is True, it queries via SPARQL and caches the results.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
qm
|
QueryManager
|
The query manager object used for making SPARQL queries. |
required |
force_query
|
bool
|
A flag to force querying via SPARQL even if the data exists in the local cache. Defaults to False. |
False
|
Source code in ceurws/sql_cache.py
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | |
get_lod(qm)
Fetches data using the SPARQL query specified by my query_name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
qm
|
QueryManager
|
The query manager object used for making SPARQL queries. |
required |
Returns: list[dict]: A list of dictionaries representing the data fetched.
Source code in ceurws/sql_cache.py
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | |
store(max_errors=None)
Stores the fetched data into the local SQL database.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_errors
|
int
|
Maximum allowed validation errors. Defaults to 0. |
None
|
Returns: list[Any]: A list of entity instances that were stored in the database.
Source code in ceurws/sql_cache.py
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | |
to_entities(max_errors=None)
Converts records fetched from the LOD into entity instances, applying validation. Args: max_errors (int, optional): Maximum allowed validation errors. Defaults to 0. Returns: list[Any]: A list of entity instances that have passed validation.
Source code in ceurws/sql_cache.py
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 | |
SqlDB
general SQL database
Source code in ceurws/sql_cache.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | |
get_session()
Provide a session for database operations.
Returns:
| Name | Type | Description |
|---|---|---|
Session |
Session
|
A SQLAlchemy Session object bound to the engine for database operations. |
Source code in ceurws/sql_cache.py
25 26 27 28 29 30 31 32 | |
textparser
Created on 2022-08-15
@author: wf
Textparser
general text parser
Source code in ceurws/textparser.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 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 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | |
__init__(debug)
Constructor
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
debug
|
bool
|
if TRUE switch debugging on |
required |
Source code in ceurws/textparser.py
15 16 17 18 19 20 21 22 | |
getMatch(pattern, text, groupNo=1)
get the match for the given regular expression for the given text returning the given group number
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
regexp
|
str
|
the regular expression to check |
required |
text
|
str
|
the text to check |
required |
groupNo
|
int
|
the number of the regular expression group to return |
1
|
Returns:
| Name | Type | Description |
|---|---|---|
str |
the matching result or None if no match was found |
Source code in ceurws/textparser.py
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | |
hasValue(d, key)
check that the given attribute in the given dict is available and not none
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
d
|
dict
|
the dict |
required |
key
|
str
|
the key |
required |
Returns:
| Name | Type | Description |
|---|---|---|
True |
if a not None Value is available |
Source code in ceurws/textparser.py
59 60 61 62 63 64 65 66 67 68 69 70 71 | |
log(msg)
log the given message if debug is on
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
msg
|
str
|
the message to log |
required |
Source code in ceurws/textparser.py
49 50 51 52 53 54 55 56 57 | |
sanitize(text, replaceList=None)
classmethod
sanitize given text
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
text to sanitize |
required | |
replaceList
|
list of strings to remove from the given text |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
sanitized string |
Source code in ceurws/textparser.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | |
urn
Created on 2023-12-28
@author: wf / ChatGPT-4 as instructed
Class URN is designed to verify and calculate check digits for URNs (Uniform Resource Names) as used in the DNB URN service. The class provides methods for both verifying a full URN's check digit (check_urn_checksum) and calculating the check digit for a given URN (calc_urn_checksum). It's adapted from PHP and JavaScript sources, following the guidelines and methods outlined by the DNB (German National Library) URN service.
URN
URN check digit calculator for DNB URN service:
see https://www.dnb.de/DE/Professionell/Services/URN-Service/urn-service_node.html
and https://d-nb.info/1045320641/34 http://nbn-resolving.de/nbnpruefziffer.php
Source code in ceurws/urn.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 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 70 71 72 73 74 75 76 | |
calc_urn_checksum(test_urn, debug=False)
classmethod
converted from PHP and JavaScript code see see https://github.com/bohnelang/URN-Pruefziffer
Source code in ceurws/urn.py
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 70 71 72 73 74 75 76 | |
utils
download
Created on 2021-08-21
this is a redundant copy see e.g. https://github.com/WolfgangFahl/ConferenceCorpus/blob/main/corpus/utils/download.py
@author: wf
Download
Utility functions for downloading data
Source code in ceurws/utils/download.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 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 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | |
downloadBackupFile(url, fileName, targetDirectory, force=False, profile=True)
staticmethod
Downloads from the given url the zip-file and extracts the file corresponding to the given fileName.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
url
|
str
|
url linking to a downloadable gzip file |
required |
fileName
|
str
|
Name of the file that should be extracted from gzip file |
required |
targetDirectory
|
str
|
download the file to this directory |
required |
force
|
bool
|
True if the download should be forced |
False
|
profile
|
bool
|
if True show profiling information |
True
|
Returns:
| Type | Description |
|---|---|
|
Name of the extracted file with path to the backup directory |
Source code in ceurws/utils/download.py
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | |
needsDownload(filePath, force=False)
staticmethod
check if a download of the given filePath is necessary that is the file does not exist has a size of zero or the download should be forced
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filePath
|
str
|
the path of the file to be checked |
required |
force
|
bool
|
True if the result should be forced to True |
False
|
Return
bool: True if a download for this file needed
Source code in ceurws/utils/download.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | |
Profiler
simple profiler
Source code in ceurws/utils/download.py
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | |
__init__(msg=None, profile=True)
construct me with the given msg and profile active flag
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
msg
|
str
|
the message to show if profiling is active |
None
|
profile
|
bool
|
True if messages should be shown |
True
|
Source code in ceurws/utils/download.py
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | |
time(extraMsg='')
time the action and print if profile is active
Source code in ceurws/utils/download.py
114 115 116 117 118 119 120 121 | |
webscrape
Created on 2020-08-20
@author: wf
this is a redundant copy of the sources at https://github.com/WolfgangFahl/ConferenceCorpus/blob/main/corpus/datasources/webscrape.py
ScrapeDescription
dataclass
Description of rdfa elements to scrape
Source code in ceurws/utils/webscrape.py
238 239 240 241 242 243 244 245 246 247 248 | |
WebScrape
WebScraper with a rudimentary Parser for https://en.wikipedia.org/wiki/RDFa extended for CEUR-WS and WikiCFP specific scraping
https://stackoverflow.com/questions/21876602/what-does-the-html-typeof-attribute-do https://de.wikipedia.org/wiki/RDFa https://stackoverflow.com/questions/20767903/parsing-rdfa-in-html-xhtml https://www.w3.org/MarkUp/2009/rdfa-for-html-authors
Source code in ceurws/utils/webscrape.py
18 19 20 21 22 23 24 25 26 27 28 29 30 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 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 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 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 | |
__init__(debug=False, showHtml=False, timeout=20, agent='Mozilla/5.0')
Constructor
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
debug
|
bool
|
if True show debugging information |
False
|
showHtml
|
bool
|
if True show the HTML retrieved |
False
|
timeout
|
float
|
the default timeout |
20
|
agent
|
str
|
the agent to mimic |
'Mozilla/5.0'
|
Source code in ceurws/utils/webscrape.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | |
findLinkForRegexp(regex)
find a link for the given regular expression
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
regex
|
str
|
the regular expression to find a link for |
required |
Return
m(object),text(str): the match/text tuple or None,None
Source code in ceurws/utils/webscrape.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | |
fromTag(soup, tag, attr=None, value=None, multi=False)
get metadata from a given tag, attribute and value e.g. DL4KG2020
tag=span, attr=class, value=CEURVOLACRONYM
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
soup
|
BeautifulSoup
|
the parser to work with |
required |
tag
|
string
|
the tag to search |
required |
attr
|
string
|
the attribute to expect |
None
|
value
|
string
|
the value to expect |
None
|
multi
|
bool
|
if True - return multiple values |
False
|
Source code in ceurws/utils/webscrape.py
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | |
getSoup(url, showHtml=False, debug=False)
get the beautiful Soup parser
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
url
|
str
|
the url to open |
required |
showHtml
|
bool
|
if True the html code should be pretty printed and shown |
False
|
debug
|
bool
|
if True debug info should be printed |
False
|
Return: BeautifulSoup: the html parser
Source code in ceurws/utils/webscrape.py
108 109 110 111 112 113 114 115 116 117 118 119 120 121 | |
get_html_from_url(url, debug=False)
Get the html response from the given url Args: url: url to the get the content from debug(bool): if True show non available volumes
Returns:
| Name | Type | Description |
|---|---|---|
str |
str | bytes | None
|
content of the url as string |
bytes |
str | bytes | None
|
If the content of the url contains encoding errors |
None |
str | bytes | None
|
If the url is not reachable |
Source code in ceurws/utils/webscrape.py
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 | |
get_soup_from_string(html, show_html=False)
get the beautiful Soup parser for the given html string
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
html
|
str | bytes
|
html content to parse |
required |
show_html
|
bool
|
True if the html code should be pretty printed and shown |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
BeautifulSoup |
BeautifulSoup
|
the html parser |
Source code in ceurws/utils/webscrape.py
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | |
parseRDFa(url)
rudimentary RDFa parsing
Source code in ceurws/utils/webscrape.py
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | |
parseWithScrapeDescription(soup, scrapeDescr=None)
parse the given url with the given encoding Args: soup: html parser to parse the content from scrapeDescr: description of the
Return
a dict with the results
Source code in ceurws/utils/webscrape.py
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | |
printPrettyHtml(soup)
print the prettified html for the given soup
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
soup
|
BeuatifulSoup
|
the parsed html to print |
required |
Source code in ceurws/utils/webscrape.py
139 140 141 142 143 144 145 146 147 | |
version
Created on 2022-09-11
@author: wf
Version
Version handling for VolumeBrowser
Source code in ceurws/version.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | |
view
Created on 2024-02-23
@author: wf
View
generic View
Source code in ceurws/view.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 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 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 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 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | |
add_sync_button(on_click)
add the Export to Wikidata button with its busy indicator
the button is greyed out with a hint for users without the wikidatasync right, the spinner and the status label show a running export
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
on_click
|
the handler of the button |
required |
Returns:
| Type | Description |
|---|---|
button
|
ui.button: the button |
Source code in ceurws/view.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | |
createExternalLink(row, key, text, formatterUrl, emptyIfNone=False)
create an ExternalLink for the given row entry with the given key, text and formatterUrl
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
row
|
dict
|
the row to extract the value from |
required |
key
|
str
|
the key |
required |
text
|
str
|
the text to display for the link |
required |
formatterUrl
|
str
|
the prefix for the url to use |
required |
emptyIfNone
|
bool
|
if True return empty string if value is Display.noneValue |
False
|
Returns:
| Type | Description |
|---|---|
str
|
str - html link for external id |
Source code in ceurws/view.py
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | |
createItemLink(row, key, separator=None)
create an item link Args: row: row object with the data key: key of the value for which the link is created separator: If not None split the value on the separator and create multiple links
Source code in ceurws/view.py
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | |
createLink(url, text)
create a link from the given url and text
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
url
|
str
|
the url to create a link for |
required |
text
|
str
|
the text to add for the link |
required |
Source code in ceurws/view.py
116 117 118 119 120 121 122 123 124 125 | |
run_sync(func, button, busy_text, volume_count, on_result=None)
run the given blocking Wikidata export in the background and show the busy state meanwhile
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
func
|
the blocking export function |
required | |
button
|
button
|
the export button to disable while the export runs |
required |
busy_text
|
str
|
the status text while the export runs |
required |
volume_count
|
int
|
the number of volumes to export |
required |
on_result
|
called in the user interface context with the return value of func |
None
|
Source code in ceurws/view.py
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | |
wait_for_wikidata(container, what)
wait until the replication lag of Wikidata allows a write and show the wait in the status label
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
container
|
the user interface container of the status label |
required | |
what
|
str
|
what is waiting, e.g. Vol 4237 |
required |
Returns:
| Name | Type | Description |
|---|---|---|
WikidataLag |
WikidataLag
|
the lag check, its ready flag tells whether Wikidata accepts writes |
Source code in ceurws/view.py
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | |
wikidata_timeout()
get the minutes to wait per volume for Wikidata to accept writes
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
the value of the --wikidata_timeout command line option |
Source code in ceurws/view.py
24 25 26 27 28 29 30 31 32 | |
volume_neo4j
Editor
dataclass
Represents an editor with their name and ORCID.
Source code in ceurws/volume_neo4j.py
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 | |
create_node(tx, volume_node_id)
Create an Editor node in Neo4j and establish a relationship with a Volume node.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tx
|
The Neo4j transaction. |
required | |
volume_node_id
|
int
|
The ID of the volume node. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
int |
int | None
|
The ID of the created Editor node. |
None |
int | None
|
if the editor could not be created |
Source code in ceurws/volume_neo4j.py
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 | |
from_json(json_data)
classmethod
Create an Editor instance from JSON data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
json_data
|
dict
|
The JSON data representing the editor. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Editor |
The Editor instance created from the JSON data. |
Source code in ceurws/volume_neo4j.py
199 200 201 202 203 204 205 206 207 208 209 210 | |
search_by_name()
Search the editor by name using the ORCID API and calculate the likelihood.
Source code in ceurws/volume_neo4j.py
212 213 214 215 216 217 218 219 220 221 222 223 | |
Location
dataclass
Source code in ceurws/volume_neo4j.py
257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 | |
parse(location_str)
staticmethod
Parse a location string of the format "City, Country, Date"
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
location_str
|
str
|
The location string to parse. |
required |
Returns:
| Type | Description |
|---|---|
Optional[Location]
|
A Location object or None if the string could not be parsed. |
Source code in ceurws/volume_neo4j.py
263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 | |
Neo4j
Neo4j wrapper class
Source code in ceurws/volume_neo4j.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 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 | |
__init__(host=socket.gethostbyname(socket.gethostname()), bolt_port=7687, auth=('neo4j', 'password'), scheme='bolt', encrypted=False)
constructor
Source code in ceurws/volume_neo4j.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | |
Volume
dataclass
Represents a volume with its attributes.
Source code in ceurws/volume_neo4j.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 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 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | |
create_node(tx)
Create a Volume node in Neo4j.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tx
|
The Neo4j transaction. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
int |
int | None
|
The ID of the created node. |
None |
int | None
|
if the node was not created |
Source code in ceurws/volume_neo4j.py
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | |
default_source()
classmethod
get the default source
Source code in ceurws/volume_neo4j.py
140 141 142 143 144 145 146 | |
from_json(json_data)
classmethod
Create a Volume instance from JSON data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
json_data
|
dict
|
The JSON data representing the volume. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Volume |
The Volume instance created from the JSON data. |
Source code in ceurws/volume_neo4j.py
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | |
load_json_file(source)
staticmethod
Load volumes from the source JSON file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
str
|
Path to the source JSON file. |
required |
Returns:
| Type | Description |
|---|---|
list[Volume]
|
List[Volume]: The list of loaded volumes. |
Source code in ceurws/volume_neo4j.py
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | |
parse_args(argv=None)
classmethod
Parse command line arguments.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
argv
|
list
|
command line arguments |
None
|
Returns:
| Type | Description |
|---|---|
|
argparse.Namespace: The parsed command line arguments. |
Source code in ceurws/volume_neo4j.py
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | |
volume_view
Created on 2024-02-23
@author: wf
VolumeListView
Bases: View
show a list of volumes a table
Source code in ceurws/volume_view.py
234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 | |
__init__(solution, parent)
constructor
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
solution
|
the solution |
required | |
parent
|
the parent UI container |
required |
Source code in ceurws/volume_view.py
239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 | |
add_msg(html_markup)
add the given html_markup message to the log_view
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
msg
|
str
|
the html formatted message to add |
required |
Source code in ceurws/volume_view.py
302 303 304 305 306 307 308 309 310 | |
add_or_update_volume_in_wikidata(volume)
add the given volume to wikidata or update it if it already exists
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
volume
|
Volume
|
the CEUR-WS volume to update proceedings and event entries for |
required |
Source code in ceurws/volume_view.py
459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 | |
check_recently_updated_volumes()
check recently updated volumes
Source code in ceurws/volume_view.py
383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 | |
clear_msg(msg='')
clear the log_view with the given message
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
msg
|
str
|
the message to display |
''
|
Source code in ceurws/volume_view.py
292 293 294 295 296 297 298 299 300 | |
createEventItemAndLinkProceedings(volume, proceedingsWikidataId=None)
Create event wikidata item for given volume and link the proceedings with the event
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
volume
|
Volume
|
the volume for which to create the event item |
required |
proceedingsWikidataId
|
str | None
|
wikidata id of the proceedings |
None
|
Source code in ceurws/volume_view.py
536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 | |
createProceedingsItemFromVolume(volume)
Create wikidata item for proceedings of given volume
Source code in ceurws/volume_view.py
494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 | |
get_volume_lod()
get the list of dict of all volumes
Source code in ceurws/volume_view.py
437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 | |
onWikidataButtonClick(_args)
async
handle wikidata sync request
Source code in ceurws/volume_view.py
366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 | |
on_check_recently_update_volumes_button_click(args)
async
handle clicking of the refresh button to get recently added volumes
Source code in ceurws/volume_view.py
416 417 418 419 420 | |
on_volumes_synced(summary)
show the summary of the sync
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
summary
|
str
|
the summary of the sync |
required |
Source code in ceurws/volume_view.py
356 357 358 359 360 361 362 363 364 | |
optional_login()
check if we need to login
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if write is enabled |
Source code in ceurws/volume_view.py
482 483 484 485 486 487 488 489 490 491 492 | |
setup_ui()
show my volumes as a list
Source code in ceurws/volume_view.py
256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 | |
updateRecentlyAddedVolume(volume, index, total)
update a recently added Volume
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
volume
|
Volume
|
the volume to update |
required |
index
|
int
|
the relative index of the volume currently being added |
required |
total
|
int
|
the total number of volumes currently being added |
required |
Source code in ceurws/volume_view.py
422 423 424 425 426 427 428 429 430 431 432 433 434 435 | |
updateWikidataVolumes(selected_rows)
update wikidata volumes for the selected rows
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
the summary of the sync |
Source code in ceurws/volume_view.py
312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 | |
VolumeView
Bases: View
displays a single volume
Source code in ceurws/volume_view.py
19 20 21 22 23 24 25 26 27 28 29 30 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 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 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 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | |
__init__(solution, parent)
constructor
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
solution
|
the solution |
required | |
parent
|
the parent UI container |
required |
Source code in ceurws/volume_view.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | |
export_volume()
export my volume to Wikidata - blocking, to be run in the background
Returns:
| Name | Type | Description |
|---|---|---|
WikidataResult |
the result of the export or None if the export did not take place |
Source code in ceurws/volume_view.py
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 | |
onWikidataButtonClick(_args)
async
handle wikidata sync request
Source code in ceurws/volume_view.py
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | |
on_volume_exported(result)
show the result of the export of my volume
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
result
|
WikidataResult
|
the result of the export or None if the export did not take place |
required |
Source code in ceurws/volume_view.py
208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | |
setup_ui()
setup my User Interface elements
Source code in ceurws/volume_view.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | |
showVolume(volume)
show the given volume
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
volume
|
Volume
|
the volume to show |
required |
Source code in ceurws/volume_view.py
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 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 | |
updateWikidataSpan(qId, volume)
create a Wikidata Export span
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
a
|
ancestor |
required | |
qId
|
str
|
wikidata item Q Identifier |
required |
volume
|
Volume
|
the Volume |
required |
Source code in ceurws/volume_view.py
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | |
volumeparser
Created on 2022-08-14
@author: wf
VolumePageCache
Cache interface for ceur-ws volume pages
Source code in ceurws/volumeparser.py
437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 | |
cache(number, html)
classmethod
cache the volume page corresponding to the given number Args: number: number of the volume to cache html: html of the volume page to cache
Source code in ceurws/volumeparser.py
456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 | |
delete(number)
classmethod
Delete the cache corresponding to the given volume number Args: number: volume number
Source code in ceurws/volumeparser.py
502 503 504 505 506 507 508 509 510 511 | |
get(number)
classmethod
Get the cached volume page of the given volume number. If the volume page is not cached None is returned. Args: number: volume number to retrieve
Returns:
| Name | Type | Description |
|---|---|---|
str |
str | bytes | None
|
cached volume page |
bytes |
str | bytes | None
|
if the cached volume page contains encoding errors |
None |
str | bytes | None
|
if no volume with the given number is cached |
Source code in ceurws/volumeparser.py
480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 | |
is_cached(number)
classmethod
Check if the volume page of the given volume number is cached Args: number: volume number of the volume page
Returns:
| Type | Description |
|---|---|
bool
|
True if the corresponding volume page is cached |
Source code in ceurws/volumeparser.py
444 445 446 447 448 449 450 451 452 453 454 | |
VolumeParser
Bases: Textparser
CEUR-WS VolumeParser
Source code in ceurws/volumeparser.py
19 20 21 22 23 24 25 26 27 28 29 30 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 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 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 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 | |
__init__(baseurl='http://ceur-ws.org', timeout=3, showHtml=False, debug=False)
Constructor
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
baseurl
|
str
|
the baseurl of the CEUR-WS website, |
'http://ceur-ws.org'
|
timeout
|
float
|
the number of seconds to wait |
3
|
showHtml
|
bool
|
if True show the HTML code |
False
|
debug
|
bool
|
if True switch debugging on |
False
|
Source code in ceurws/volumeparser.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | |
check_parsed_dict(parsed_dict)
check parsed_dict content e.g. urn check digit
Source code in ceurws/volumeparser.py
128 129 130 131 132 133 134 135 136 137 138 139 | |
getSoup(url)
get the beautiful Soup parser for the given url Args: url: url to parse
Returns:
| Type | Description |
|---|---|
BeautifulSoup | None
|
parsed webpage |
Source code in ceurws/volumeparser.py
60 61 62 63 64 65 66 67 68 69 | |
get_volume_page(number, recache=False)
Get the html content of the given volume number. Retrieves the volume page from cache or from ceur-ws.org Caches the volume page if not already cached Args: number: volume number recache: If True update the cache with a new fetch from the web. Otherwise, cache is used if present
Returns:
| Type | Description |
|---|---|
str | bytes | None
|
html of volume page or None if the volume page is not found |
Source code in ceurws/volumeparser.py
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | |
get_volume_soup(number, use_cache=True)
Get Soup of the volume page for the given volume number Args: number: volume number of the volume to parse use_cache: If True use volume page from cache if present otherwise load from web and cache
Returns:
| Name | Type | Description |
|---|---|---|
BeautifulSoup |
BeautifulSoup | None
|
soup of the volume page |
None |
BeautifulSoup | None
|
soup can not be loaded from cache or from web |
Source code in ceurws/volumeparser.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | |
parse(url)
parse the given url Args: url: URL to parse the volume information from
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
extracted information |
Source code in ceurws/volumeparser.py
141 142 143 144 145 146 147 148 149 150 151 152 | |
parseAffiliationMap(start)
Parse out the affiliations and their reference key Args: start:
Returns:
| Type | Description |
|---|---|
dict
|
dict |
Source code in ceurws/volumeparser.py
313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 | |
parseEditors(soup)
parse all editor information contained in the given soup parse all information between Edited by ...
Args: soup: volume web page
Source code in ceurws/volumeparser.py
219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 | |
parseRDFa(soup)
tries to parse rdfa content from the given soup Args: soup: html parser to extract the content from
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
dict with the extracted content |
Source code in ceurws/volumeparser.py
378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 | |
parse_soup(soup, number=None)
parse the volume page data from the given soup
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
number
|
str
|
the volume number |
None
|
soup
|
BeautifulSoup
|
html parser to extract the content from |
required |
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
parsed content |
Source code in ceurws/volumeparser.py
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 | |
parse_volume(number, use_cache=True)
parse the given volume caches the volume pages at ~/.ceurws/volumes
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
number
|
int
|
volume number of the volume to parse |
required |
use_cache
|
bool
|
If True use volume page from cache if present otherwise load from web and cache |
True
|
Returns:
| Name | Type | Description |
|---|---|---|
dict |
tuple[dict, BeautifulSoup | None]
|
extracted information |
Source code in ceurws/volumeparser.py
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | |
volumeUrl(volnumber)
get the url for the given volume number
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
volnumber
|
str
|
the volume number |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
url - the url of the volume |
Source code in ceurws/volumeparser.py
46 47 48 49 50 51 52 53 54 55 56 57 58 | |
wd_contributions
CEUR-WS Wikidata community contribution analysis.
Adapted from the prototype at https://cr.bitplan.com/index.php/CEUR-WS_Wikidata_Contributions
Computes, per Wikidata entity class: - number of CEUR-WS entities (instance-of class AND P179 -> Q27230297) - total number of entities of that class on Wikidata - CEUR-WS coverage percentage - number of community vs bot edits (creator + revision history) - top contributors
See: https://github.com/WolfgangFahl/pyCEURmake/issues/108
Created: 2026-05-06 @author: wf
ContributionStats
Aggregated per-class contribution statistics.
Source code in ceurws/wd_contributions.py
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | |
HistoryRecord
One QID's contributor footprint.
Source code in ceurws/wd_contributions.py
102 103 104 105 106 107 108 109 110 111 | |
WdClassSpec
A Wikidata class to analyse.
kind
- "proceedings": item itself has wdt:P179 wd:Q27230297
- "event": item reachable as ?proc wdt:P4745 ?item from a CEUR-WS proceeding
- "all": any item with wdt:P31 wd:
, no CEUR-WS filter
Source code in ceurws/wd_contributions.py
63 64 65 66 67 68 69 70 71 72 73 74 75 | |
WdContributionAnalyzer
Analyse CEUR-WS contributions to Wikidata.
Heavy operations (history fetch over MediaWiki API) are cached on disk under
~/.ceurws/wd_contributions/.
Source code in ceurws/wd_contributions.py
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 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 | |
__init__(config=None, endpoint_url=None, bot_users=None, source_of_truth=None, cache_dir=None, sleep_every=100, sleep_seconds=30, debug=False)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
WdContributionsConfig | None
|
:class: |
None
|
endpoint_url
|
str | None
|
override SPARQL endpoint URL from config. |
None
|
bot_users
|
Iterable[str] | None
|
override bot usernames from config. |
None
|
source_of_truth
|
Iterable[str] | None
|
override SoT usernames from config. |
None
|
cache_dir
|
Path | None
|
directory for JSON caches (default |
None
|
sleep_every
|
int
|
throttle the MediaWiki API every N pages. |
100
|
sleep_seconds
|
int
|
seconds to sleep when throttling. |
30
|
debug
|
bool
|
verbose logging. |
False
|
Source code in ceurws/wd_contributions.py
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | |
analyze(classes=None, sample_size=None, force=False, progress=None)
Compute ContributionStats for each :class:WdClassSpec.
Fetches the full revision history of every item and classifies
each revision as source-of-truth (self.source_of_truth) or
community.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
classes
|
list[WdClassSpec] | None
|
list of :class: |
None
|
sample_size
|
int | None
|
if set, only analyse this many QIDs per class (useful for tests). |
None
|
force
|
bool
|
ignore the on-disk cache. |
False
|
progress
|
bool | None
|
print progress (defaults to self.debug). |
None
|
Source code in ceurws/wd_contributions.py
582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 | |
classify_contributions(records)
(legacy) Split records into community vs bot based on the creator of the item.
Returns:
| Type | Description |
|---|---|
tuple[int, int, Counter]
|
(community_count, bot_count, Counter(creator -> count)) |
Source code in ceurws/wd_contributions.py
536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 | |
classify_edits(records, source_of_truth=None)
Split revisions into source-of-truth vs community buckets.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
records
|
list[HistoryRecord]
|
HistoryRecord list with populated |
required |
source_of_truth
|
Iterable[str] | None
|
user set to treat as SoT; defaults to
|
None
|
Returns:
| Type | Description |
|---|---|
tuple[int, int, int, Counter]
|
(total_edits, sot_edits, community_edits, community_editor_counter) |
Source code in ceurws/wd_contributions.py
552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 | |
count_ceurws(class_qid, kind='proceedings')
Number of CEUR-WS-affiliated entities of the given class.
Source code in ceurws/wd_contributions.py
243 244 245 246 | |
count_total(class_qid)
Total number of entities of the given class on Wikidata.
Source code in ceurws/wd_contributions.py
248 249 250 | |
fetch_creators_batched(qids, class_qid, batch_size=50, force=False, api_url='https://www.wikidata.org/w/api.php', calls_per_minute=200, progress=False, label=None)
Fast path: fetch only the creator of each item via
MediaWiki action=query&prop=revisions&rvdir=newer&rvlimit=1.
The MediaWiki API rejects multi-page queries combined with
rvdir/rvlimit, so we issue one request per QID. Request rate
is capped via lodstorage.rate_limiter.RateLimiter to stay under
Wikimedia's unauthenticated read limit (default 500/min).
batch_size controls cache-flush granularity (every N requests).
Returns HistoryRecord with editors=[] (not collected; use
fetch_history for full editor list).
Source code in ceurws/wd_contributions.py
359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 | |
fetch_history(qids, class_qid, max_items=None, force=False)
Fetch creator + editors for each QID; results are cached on disk.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
qids
|
list[str]
|
QIDs to query. |
required |
class_qid
|
str
|
used as cache namespace. |
required |
max_items
|
int | None
|
cap on total fetched (useful for tests). |
None
|
force
|
bool
|
ignore cache and refetch. |
False
|
Returns:
| Type | Description |
|---|---|
list[HistoryRecord]
|
list of HistoryRecord, one per processed QID. |
Source code in ceurws/wd_contributions.py
307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 | |
fetch_revisions_full(qids, class_qid, force=False, api_url='https://www.wikidata.org/w/api.php', calls_per_minute=200, progress_every=25, progress=False, label=None)
Fetch every revision (user + timestamp) for each QID with
rvcontinue pagination, populating HistoryRecord.edit_counts
(user -> revision count) and creator (earliest revision user).
Rate-limited via lodstorage.RateLimiter and retried on 429/5xx
via urllib3.Retry honouring Retry-After.
Cached on disk. Items already present in the cache with non-empty
edit_counts are skipped unless force=True.
Source code in ceurws/wd_contributions.py
437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 | |
list_qids(class_qid, kind='all')
Return QIDs for the given class.
kind
- "all": every item with wdt:P31 wd:
- "proceedings": CEUR-WS proceedings (P179 filter)
- "event": CEUR-WS-linked events (reverse P4745 from a CEUR-WS proceeding)
Source code in ceurws/wd_contributions.py
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 | |
plot_all(out_dir, classes=None, force=False, prefix='distribution_of_', suffix='_community_editors.png', mode='edits', progress=False, threshold=1.0)
Generate one community-contribution pie per entity class and write
them as PNGs into out_dir.
Uses the full revision history (fetch_revisions_full) and
excludes self.source_of_truth users from the chart so that
genuine community activity is visible.
Returns the list of written paths.
Source code in ceurws/wd_contributions.py
767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 | |
plot_distribution(records, title, out_path, threshold=1.0, exclude_users=None, mode='edits', figsize=(8.0, 6.0), dpi=150)
Render a contribution pie chart.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
records
|
list[HistoryRecord]
|
HistoryRecord list. |
required |
title
|
str
|
chart title. |
required |
out_path
|
Path | str
|
PNG output path. |
required |
threshold
|
float
|
users contributing less than this percentage of the total are aggregated into an "others" slice (default 1.0%). |
1.0
|
exclude_users
|
Iterable[str] | None
|
users to drop entirely before plotting (defaults
to |
None
|
mode
|
str
|
"edits" (sum |
'edits'
|
figsize/dpi
|
matplotlib figure params. |
required |
Returns:
| Type | Description |
|---|---|
Path
|
Path to the written PNG. |
Source code in ceurws/wd_contributions.py
679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 | |
WdContributionsConfig
Configuration for :class:WdContributionAnalyzer.
Defaults are loaded from ceurws/resources/yaml/wd_contributions.yaml.
Source code in ceurws/wd_contributions.py
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | |
default()
classmethod
Load the bundled default configuration.
Source code in ceurws/wd_contributions.py
96 97 98 99 | |
default_yaml_path()
classmethod
Return the path to the bundled default YAML resource.
Source code in ceurws/wd_contributions.py
91 92 93 94 | |
wd_contributions_cmd
Created on 2026-05-07
Command line interface for CEUR-WS Wikidata community contribution analysis.
@author: wf
WdContributionsCmd
Bases: BaseCmd
Command line handling for Wikidata community contribution analysis.
Source code in ceurws/wd_contributions_cmd.py
19 20 21 22 23 24 25 26 27 28 29 30 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 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | |
add_arguments(parser)
Add CLI arguments specific to the community contribution analysis.
Source code in ceurws/wd_contributions_cmd.py
27 28 29 30 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 70 71 72 73 | |
handle_args(args)
Handle the parsed CLI arguments.
Source code in ceurws/wd_contributions_cmd.py
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | |
main(argv=None)
main call
Source code in ceurws/wd_contributions_cmd.py
134 135 136 137 138 139 140 | |
webserver
Created on 2024-02-22
@author: wf
CeurWsSolution
Bases: InputWebSolution
CEUR-WS Volume browser solution
Source code in ceurws/webserver.py
238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 | |
__init__(webserver, client)
Initialize the solution
Calls the constructor of the base solution Args: webserver (CeurWsWebServer): The webserver instance associated with this context. client (Client): The client instance this context is associated with.
Source code in ceurws/webserver.py
247 248 249 250 251 252 253 254 255 256 257 | |
home()
async
home page selection
Source code in ceurws/webserver.py
347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 | |
may_see_log()
check whether the user of the current session may see the log
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if the user is logged in and has the log right |
Source code in ceurws/webserver.py
259 260 261 262 263 264 265 266 267 | |
may_sync_wikidata()
check whether the user of the current session may write to Wikidata
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if the user is logged in and has the wikidatasync right |
Source code in ceurws/webserver.py
269 270 271 272 273 274 275 276 277 | |
prepare_ui()
prepare the user interface
Source code in ceurws/webserver.py
305 306 307 308 309 | |
setup_footer()
async
setup the footer - the log view is for authorized users only
Source code in ceurws/webserver.py
279 280 281 282 283 284 | |
volumePage(volnumber)
async
show the page of the volume with the given number, the target of the /volume/{volnumber} links, see https://github.com/WolfgangFahl/pyCEURmake/issues/113
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
volnumber
|
int
|
the number of the volume |
required |
Source code in ceurws/webserver.py
377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 | |
volume_selected(args)
async
when a volume is selected show the details in the Volume View
Source code in ceurws/webserver.py
368 369 370 371 372 373 374 375 | |
volumes()
async
show the volumes table
Source code in ceurws/webserver.py
337 338 339 340 341 342 343 344 345 | |
wikidatasync()
async
show the wikidata sync table
Source code in ceurws/webserver.py
327 328 329 330 331 332 333 334 335 | |
CeurWsWebServer
Bases: InputWebserver
webserver
Source code in ceurws/webserver.py
26 27 28 29 30 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 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 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 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 | |
__init__()
constructor
Source code in ceurws/webserver.py
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 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 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 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | |
configure_run()
configure command line specific details
Source code in ceurws/webserver.py
229 230 231 232 233 234 | |
wikidata_lag
Created on 2026-09-30
@author: wf
WikidataLag
replication lag of Wikidata
Wikidata refuses bot writes while its replication lag is above the maxlag of the write. The Wikidata client then waits and retries on its own without telling its caller - see https://github.com/WolfgangFahl/pyCEURmake/issues/111. Waiting here before a write keeps the wait visible and limits it.
Source code in ceurws/wikidata_lag.py
18 19 20 21 22 23 24 25 26 27 28 29 30 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 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | |
__init__(timeout_minutes, poll_seconds=10.0)
constructor
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
timeout_minutes
|
float
|
the minutes to wait for the lag to drop below the limit |
required |
poll_seconds
|
float
|
the seconds between two lag checks |
10.0
|
Source code in ceurws/wikidata_lag.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 | |
get_lag()
get the current replication lag
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
the lag in seconds, 0.0 if the API reports none |
Source code in ceurws/wikidata_lag.py
43 44 45 46 47 48 49 50 51 52 53 54 55 56 | |
max_lag_text()
get the limit in plain words
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
e.g. the 5 seconds max lag for edits |
Source code in ceurws/wikidata_lag.py
85 86 87 88 89 90 91 92 93 | |
timeout_message()
get the message for a lag that did not drop in time
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
the message |
Source code in ceurws/wikidata_lag.py
114 115 116 117 118 119 120 121 122 | |
wait_message(what, lag, elapsed)
get the message for a wait
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
what
|
str
|
what is waiting, e.g. Vol 4237 (1 of 2) |
required |
lag
|
float
|
the current lag in seconds |
required |
elapsed
|
float
|
the seconds waited so far |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
the message |
Source code in ceurws/wikidata_lag.py
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | |
wait_until_ready(on_wait=None)
wait until the lag allows a write or my timeout is over
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
on_wait
|
Callable[[float, float], None] | None
|
called with the lag and the elapsed seconds before each wait |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if Wikidata accepts writes, False if the lag stayed above the limit until the timeout |
Source code in ceurws/wikidata_lag.py
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | |
wikidata_view
Created on 2024-02-23
@author: wf
WikidataView
Bases: View
Wikidata View
Source code in ceurws/wikidata_view.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 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 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | |
__init__(solution, parent)
constructor
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
solution
|
the solution |
required | |
parent
|
the parent UI container |
required |
Source code in ceurws/wikidata_view.py
20 21 22 23 24 25 26 27 28 29 30 31 | |
on_refresh_button_click()
async
handle the refreshing of the proceedings from wikidata
Source code in ceurws/wikidata_view.py
97 98 99 100 101 | |
reload_aggrid(olod)
reload my aggrid with the list of Volumes
Source code in ceurws/wikidata_view.py
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 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | |
setup_ui()
setup my User Interface elements
Source code in ceurws/wikidata_view.py
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | |
update_proceedings()
async
update the cached proceedings
Source code in ceurws/wikidata_view.py
33 34 35 36 37 38 39 40 41 42 43 | |
wikidatasync
Created on 2022-08-14
@author: wf
WikidataSync
synchronize with wikidata
Source code in ceurws/wikidatasync.py
23 24 25 26 27 28 29 30 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 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 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 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 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 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 | |
__init__(baseurl='https://www.wikidata.org', debug=False, dblp_endpoint_url=None)
Constructor
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
baseurl
|
str
|
the baseurl of the wikidata endpoint |
'https://www.wikidata.org'
|
debug
|
bool
|
if True switch on debugging |
False
|
dblp_endpoint_url
|
str | None
|
sparql endpoint url of dblp |
None
|
Source code in ceurws/wikidatasync.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | |
addAcronymToItem(itemId, acronym, desc=None, label=None, write=True, ignoreErrors=False)
add the acronym to the given item Args: itemId: item to add the acronym to acronym(str): acronym of the item write(bool): if True actually write ignoreErrors(bool): if True ignore errors
Returns:
| Type | Description |
|---|---|
|
(qid, errors) id of the created entry and occurred errors |
Source code in ceurws/wikidatasync.py
589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 | |
addDblpPublicationId(volumeNumber, dblpRecordId=None, write=True, ignoreErrors=False)
try to add the dblp publication id (P8978) to the proceedings record Args: volumeNumber: ceurws volumenumber of the proceedings dblpRecordId: dblp record id to add to the proceedings item. If None query dblp for the record id write: if True actually write ignoreErrors(bool): if True ignore errors
Returns:
| Name | Type | Description |
|---|---|---|
WikidataResult |
WikidataResult
|
the result of the add operation |
Source code in ceurws/wikidatasync.py
516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 | |
addLinkBetweenProceedingsAndEvent(eventItemQid, volumeNumber=None, proceedingsWikidataId=None, write=True, ignoreErrors=False)
add the link between the wikidata proceedings item and the given event wikidata item Args: volumeNumber: ceurws volume number of the proceedings eventItemQid: wikidata Qid of the event proceedingsWikidataId: wikidata id of the proceedings item write(bool): if True actually write ignoreErrors(bool): if True ignore errors
Returns:
| Name | Type | Description |
|---|---|---|
WikidataResult |
WikidataResult
|
the result of the add operation |
Raises:
| Type | Description |
|---|---|
ValueError
|
if the volume number is not provided or the volume is not unique in Wikidata |
Source code in ceurws/wikidatasync.py
439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 | |
addOfficialWebsiteToItem(itemId, officialWebsite, write=True, ignoreErrors=False)
add the official website to the given item Args: itemId: item to add the acronym to officialWebsite(str): officialWebsite of the item write(bool): if True actually write ignoreErrors(bool): if True ignore errors
Returns:
| Name | Type | Description |
|---|---|---|
WikidataResult |
the result of the add operation |
Source code in ceurws/wikidatasync.py
629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 | |
addProceedingsToWikidata(record, write=True, ignoreErrors=False)
Creates a wikidata entry for the given record
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
record
|
dict
|
the data to add |
required |
write
|
bool
|
if True actually write |
True
|
ignoreErrors
|
bool
|
if True ignore errors |
False
|
Source code in ceurws/wikidatasync.py
368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 | |
addVolume(volume)
add the given volume
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
volume
|
Volume
|
the volume to add |
required |
Source code in ceurws/wikidatasync.py
140 141 142 143 144 145 146 147 148 149 | |
checkIfProceedingsFromExists(volumeNumber, eventItemQid)
Returns True if the is proceedings from relation already exists between the given proceedings and event
Source code in ceurws/wikidatasync.py
417 418 419 420 421 422 423 424 425 | |
doAddEventToWikidata(record, write=True, ignoreErrors=False)
Creates a wikidata event entry for the given record Args: record(dict): the data to add write(bool): if True actually write ignoreErrors(bool): if True ignore errors
Returns:
| Name | Type | Description |
|---|---|---|
WikidataResult |
the result of the add operation |
Source code in ceurws/wikidatasync.py
489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 | |
doAddProceedingsToWikidata(record, write=True, ignoreErrors=False)
Creates a wikidata proceedings entry for the given record
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
record
|
dict
|
the data to add |
required |
write
|
bool
|
if True actually write |
True
|
ignoreErrors
|
bool
|
if True ignore errors |
False
|
Returns: WikidataResult: the result of the add operation
Source code in ceurws/wikidatasync.py
385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 | |
doCreateEventItemAndLinkProceedings(volume, proceedingsWikidataId=None, write=False)
Create event wikidata item for given volume and link the proceedings with the event Args: volume: volume to create the event for proceedingsWikidataId: proceedings wikidata id of the event write: If True actually write
Returns:
| Type | Description |
|---|---|
dict[str, WikidataResult]
|
proceedingsQId, eventQId, msg |
Source code in ceurws/wikidatasync.py
844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 | |
from_args(args)
classmethod
create a WikidataSync object from the given command line arguments
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
args
|
Namespace
|
the command line arguments |
required |
Source code in ceurws/wikidatasync.py
55 56 57 58 59 60 61 62 63 64 65 66 | |
from_endpoint_names(wd_en, dblp_en, debug=False)
classmethod
create a WikidataSync object from the given endpoint names
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wd_en
|
str
|
wikidata endpoint name |
required |
dblp_en
|
str
|
dblp endpoint name |
required |
Source code in ceurws/wikidatasync.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | |
getAuthorByIds(identifiers)
Based on the given identifiers get potential author items the names of the identifiers must be according to DblpAuthorIdentifier Args: identifiers: known identifiers of the author
Source code in ceurws/wikidatasync.py
925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 | |
getEventNameFromTitle(title)
classmethod
Get the event name from the given proceedings title Args: title: title of the proceeding
Returns:
| Type | Description |
|---|---|
str
|
name of the event |
Source code in ceurws/wikidatasync.py
744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 | |
getEventTypeFromTitle(title)
classmethod
Extract the event type from the given title Assumption: lowest mentioned type is the correct one Args: title: title of the event
Returns:
| Type | Description |
|---|---|
tuple[str | None, str | None]
|
wikidata id and label of the event type |
Source code in ceurws/wikidatasync.py
822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 | |
getEventWdItemsByUrn(urn)
queries the wikidata proceedings that have the given urn assigned to P4109 and returns the assigned event Args: urn: URN id to query for
Returns:
| Type | Description |
|---|---|
list[str]
|
List of corresponding wikidata item ids or empty list of no matching item is found |
Source code in ceurws/wikidatasync.py
321 322 323 324 325 326 327 328 329 330 331 332 333 | |
getEventsOfProceedings(itemId)
get the item ids of the events the given proceedings ids is the proceedings from Args: itemId: Qid of the proceedings
Returns:
| Type | Description |
|---|---|
list[str]
|
List of the events |
Source code in ceurws/wikidatasync.py
335 336 337 338 339 340 341 342 343 344 345 346 347 | |
getEventsOfProceedingsByVolnumber(volnumber)
get the item ids of the events the given proceedings ids is the proceedings from Args: volnumber: Volume number of the proceedings
Returns:
| Type | Description |
|---|---|
list[str]
|
List of the events |
Source code in ceurws/wikidatasync.py
349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 | |
getProceedingWdItemsByUrn(urn)
queries the wikidata items that have the given urn for the property P4109 Args: urn: URN id to query for
Returns:
| Type | Description |
|---|---|
list[str]
|
List of corresponding wikidata item ids or empty list of no matching item is found |
Source code in ceurws/wikidatasync.py
307 308 309 310 311 312 313 314 315 316 317 318 319 | |
getProceedingsForVolume(searchVolnumber)
get the proceedings record for the given searchVolnumber
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
searchVolnumber
|
int
|
the number of the volume to search |
required |
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict | None
|
the record for the proceedings in wikidata |
None |
dict | None
|
if the proceeding record in not found for the given searchVolnumber |
Source code in ceurws/wikidatasync.py
282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 | |
getRecentlyAddedVolumeList()
get the list of volumes that have recently been added we do not expect deletions
Returns:
| Type | Description |
|---|---|
tuple[dict[int, dict], list[dict]]
|
list[int]: list of volume numbers recently added |
Source code in ceurws/wikidatasync.py
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | |
getWikidataEventRecord(volume)
get the wikidata Record for the given volume
Source code in ceurws/wikidatasync.py
197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | |
getWikidataIdByDblpEventId(entityId, volumeNumber=None)
query wikidata for the qId of items that correspond to the given dblpEventId Args: entityId: id of a dblp event volumeNumber: volume number
Returns:
| Type | Description |
|---|---|
list[str]
|
list of matching wikidata items |
Source code in ceurws/wikidatasync.py
697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 | |
getWikidataIdByVolumeNumber(number)
query wikidata for the qId of the proceedings of the given volume number Args: number: volume number
Returns:
| Name | Type | Description |
|---|---|---|
str |
str | None
|
wikidata id corresponding to the given volume number |
None |
str | None
|
if the corresponding wikidata id was not found |
Source code in ceurws/wikidatasync.py
674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 | |
getWikidataProceedingsRecord(volume)
get the wikidata Record for the given volume
Source code in ceurws/wikidatasync.py
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | |
hasItemPropertyValueFor(item, propertyId)
ask wikidata if the given item has a value for the given property Args: item: item Qid propertyId: property Pid Returns: True if the item has the property else False
Source code in ceurws/wikidatasync.py
427 428 429 430 431 432 433 434 435 436 437 | |
loadProceedingsFromCache()
load the proceedings records from the cache
Source code in ceurws/wikidatasync.py
274 275 276 277 278 279 280 | |
preparePaperManager()
prepare my paper Manager
Source code in ceurws/wikidatasync.py
112 113 114 115 116 117 118 119 120 121 122 123 | |
prepareVolumeManager()
prepare my volume manager
Source code in ceurws/wikidatasync.py
125 126 127 128 129 130 131 132 133 134 135 136 137 138 | |
removeWdPrefix(value)
classmethod
removes the wikidata entity prefix Args: value: wikidata entity url
Source code in ceurws/wikidatasync.py
913 914 915 916 917 918 919 920 921 922 923 | |
storeVolumes()
store my volumes
Source code in ceurws/wikidatasync.py
171 172 173 174 175 | |
update(withStore=True)
update my table from the Wikidata Proceedings SPARQL query
Source code in ceurws/wikidatasync.py
233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 | |
workshop
Created on 2020-11-12
@author: wf
Workshop
a single Workshop
Source code in ceurws/workshop.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | |
__init__()
Constructor
Source code in ceurws/workshop.py
17 18 19 20 | |