When I last tried semantic mediawiki (years ago), it permitted (perhaps even emphasized) generating structured data through writing that contained typed links. The "type" was a predicate that explained the relationship between two pages. I think it was also possible to store a tuple of data inside the link, which may convey the strength of the predicate (for example) when such information was important and ignore it when it was not important (I may be confusing this functionality with another extension)
Is any of this inline schema building possible with Cargo or are all typed links made in the form data fields? For example, in the common AUTHORS and BOOKS example, what happens if the AUTHOR is actually unknown but there are several *likely* AUTHORS? One option may be to add a whole field to BOOKS for LIKELY AUTHORS. Another way might be to create an intermediate page AUTHORSHIP that ties AUTHOR to BOOK with a field that explains the relationship in more detail. But, perhaps there is a way to add more nuance to the AUTHOR assignment itself? Could this information be conveyed in the AUTHORS field through an additional piece of information placed in parentheses?
-david
Hi David,
Right, Cargo is stricter than Semantic MediaWiki about entering data: you can't come up with your own property names and their values. I think that’s a plus: the data structure, set of allowed values, etc. should be consistent across all pages, not subject to arbitrary changes on individual pages. If there are subtleties in the data that can't be fully handled with the current structure (and there often are), then you indeed may have to consider those kinds of of options, and decide in each case on the best tradeoff between simplicity and flexibility.
-Yaron
On Thu, Aug 26, 2021, 9:43 AM David Epstein davideps@umich.edu wrote:
When I last tried semantic mediawiki (years ago), it permitted (perhaps even emphasized) generating structured data through writing that contained typed links. The "type" was a predicate that explained the relationship between two pages. I think it was also possible to store a tuple of data inside the link, which may convey the strength of the predicate (for example) when such information was important and ignore it when it was not important (I may be confusing this functionality with another extension)
Is any of this inline schema building possible with Cargo or are all typed links made in the form data fields? For example, in the common AUTHORS and BOOKS example, what happens if the AUTHOR is actually unknown but there are several *likely* AUTHORS? One option may be to add a whole field to BOOKS for LIKELY AUTHORS. Another way might be to create an intermediate page AUTHORSHIP that ties AUTHOR to BOOK with a field that explains the relationship in more detail. But, perhaps there is a way to add more nuance to the AUTHOR assignment itself? Could this information be conveyed in the AUTHORS field through an additional piece of information placed in parentheses?
-david
MediaWiki-l mailing list -- mediawiki-l@lists.wikimedia.org List information: https://lists.wikimedia.org/postorius/lists/mediawiki-l.lists.wikimedia.org/
If a class has a *composed_of *property and a *part_of* property, can I define these somewhere as inverse relationships? I'd like to set Idaho as *part_of* the USA and then (automatically) see that assignment in USA's *composed_of *list?
Moreover, is it possible to specify that the properties have a more specific domain, not just any page but only pages from the category "Place"?
I think the normal way to do this in Cargo would be not to have the inverse property stored in a page's data, but rather to query the inverse wherever required. So, for example, an Idaho page would define part_of as USA, and then on the USA page you could have a template that displays all the composed_of pages: {{#cargo query: tables = places | where = part_of HOLDS 'USA' }}. This way, there's no double-entry of values and so nothing to get out of sync.
On 31/8/21 6:42 am, David Epstein wrote:
If a class has a /composed_of /property and a /part_of/ property, can I define these somewhere as inverse relationships? I'd like to set Idaho as /part_of/ the USA and then (automatically) see that assignment in USA's /composed_of /list?
Moreover, is it possible to specify that the properties have a more specific domain, not just any page but only pages from the category "Place"?
MediaWiki-l mailing list -- mediawiki-l@lists.wikimedia.org List information: https://lists.wikimedia.org/postorius/lists/mediawiki-l.lists.wikimedia.org/
Thanks Sam. I'll query the inverse.
On Mon, Aug 30, 2021 at 9:11 PM Sam Wilson sam@samwilson.id.au wrote:
I think the normal way to do this in Cargo would be not to have the inverse property stored in a page's data, but rather to query the inverse wherever required. So, for example, an Idaho page would define part_of as USA, and then on the USA page you could have a template that displays all the composed_of pages: {{#cargo query: tables = places | where = part_of HOLDS 'USA' }}. This way, there's no double-entry of values and so nothing to get out of sync. On 31/8/21 6:42 am, David Epstein wrote:
If a class has a *composed_of *property and a *part_of* property, can I define these somewhere as inverse relationships? I'd like to set Idaho as *part_of* the USA and then (automatically) see that assignment in USA's *composed_of *list?
Moreover, is it possible to specify that the properties have a more specific domain, not just any page but only pages from the category "Place"?
MediaWiki-l mailing list -- mediawiki-l@lists.wikimedia.org List information: https://lists.wikimedia.org/postorius/lists/mediawiki-l.lists.wikimedia.org/
MediaWiki-l mailing list -- mediawiki-l@lists.wikimedia.org List information: https://lists.wikimedia.org/postorius/lists/mediawiki-l.lists.wikimedia.org/
Sam and Yaron,
I'm trying to implement the inverse of PartOf (ComposedOf) as discussed on this list a few days ago (also at end of this email). I'm using Cargo, PageSchemas, and PageForms. My understanding is that ComposedOf would not be part of the schema, but would be a manual edit to the automatically generated template for the *Place* category. Below is the template code with the manual edits in color. The first "_pageName" refers to data in Cargo tables. The second "_pageName" is the current page being displayed, which I don't know how to specify in this context. This code results in no error and no text after the "ComposedOf" label. When viewing the place "Sol System", the ComposedOf text should include links to Earth and Mars, since they are both currently in the Place table as PartOf the Sol System. In this context, the second _pageName should return "Sol System" (or "Sol_System" ?).
<noinclude> {{#template_params:Type|PartOf (label=Part Of)|ComposedOf}} {{#cargo_declare:_table=Place|Type=Page (allowed values=SolarSystem,AsteroidBelt,Asteroid,Planet,WaterBody,Continent,GeographicEntity,Nation,SubNationalRegion,City,Neighborhood,Street,Building,Room)|PartOf=Page |ComposedOf={{#cargo_query:table=Place|fields=Place._pageName|where = PartOf HOLDS "_pageName"}}}} </noinclude><includeonly>{{#cargo_store:_table=Place}} {{#template_display:_format=standard}} [[Category:Place]] </includeonly>
I pushed on "Recreate Data" in the Template menu, which may explain how "ComposedOf" got added to the table. I did not add ComposedOf to the schema. Here is the Place table:
Page Type PartOf ComposedOf Earth Planet Sol System Mars Planet Sol System Sol System SolarSystem
-david
On Mon, Aug 30, 2021 at 9:11 PM Sam Wilson sam@samwilson.id.au wrote:
I think the normal way to do this in Cargo would be not to have the inverse property stored in a page's data, but rather to query the inverse wherever required. So, for example, an Idaho page would define part_of as USA, and then on the USA page you could have a template that displays all the composed_of pages: {{#cargo query: tables = places | where = part_of HOLDS 'USA' }}. This way, there's no double-entry of values and so nothing to get out of sync. On 31/8/21 6:42 am, David Epstein wrote:
If a class has a *composed_of *property and a *part_of* property, can I define these somewhere as inverse relationships? I'd like to set Idaho as *part_of* the USA and then (automatically) see that assignment in USA's *composed_of *list?
Moreover, is it possible to specify that the properties have a more specific domain, not just any page but only pages from the category "Place"?
MediaWiki-l mailing list -- mediawiki-l@lists.wikimedia.org List information: https://lists.wikimedia.org/postorius/lists/mediawiki-l.lists.wikimedia.org/
MediaWiki-l mailing list -- mediawiki-l@lists.wikimedia.org List information: https://lists.wikimedia.org/postorius/lists/mediawiki-l.lists.wikimedia.org/
Hi David,
You shouldn't be storing inverse relationships (like "ComposedOf") at all - rather, that information should get directly queried whenever you want to display it. And the variable to use, when you want to display a page's name, is {{PAGENAME}} - so, in the template, you could add a query like:
{{#cargo_query:table=Place|fields=_pageName|where=PartOf = '{{PAGENAME}}'}}
-Yaron
On Fri, Sep 3, 2021 at 8:03 PM David Epstein davideps@umich.edu wrote:
Sam and Yaron,
I'm trying to implement the inverse of PartOf (ComposedOf) as discussed on this list a few days ago (also at end of this email). I'm using Cargo, PageSchemas, and PageForms. My understanding is that ComposedOf would not be part of the schema, but would be a manual edit to the automatically generated template for the *Place* category. Below is the template code with the manual edits in color. The first "_pageName" refers to data in Cargo tables. The second "_pageName" is the current page being displayed, which I don't know how to specify in this context. This code results in no error and no text after the "ComposedOf" label. When viewing the place "Sol System", the ComposedOf text should include links to Earth and Mars, since they are both currently in the Place table as PartOf the Sol System. In this context, the second _pageName should return "Sol System" (or "Sol_System" ?).
<noinclude> {{#template_params:Type|PartOf (label=Part Of)|ComposedOf}} {{#cargo_declare:_table=Place|Type=Page (allowed values=SolarSystem,AsteroidBelt,Asteroid,Planet,WaterBody,Continent,GeographicEntity,Nation,SubNationalRegion,City,Neighborhood,Street,Building,Room)|PartOf=Page |ComposedOf={{#cargo_query:table=Place|fields=Place._pageName|where = PartOf HOLDS "_pageName"}}}} </noinclude><includeonly>{{#cargo_store:_table=Place}} {{#template_display:_format=standard}} [[Category:Place]] </includeonly>
I pushed on "Recreate Data" in the Template menu, which may explain how "ComposedOf" got added to the table. I did not add ComposedOf to the schema. Here is the Place table:
Page Type PartOf ComposedOf Earth Planet Sol System Mars Planet Sol System Sol System SolarSystem
-david
On Mon, Aug 30, 2021 at 9:11 PM Sam Wilson sam@samwilson.id.au wrote:
I think the normal way to do this in Cargo would be not to have the inverse property stored in a page's data, but rather to query the inverse wherever required. So, for example, an Idaho page would define part_of as USA, and then on the USA page you could have a template that displays all the composed_of pages: {{#cargo query: tables = places | where = part_of HOLDS 'USA' }}. This way, there's no double-entry of values and so nothing to get out of sync. On 31/8/21 6:42 am, David Epstein wrote:
If a class has a *composed_of *property and a *part_of* property, can I define these somewhere as inverse relationships? I'd like to set Idaho as *part_of* the USA and then (automatically) see that assignment in USA's *composed_of *list?
Moreover, is it possible to specify that the properties have a more specific domain, not just any page but only pages from the category "Place"?
MediaWiki-l mailing list -- mediawiki-l@lists.wikimedia.org List information: https://lists.wikimedia.org/postorius/lists/mediawiki-l.lists.wikimedia.org/
MediaWiki-l mailing list -- mediawiki-l@lists.wikimedia.org List information: https://lists.wikimedia.org/postorius/lists/mediawiki-l.lists.wikimedia.org/
MediaWiki-l mailing list -- mediawiki-l@lists.wikimedia.org List information: https://lists.wikimedia.org/postorius/lists/mediawiki-l.lists.wikimedia.org/
Thank you
On Sun, Sep 5, 2021, 10:14 PM Yaron Koren yaron57@gmail.com wrote:
Hi David,
You shouldn't be storing inverse relationships (like "ComposedOf") at all
- rather, that information should get directly queried whenever you want to
display it. And the variable to use, when you want to display a page's name, is {{PAGENAME}} - so, in the template, you could add a query like:
{{#cargo_query:table=Place|fields=_pageName|where=PartOf = '{{PAGENAME}}'}}
-Yaron
On Fri, Sep 3, 2021 at 8:03 PM David Epstein davideps@umich.edu wrote:
Sam and Yaron,
I'm trying to implement the inverse of PartOf (ComposedOf) as discussed on this list a few days ago (also at end of this email). I'm using Cargo, PageSchemas, and PageForms. My understanding is that ComposedOf would not be part of the schema, but would be a manual edit to the automatically generated template for the *Place* category. Below is the template code with the manual edits in color. The first "_pageName" refers to data in Cargo tables. The second "_pageName" is the current page being displayed, which I don't know how to specify in this context. This code results in no error and no text after the "ComposedOf" label. When viewing the place "Sol System", the ComposedOf text should include links to Earth and Mars, since they are both currently in the Place table as PartOf the Sol System. In this context, the second _pageName should return "Sol System" (or "Sol_System" ?).
<noinclude> {{#template_params:Type|PartOf (label=Part Of)|ComposedOf}} {{#cargo_declare:_table=Place|Type=Page (allowed values=SolarSystem,AsteroidBelt,Asteroid,Planet,WaterBody,Continent,GeographicEntity,Nation,SubNationalRegion,City,Neighborhood,Street,Building,Room)|PartOf=Page |ComposedOf={{#cargo_query:table=Place|fields=Place._pageName|where = PartOf HOLDS "_pageName"}}}} </noinclude><includeonly>{{#cargo_store:_table=Place}} {{#template_display:_format=standard}} [[Category:Place]] </includeonly>
I pushed on "Recreate Data" in the Template menu, which may explain how "ComposedOf" got added to the table. I did not add ComposedOf to the schema. Here is the Place table:
Page Type PartOf ComposedOf Earth Planet Sol System Mars Planet Sol System Sol System SolarSystem
-david
On Mon, Aug 30, 2021 at 9:11 PM Sam Wilson sam@samwilson.id.au wrote:
I think the normal way to do this in Cargo would be not to have the inverse property stored in a page's data, but rather to query the inverse wherever required. So, for example, an Idaho page would define part_of as USA, and then on the USA page you could have a template that displays all the composed_of pages: {{#cargo query: tables = places | where = part_of HOLDS 'USA' }}. This way, there's no double-entry of values and so nothing to get out of sync. On 31/8/21 6:42 am, David Epstein wrote:
If a class has a *composed_of *property and a *part_of* property, can I define these somewhere as inverse relationships? I'd like to set Idaho as *part_of* the USA and then (automatically) see that assignment in USA's *composed_of *list?
Moreover, is it possible to specify that the properties have a more specific domain, not just any page but only pages from the category "Place"?
MediaWiki-l mailing list -- mediawiki-l@lists.wikimedia.org List information: https://lists.wikimedia.org/postorius/lists/mediawiki-l.lists.wikimedia.org/
MediaWiki-l mailing list -- mediawiki-l@lists.wikimedia.org List information: https://lists.wikimedia.org/postorius/lists/mediawiki-l.lists.wikimedia.org/
MediaWiki-l mailing list -- mediawiki-l@lists.wikimedia.org List information: https://lists.wikimedia.org/postorius/lists/mediawiki-l.lists.wikimedia.org/
-- WikiWorks · MediaWiki Consulting · http://wikiworks.com _______________________________________________ MediaWiki-l mailing list -- mediawiki-l@lists.wikimedia.org List information: https://lists.wikimedia.org/postorius/lists/mediawiki-l.lists.wikimedia.org/
Hi Yaron,
Thank you. I'm not trying to store the ComposedOf data but to query PartOf as you and Sam suggest. For example, I do not even mention ComposedOf in the Form. I mention it in the Template, but perhaps did so incorrectly so that when I pressed "Recreate Data" it added a column? Regardless, I'll continue to experiment and get it working. Thank you for these great tools!
-david
On Sun, Sep 5, 2021 at 11:14 PM Yaron Koren yaron57@gmail.com wrote:
Hi David,
You shouldn't be storing inverse relationships (like "ComposedOf") at all
- rather, that information should get directly queried whenever you want to
display it. And the variable to use, when you want to display a page's name, is {{PAGENAME}} - so, in the template, you could add a query like:
{{#cargo_query:table=Place|fields=_pageName|where=PartOf = '{{PAGENAME}}'}}
-Yaron
On Fri, Sep 3, 2021 at 8:03 PM David Epstein davideps@umich.edu wrote:
Sam and Yaron,
I'm trying to implement the inverse of PartOf (ComposedOf) as discussed on this list a few days ago (also at end of this email). I'm using Cargo, PageSchemas, and PageForms. My understanding is that ComposedOf would not be part of the schema, but would be a manual edit to the automatically generated template for the *Place* category. Below is the template code with the manual edits in color. The first "_pageName" refers to data in Cargo tables. The second "_pageName" is the current page being displayed, which I don't know how to specify in this context. This code results in no error and no text after the "ComposedOf" label. When viewing the place "Sol System", the ComposedOf text should include links to Earth and Mars, since they are both currently in the Place table as PartOf the Sol System. In this context, the second _pageName should return "Sol System" (or "Sol_System" ?).
<noinclude> {{#template_params:Type|PartOf (label=Part Of)|ComposedOf}} {{#cargo_declare:_table=Place|Type=Page (allowed values=SolarSystem,AsteroidBelt,Asteroid,Planet,WaterBody,Continent,GeographicEntity,Nation,SubNationalRegion,City,Neighborhood,Street,Building,Room)|PartOf=Page |ComposedOf={{#cargo_query:table=Place|fields=Place._pageName|where = PartOf HOLDS "_pageName"}}}} </noinclude><includeonly>{{#cargo_store:_table=Place}} {{#template_display:_format=standard}} [[Category:Place]] </includeonly>
I pushed on "Recreate Data" in the Template menu, which may explain how "ComposedOf" got added to the table. I did not add ComposedOf to the schema. Here is the Place table:
Page Type PartOf ComposedOf Earth Planet Sol System Mars Planet Sol System Sol System SolarSystem
-david
On Mon, Aug 30, 2021 at 9:11 PM Sam Wilson sam@samwilson.id.au wrote:
I think the normal way to do this in Cargo would be not to have the inverse property stored in a page's data, but rather to query the inverse wherever required. So, for example, an Idaho page would define part_of as USA, and then on the USA page you could have a template that displays all the composed_of pages: {{#cargo query: tables = places | where = part_of HOLDS 'USA' }}. This way, there's no double-entry of values and so nothing to get out of sync. On 31/8/21 6:42 am, David Epstein wrote:
If a class has a *composed_of *property and a *part_of* property, can I define these somewhere as inverse relationships? I'd like to set Idaho as *part_of* the USA and then (automatically) see that assignment in USA's *composed_of *list?
Moreover, is it possible to specify that the properties have a more specific domain, not just any page but only pages from the category "Place"?
MediaWiki-l mailing list -- mediawiki-l@lists.wikimedia.org List information: https://lists.wikimedia.org/postorius/lists/mediawiki-l.lists.wikimedia.org/
MediaWiki-l mailing list -- mediawiki-l@lists.wikimedia.org List information: https://lists.wikimedia.org/postorius/lists/mediawiki-l.lists.wikimedia.org/
MediaWiki-l mailing list -- mediawiki-l@lists.wikimedia.org List information: https://lists.wikimedia.org/postorius/lists/mediawiki-l.lists.wikimedia.org/
-- WikiWorks · MediaWiki Consulting · http://wikiworks.com _______________________________________________ MediaWiki-l mailing list -- mediawiki-l@lists.wikimedia.org List information: https://lists.wikimedia.org/postorius/lists/mediawiki-l.lists.wikimedia.org/
mediawiki-l@lists.wikimedia.org