We have the following statement: Barcelona is a city in Spain, with population 1,600,0000. In MediaWiki: Barcelona is a ci...
In Semantic MediaWiki: Barcelona is a city in [[Has country::Spain]], with population [[Has population::1,600,0000]]. This...
<ul><li>In the page &quot;Property:Has country&quot;: </li></ul><ul><li>[[Has type::Page]] </li></ul><ul><li>In the page &...
<ul><li>&quot;Has type&quot; is a &quot;special property&quot;, i.e. a pre-defined property for meta-data. There are sever...
<ul><li>In a page called &quot;Property:Has priority&quot;: </li></ul><ul><li>[[Has type::String]] </li></ul><ul><li>[[All...
<ul><li>Page, String, Text, Number, Date, URL, Email, Geographic coordinate, Temperature </li></ul>
<ul><li>Shows the set of data defined on a single page </li></ul>
<ul><li>Possible solution: </li></ul><ul><li>Barcelona is a  [[Is a::city]]  in [[Has country::Spain]], with population [[...
...this is not done. Instead, category is used: Barcelona is a city in [[Has country::Spain]], with population [[Has popul...
<ul><li>Once the data is stored, we can query it! </li></ul><ul><li>Querying is done using the #ask parser function. </li>...
<ul><li>To display all the places in Spain: </li></ul><ul><li>{{#ask:[[Has country::Spain]]}} </li></ul><ul><li>All cities...
<ul><li>Get all cities in Spain with population greater than 1,000,000: </li></ul><ul><li>{{#ask: </li></ul><ul><li>[[Cate...
<ul><li>A table of cities in Spain with population greater than 1,000,000, that shows both city names and their population...
 
<ul><li>Wikipedia has thousands of category and list pages, that could be replaced by queries </li></ul>
 
 
<ul><li>{{#ask:[[Category:Cities]][[Has country::Spain]][[Has population::>1,000,000]]|format=ol}} </li></ul><ul><li>This ...
<ul><li>list, table, ol, ul, template </li></ul>
<ul><li>Timeline format: </li></ul>
 
 
 
<ul><li>Another extension, &quot;Semantic Maps&quot;, exists just for maps </li></ul><ul><li>Each page queried must have a...
 
 
Another extension, &quot;Semantic Compound Queries&quot; lets you display more than one query at the same time This is esp...
 
<ul><li>Query formats exist for exporting data in the following formats: </li></ul><ul><li>CSV </li></ul><ul><li>JSON </li...
<ul><li>Data can also be exported via RDF, RDFa and XML using various extensions. </li></ul>
<ul><li>What if we want to have a page for every city? </li></ul><ul><li>Instead of repeating the same text and semantic t...
In page &quot;Template:City&quot;: {{PAGENAME}} is a city in [[Has country::{{{Country}}}]], with population [[Has populat...
<ul><li>From “Shanghai” Wikipedia page: </li></ul>
 
<ul><li>Hide semantic markup from users </li></ul><ul><li>Allow for a consistent data structure for pages of the same type...
But even editing of template calls might be too hard for most users! Another extension, Semantic Forms, lets you create fo...
 
 
 
<ul><li>Allow for entering a table of data in a form. </li></ul>
<ul><li>In the page &quot;Category:Cities&quot;: </li></ul><ul><li>[[Has default form::City]] </li></ul><ul><li>(There are...
 
<ul><li>Semantic Forms supports different input types, depending on the type of the property associated with the field. </...
<ul><li>Used for properties of type &quot;Geographic coordinates&quot;. </li></ul>
<ul><li>support for autocompletion on both single-value and multiple-value fields </li></ul><ul><li>makes standardizing on...
 
 
Semantic Forms also provides “helper forms”
 
 
 
 
 
<ul><li>Certain pieces of information can't be stored using simple semantic triples. </li></ul><ul><li>Example: &quot;This...
This data can't be stored as a triple... instead, it requires an &quot;anonymous object&quot;: Cake recipe  Requires  X X ...
<ul><li>Defines a function, #set_internal, that creates an “anonymous object”. </li></ul><ul><li>In a page called &quot;Ca...
<ul><li>{{#ask:[[Is part of recipe::Cake recipe]] </li></ul><ul><li>|? Has quantity </li></ul><ul><li>|? Has unit </li></u...
<ul><li>Provides a drill-down, “slice-and-dice” interface to semantic data. </li></ul>
 
<ul><li>Provides a similar slice-and-dice interface, using Javascript </li></ul>
 
<ul><li>Two ways to use data from the outside: </li></ul><ul><li>Import data </li></ul><ul><li>Query data, keeping it in i...
<ul><li>“ Data Transfer” extension </li></ul><ul><li>Allows importing of XML and CSV - will soon support Excel as well </l...
<ul><li>&quot;External Data&quot; extension </li></ul><ul><li>Can query the following: </li></ul><ul><li>- web pages with ...
 
<ul><li>Because SMW can export data in CSV and JSON formats, the External Data extension can be used by one SMW wiki to ge...
<ul><li>semantic-mediawiki.org – Semantic MediaWiki homepage </li></ul><ul><li>smwforum.ontoprise.com – Ontoprise SMW+ use...
Upcoming SlideShare
Loading in …5
×

Aswc2009 Smw Tutorial Part 2 Froms Etc From Yaron

1,175 views

Published on

Part 2 of our semantic wiki tutorial for ASWC 2009. This part is from Yaron Koren.

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,175
On SlideShare
0
From Embeds
0
Number of Embeds
8
Actions
Shares
0
Downloads
33
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Aswc2009 Smw Tutorial Part 2 Froms Etc From Yaron

  1. 2. We have the following statement: Barcelona is a city in Spain, with population 1,600,0000. In MediaWiki: Barcelona is a city in [[Spain]], with population 1,600,0000.
  2. 3. In Semantic MediaWiki: Barcelona is a city in [[Has country::Spain]], with population [[Has population::1,600,0000]]. This adds to the database the two triples: Barcelona Has country Spain Barcelona Has population 1,600,0000 On the page is displayed: Barcelona is a city in Spain , with population 1,600,0000.
  3. 4. <ul><li>In the page &quot;Property:Has country&quot;: </li></ul><ul><li>[[Has type::Page]] </li></ul><ul><li>In the page &quot;Property:Has population&quot;: </li></ul><ul><li>[[Has type::Number]] </li></ul>
  4. 5. <ul><li>&quot;Has type&quot; is a &quot;special property&quot;, i.e. a pre-defined property for meta-data. There are several other special properties. </li></ul>
  5. 6. <ul><li>In a page called &quot;Property:Has priority&quot;: </li></ul><ul><li>[[Has type::String]] </li></ul><ul><li>[[Allows value::Low]], [[Allows value::Medium]], [[Allows value::High]] </li></ul>
  6. 7. <ul><li>Page, String, Text, Number, Date, URL, Email, Geographic coordinate, Temperature </li></ul>
  7. 8. <ul><li>Shows the set of data defined on a single page </li></ul>
  8. 9. <ul><li>Possible solution: </li></ul><ul><li>Barcelona is a [[Is a::city]] in [[Has country::Spain]], with population [[Has population::1,600,0000]]. </li></ul>
  9. 10. ...this is not done. Instead, category is used: Barcelona is a city in [[Has country::Spain]], with population [[Has population::1,600,000]]. [[Category::Cities]] Categories are used for defining class because they allow for inheritance. Example - a member of category &quot;Cities&quot; would also be a member of category &quot;Locations&quot;, if &quot;Cities&quot; is a subcategory of &quot;Locations&quot;.
  10. 11. <ul><li>Once the data is stored, we can query it! </li></ul><ul><li>Querying is done using the #ask parser function. </li></ul>
  11. 12. <ul><li>To display all the places in Spain: </li></ul><ul><li>{{#ask:[[Has country::Spain]]}} </li></ul><ul><li>All cities in Spain: </li></ul><ul><li>{{#ask:[[Category:Cities]][[Has country::Spain]]}} </li></ul>
  12. 13. <ul><li>Get all cities in Spain with population greater than 1,000,000: </li></ul><ul><li>{{#ask: </li></ul><ul><li>[[Category:Cities]] </li></ul><ul><li>[[Has country::Spain]] </li></ul><ul><li>[[Has population::>1,000,000]] </li></ul><ul><li>}} </li></ul>
  13. 14. <ul><li>A table of cities in Spain with population greater than 1,000,000, that shows both city names and their population: </li></ul><ul><li>{{#ask: </li></ul><ul><li>[[Category:Cities]] </li></ul><ul><li>[[Has country::Spain]] </li></ul><ul><li>[[Has population::>1,000,000]] </li></ul><ul><li>|? Has population </li></ul><ul><li>}} </li></ul>
  14. 16. <ul><li>Wikipedia has thousands of category and list pages, that could be replaced by queries </li></ul>
  15. 19. <ul><li>{{#ask:[[Category:Cities]][[Has country::Spain]][[Has population::>1,000,000]]|format=ol}} </li></ul><ul><li>This displays a numbered list, i.e. the <ol> tag: </li></ul><ul><li>1. Madrid </li></ul><ul><li>2. Barcelona </li></ul>
  16. 20. <ul><li>list, table, ol, ul, template </li></ul>
  17. 21. <ul><li>Timeline format: </li></ul>
  18. 25. <ul><li>Another extension, &quot;Semantic Maps&quot;, exists just for maps </li></ul><ul><li>Each page queried must have a property of type &quot;Geographic coordinates&quot;. </li></ul>
  19. 28. Another extension, &quot;Semantic Compound Queries&quot; lets you display more than one query at the same time This is especially useful for maps - each query can get its own icon.
  20. 30. <ul><li>Query formats exist for exporting data in the following formats: </li></ul><ul><li>CSV </li></ul><ul><li>JSON </li></ul><ul><li>RSS </li></ul><ul><li>iCalendar </li></ul><ul><li>vCard </li></ul><ul><li>BibTeX </li></ul>
  21. 31. <ul><li>Data can also be exported via RDF, RDFa and XML using various extensions. </li></ul>
  22. 32. <ul><li>What if we want to have a page for every city? </li></ul><ul><li>Instead of repeating the same text and semantic tags in each page, we can use MediaWiki templates to make the process easier. </li></ul>
  23. 33. In page &quot;Template:City&quot;: {{PAGENAME}} is a city in [[Has country::{{{Country}}}]], with population [[Has population::{{{Population}}}]]. [[Category:Cities]] In page &quot;Barcelona&quot;: {{City |Country=Spain |Population=1,000,000}}
  24. 34. <ul><li>From “Shanghai” Wikipedia page: </li></ul>
  25. 36. <ul><li>Hide semantic markup from users </li></ul><ul><li>Allow for a consistent data structure for pages of the same type </li></ul><ul><li>Pre-define the display </li></ul>
  26. 37. But even editing of template calls might be too hard for most users! Another extension, Semantic Forms, lets you create forms to edit those template calls
  27. 41. <ul><li>Allow for entering a table of data in a form. </li></ul>
  28. 42. <ul><li>In the page &quot;Category:Cities&quot;: </li></ul><ul><li>[[Has default form::City]] </li></ul><ul><li>(There are other ways, but this is the standard one) </li></ul>
  29. 44. <ul><li>Semantic Forms supports different input types, depending on the type of the property associated with the field. </li></ul><ul><li>String, Page, Number – text entry </li></ul><ul><li>Text – textarea </li></ul><ul><li>Boolean – checkbox </li></ul><ul><li>Date – date input or Javascript datepicker </li></ul><ul><li>“ Enumeration” (Page or String with “allowed values”) - dropdown or radiobutton </li></ul><ul><li>list of &quot;Enumerations&quot; - listbox or checkboxes </li></ul>
  30. 45. <ul><li>Used for properties of type &quot;Geographic coordinates&quot;. </li></ul>
  31. 46. <ul><li>support for autocompletion on both single-value and multiple-value fields </li></ul><ul><li>makes standardizing on names easier, prevents spelling mistakes </li></ul>
  32. 49. Semantic Forms also provides “helper forms”
  33. 55. <ul><li>Certain pieces of information can't be stored using simple semantic triples. </li></ul><ul><li>Example: &quot;This cake recipe requires 2 cups of flour&quot;. </li></ul>
  34. 56. This data can't be stored as a triple... instead, it requires an &quot;anonymous object&quot;: Cake recipe Requires X X Has quantity 2 X Has unit Cup X Has ingredient Flour
  35. 57. <ul><li>Defines a function, #set_internal, that creates an “anonymous object”. </li></ul><ul><li>In a page called &quot;Cake recipe&quot;: </li></ul><ul><li>{{#set_internal: </li></ul><ul><li>Is part of recipe </li></ul><ul><li>|Has quantity=2 </li></ul><ul><li>|Has unit=Cup </li></ul><ul><li>|Has ingredient=Flour </li></ul><ul><li>}} </li></ul>
  36. 58. <ul><li>{{#ask:[[Is part of recipe::Cake recipe]] </li></ul><ul><li>|? Has quantity </li></ul><ul><li>|? Has unit </li></ul><ul><li>|? Has ingredient </li></ul><ul><li>}} </li></ul>
  37. 59. <ul><li>Provides a drill-down, “slice-and-dice” interface to semantic data. </li></ul>
  38. 61. <ul><li>Provides a similar slice-and-dice interface, using Javascript </li></ul>
  39. 63. <ul><li>Two ways to use data from the outside: </li></ul><ul><li>Import data </li></ul><ul><li>Query data, keeping it in its original location </li></ul>
  40. 64. <ul><li>“ Data Transfer” extension </li></ul><ul><li>Allows importing of XML and CSV - will soon support Excel as well </li></ul><ul><li>Usually: each row of data is saved as a template call in a separate page </li></ul>
  41. 65. <ul><li>&quot;External Data&quot; extension </li></ul><ul><li>Can query the following: </li></ul><ul><li>- web pages with data in XML, CSV or JSON format </li></ul><ul><li>- databases </li></ul><ul><li>- LDAP servers </li></ul><ul><li>Data can be queried and then displayed on the page, or even stored semantically. </li></ul>
  42. 67. <ul><li>Because SMW can export data in CSV and JSON formats, the External Data extension can be used by one SMW wiki to get the data from another one. </li></ul>
  43. 68. <ul><li>semantic-mediawiki.org – Semantic MediaWiki homepage </li></ul><ul><li>smwforum.ontoprise.com – Ontoprise SMW+ user forum </li></ul><ul><li>referata.com – Referata – SMW wiki hosting </li></ul><ul><li>wikiworks.com – (shameless plug!) WikiWorks, an SMW-focused consulting company </li></ul>

×