Difference between revisions of "EMWConTalk2023-04"

From BITPlan Wiki
Jump to navigation Jump to search
Line 173: Line 173:
  
 
== Todo ==
 
== Todo ==
* syncronization of complete entities
+
* synchronization of complete entities (--all option for properties)
 
** detection of sync conflicts
 
** detection of sync conflicts
 
* bidirectional sync
 
* bidirectional sync
 
** publish to wikidata from smw
 
** publish to wikidata from smw
 +
* GUI
 +
** Sync dialog
 
* generation of smw topics and properties from wikidata
 
* generation of smw topics and properties from wikidata
 
* support of intext annotation  
 
* support of intext annotation  

Revision as of 14:33, 19 April 2023

view EMWConTalk2023-04 as slides

Wolfgang Fahl

WolfgangFahl.png
  • Computer Scientist
  • 20210702 Semantic MediaWiki logo with wordmark.png Expert
  • Trainer for Software Architecture and Requirements Engineering
  • PhD Candidate at RWTH Aachen i5

BITPlan GmbH

BITPlan

  • Inception: 1999


  • Focus on Software-Engineering 

Training, Consulting, Projects …
  • 

Switch from Lotus Notes to 
Semantic Mediawiki in 2013


  • ProfiWiki since 2015

Agenda

Wikidata-logo-en.svg Wikidata
20210702 Semantic MediaWiki logo with wordmark.png
Octicons-sync.svg Synchronization

SMW and Wikidata storage

  • Both systems use triples: subject, predicate and object
  • It's a girl revisited:
    It's a girl!
The princess of cambridge was born on [[is born::2015-05-03]] 
Her rank inline to the throne is [[throne rank is::4]].
Her mother is [[mother is::Duchess Kate]].

SMW as a database?

Compare to a relational database:

  • Tables are dynamically created via ask-queries e.g.List of Persons
  • A page corresponds to a row in a table

SMW relational operations

Row and Column definition operations

Caption text
Operation Manually Via Api Via Wikipush
Create create page and use markup to set property edit wikipush, wikiupload, wikirestore
Read visit link of page read html or markup {Done}} wikibackup, wikipush, wikiedit
Update modify page via edit edit wikiedit, wikirestore, wikipush
Delete delete page delete {Done}} wikinuke

Column value operations

Caption text
Operation Manually Via Api Via Wikipush
Create add property value manually on a page ->
Read use ask queries to retrieve property values edit wikiquery
Update modify property value manually on a page ->
Delete remove property value manually on a page

Modifying a Single triple

wikiedit -t family --template Person --property label --value "Alexandra of Denmark" -p Alexandra_of_Denmark 
editing 1 pages in family (dry run)
1/1 (100.00%): editing Alexandra_of_Denmark ...👍 |childOf=F74
 |parentOf=F2
 |spouse=Q20875
+|label=Alexandra of Denmark
 }}
 [[Category:frontend]]
wikiedit -t family --template Person --property label --value "Alexandra of Denmark" -p Alexandra_of_Denmark -f
editing 1 pages in family (forced)
1/1 (100.00%): editing Alexandra_of_Denmark ...✅

Example Usecases

  • Royal Family
  • Scholary communication

Example Royal Family

Error creating thumbnail: convert-im6.q16: non-conforming drawing primitive definition `normal' @ error/draw.c/RenderMVGContent/3024. convert-im6.q16: non-conforming drawing primitive definition `letter-spacing' @ error/draw.c/RenderMVGContent/4300.
Badge of the house of Windsor
  • 0xe4ab021a.png

Sync Royal Family

smwsync -u -t family --context FamilyContext --topic Person -p desc label --progress
updating cache for FamilyContext:Person from wiki family ...
stored 59 Person items to /Users/wf/.smwsync/family/FamilyContext/Person.json
59 Person items to sync ...
William IV of the United Kingdom→label: 100%|███████| 118/118 [00:45<00:00,  2.57it/s]

Example: Scholary communication

0x1a095a5a.png


Sync Institutions

smwsync -u -t cr --topic EventSeries -p desc title home --progress
updating cache for CrSchema:EventSeries from wiki cr ...
stored 10 EventSeries items to /Users/wf/.smwsync/cr/CrSchema/EventSeries.json
10 EventSeries items to sync ...
SGAI→homepage: 100%|██████████████████████████████████| 30/30 [00:28<00:00,  1.05it/s]

How SMWSync works

  • Self describing Properties
  • MetaModel, SiDIF, LinkML
  • Mapping SMW Properties to Wikidata properties
  • Command Line Tool

Self describing Properties

MetaModel, SiDIF, LinkML

YpgenScreenShotFamilyContext2023-04-19.png

ypgen --wikiId family --context FamilyContext --serve --host localhost

FamilyContext SiDIF is in legacy SiDIF triple format.

pyMetaModel mm_cmd command line tool will generate LinkML yaml markup and other target formats. LinkML can then generate even form format see:

pyMetaModel family example files

Mapping SMW Properties to Wikidata properties

# list of property mappings
# for family  versus wikidata
- topic: Person
  prop_list:
  - arg: desc
    pid: description
    pid_label: description
    smw_prop: description
  - arg: label
    pid: label
    pid_label: label
    smw_prop: label
  - pid: qid
    smw_prop: wikiDataId
  - arg: died_at
    pid: P20
    pid_label: place of death
    smw_prop: died_at

Todo

Command Line Tool

usage: smwsync [-h] [-a] [--context CONTEXT] [-cpm CREATEPROPERTYMAP] [-d] [--dry]
               [-e ENDPOINT] [--progress] [-p PROPS [PROPS ...]] [--proplist]
               [-pm PROPERTYMAP] [-pk PRIMARYKEY]
               [-pkv PRIMARYKEYVALUES [PRIMARYKEYVALUES ...]] [-t TARGET] [-u]
               [--topic TOPIC] [--verbose] [-V]

Links

Questions / Discussion

Bitplanpartner.png