Difference between revisions of "EMWConTalk2023-04"
Jump to navigation
Jump to search
Line 25: | Line 25: | ||
== SMW and Wikidata storage == | == SMW and Wikidata storage == | ||
+ | {{Font-size| | ||
* Both systems use triples: subject, predicate and object | * Both systems use triples: subject, predicate and object | ||
* It's a girl revisited: [[File:Royalbaby.png|right|frame|It's a girl!]] | * It's a girl revisited: [[File:Royalbaby.png|right|frame|It's a girl!]] | ||
− | <pre style='font-size: | + | <pre style='font-size:32px'> |
The princess of cambridge was born on [[is born::2015-05-03]] | The princess of cambridge was born on [[is born::2015-05-03]] | ||
Her rank inline to the throne is [[throne rank is::4]]. | Her rank inline to the throne is [[throne rank is::4]]. | ||
Line 34: | Line 35: | ||
* http://royal-family.bitplan.com/index.php/Princess_Charlotte_of_Cambridge | * http://royal-family.bitplan.com/index.php/Princess_Charlotte_of_Cambridge | ||
* http://family.bitplan.com/index.php/Princess_Charlotte_of_Cambridge | * http://family.bitplan.com/index.php/Princess_Charlotte_of_Cambridge | ||
− | + | }} | |
== SMW and Wikidata as databases? == | == SMW and Wikidata as databases? == | ||
{{Font-size| | {{Font-size| |
Revision as of 16:18, 19 April 2023
view EMWConTalk2023-04 as slides
Wolfgang Fahl
- Computer Scientist
- Expert
- Trainer for Software Architecture and Requirements Engineering
- PhD Candidate at RWTH Aachen i5
BITPlan GmbH
- Inception: 1999
- Focus on Software-Engineering Training, Consulting, Projects …
- Switch from Lotus Notes to Semantic Mediawiki in 2013
- ProfiWiki since 2015
Agenda
Wikidata
Synchronization
SMW and Wikidata storage
- Both systems use triples: subject, predicate and object
- It's a girl revisited:
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 and Wikidata as databases?
Compare to a relational database:
- Tables are dynamically created via
- SMW ask-queries e.g.List of Persons
- Wikidata SPARQL queries e.g Recent deaths in the royal family
- A page corresponds to a row in a table
- e.g. SMW Page Elizabeth II
- e.g. Wikidata entry [1]
- A property corresponds to a column in a table
- e.g. SMW Property Property:Person died
- e.g. Wikidata Property date of death
SMW relational operations
Row and Column definition operations
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
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
- py-3rdparty-mediawiki issue #91 wikiedit allow to modify single parameter of a macro WikiSon see WikiSon
- http://family.bitplan.com/index.php/Alexandra_of_Denmark
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
Sync Royal Family
smwsync -u -t family --context FamilyContext --topic Person -p desc label died died_at --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→died_at: 100%|█████| 236/236 [01:48<00:00, 2.18it/s]
- http://royal-family.bitplan.com/index.php/Elizabeth_II
- http://family.bitplan.com/index.php/Elizabeth_II
Example: Scholary communication
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
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:
- pid: qid
smw_prop: qid
- arg: label
pid: label
smw_prop: label
- arg: desc
pid: description
pid_label: description
smw_prop: description
- arg: died
pid: P570
pid_label: date of death
smw_prop: died
- arg: died_at
pid: P20
pid_label: place of death
smw_prop: died_at
Command Line Tool
Todos
Links
- https://www.semantic-mediawiki.org/wiki/Semantic_MediaWiki
- https://www.wikidata.org/wiki/Wikidata:Main_Page
- https://wiki.bitplan.com/index.php/Py-3rdparty-mediawiki
- https://wiki.bitplan.com/index.php/PySMWSync
- https://wiki.bitplan.com/index.php/PyMetaModel
- https://wiki.bitplan.com/index.php/Py-yprinciple-gen
- https://linkml.io/