Extension talk:Semantic Internal Objects

From MediaWiki.org
Jump to: navigation, search
An archive box Archives 

Property type for the 'first argument'?[edit | edit source]

The first argument, "a property pointing from the object, to the page", is a property like any other in the wiki. What property type should it be? By default it's page, which means it's values are links to non-existent pages. Should it be changed to string? Does the setting have any effect? It's a bit confusing, so perhaps some recommendation should be made on the page. Cheers, --Dan Bolser 14:06, 14 January 2012 (UTC)

Could we even consider a special type for the property? i.e. by default it could be a property of type SIO or something? --Dan Bolser 14:07, 14 January 2012 (UTC)
It should just be a property of type "page". The documentation could probably be clearer about that. Yaron Koren 05:30, 15 January 2012 (UTC)

Semantic Mediawiki 1.7[edit | edit source]


I saw that the 1.7 version of Semantic Mediawiki includes SIO natively through the #subobject perser function. Does it have all the same functionalities and query syntax ? Regarding bugs, which version of SIO got into SMW ?

Actually, what's included isn't SIO, but similar functionality. That's a good question, though - I just added a section to the documentation that tries to explain this; hopefully it makes sense. Yaron Koren 13:54, 20 January 2012 (UTC)

set_internal_recurring_event, unit=year[edit | edit source]

I want to do {{#set_internal_recurring_event:Is instance of |property=Heeft verjaardag |start=January 4, 2010 |unit=year |period=1 }} but all instances are on the same date. The same behaviour for unit=month, but unit=day and unit=week behave as expected. What is wrong? I use Semantic Internal Objects (Versie 0.6.8), Semantic MediaWiki (Versie 1.7.1) and MediaWiki (Versie 1.18.1) --Egel (talk) 22:40, 23 March 2012 (UTC)

That's pretty bad - this turned out to be a bug in Semantic MediaWiki itself, since January. I just fixed it in SVN. If you don't have SVN, you can duplicate the fix yourself, here. Yaron Koren (talk) 15:02, 25 March 2012 (UTC)
Hello, I still have problems setting recurring events with Internal Objects (Versie 0.6.8), Semantic MediaWiki (Versie 1.7.1). What I see is that when I run the query the event as not repeated, while if I just use #set_recurring_event everything works normally. This happens with the same example reported in the wiki page. Does anybody have a clue? I am quite newbie so I could be missing something obvious. Paolo
Is this happening on a public wiki? If not, could you try to reproduce it on scratchpad.referata.com? Yaron Koren (talk) 02:21, 22 May 2012 (UTC)
Hi Yaron. Thank you for the reply. The wiki is not public yet. I tried to reproduce the problem here.
Ok, I fixed the problem. There was a php error when running the database update. I saw it enabling error_reporting( E_ALL ); ini_set( 'display_errors', 1 ); in the LocalSettings.php file. However I have another issue: when I ask for a property based on its value, the query returns all the pages containing that property, watever value is specified. I saw that on on scratchpad.referata.com it is the same. Is this related with the InternalOnject extension? (I fixed this by defining the property of type string and adding '~' to the query) Paolo

Using set_internal_recurring_events for date ranges[edit | edit source]

Dear Yaron. There are at least two different types of date ranges that are standard fare in historical research:

1. (c.) A – (c.) B: meaning that something, e.g. a war or a person’s floruit, lasted from (circa) start date A to (circa) start date B
2. A x B: meaning that something took place sometime between A (terminus post quem) and B (terminus ante quem).

I presume that SIO storage and querying can be used for a continuum like #1, although it's not an actual continuum in semantic terms and approximate dates can be tricky, and probably #2, as long as it’s clear that searching for matches in a given date range can only produce tentative results.

The main problem I had is that the span of such a range can be well over a century. If I understand things correctly, SIO would then store a value for every day that falls within the range until a maximum is reached, at the risk of overloading the database. That doesn’t seem to me like a very efficient way of handling date ranges.

Do you have suggestions or know of any alternative approaches? Cavila MW 1.17, MySQL 5.5.16, Php 5.3.8 22:55, 21 May 2012 (UTC)

Hi - yes, indeed that's not efficient; I wouldn't use recurring events for historical stuff. Can't you just store a start date and end date (pretending that these are exact dates, and not just "circa"), and then query on those? Yaron Koren (talk) 02:23, 22 May 2012 (UTC)
Well, the main objection to that approach would be that a query could be skipping over relevant data. For instance, if you need to query on organisations that were active between 1920 and 1950, but one organisation was founded in 1910 and discontinued in 1960, it will not be included in your results. I know you can keep overload to a minimum by changing the unit in SIO from "day" to "year" or even 20 years (unit=year, period=20). Since these are ad hoc solutions that could work in certain situations but not in others, maybe the safest solutions is to restrict the possible date ranges that are used in queries in advance and use that as the basis for a SIO storage plan. So if you decide beforehand that for certain data, queried ranges should not be below 20 years, it would be enough to create intervals of 20 years (in the example above, you would get 1910, 1930, 1950 and 1960). It may not be an ideal solution and won’t work for calendar and eventline outputs, but it should be feasible. Cavila MW 1.17, MySQL 5.5.16, Php 5.3.8 13:51, 22 May 2012 (UTC)
I still think you could do it with just queries. In your case, I'm not sure whether you mean organizations that were active in any year between 1920 and 1950, or all the years. If it's the first one, you could query on (start date <= 1950 AND end date >= 1920), while if it's the second one, you could query on (start date <= 1920 AND end date >= 1950). Yaron Koren (talk) 14:23, 22 May 2012 (UTC)
Thanks, I hadn't thought of using comparators like that (obvious as it may seem to you)! Yes, I did mean any year and it works as expected. The only mystery now remaining is that values of date-type properties get subtracted, e.g. "1500" is stored as "1499", but I guess that's for a different forum. Cavila MW 1.17, MySQL 5.5.16, Php 5.3.8 23:45, 22 May 2012 (UTC)
FYI: Filed as bug 37038 Cavila MW 1.17, MySQL 5.5.23, Php 5.3.10, SMW 1.7.1 07:17, 23 May 2012 (UTC)

Recipe example seems flawed[edit | edit source]

The documentation states:

Internal objects, once stored, can be queried as if they were wiki pages. So the following query would show a table of all the recipes that contain more than 1/2 a cup of flour, and the number of cups they contain.

Perhaps I'm missing something but the query doesn't actually show a table of recipes as stated. Rather, it displays a table of recipe components without links back to the page which defines them. As such, the recipe example seems fundamentally flawed. A query for recipes containing 0.5/cup of flour doesn't return the recipes which require 0.5/cup of flour, but rather simply all recipe line-items for 0.5/cup of flour. It provides no means to connect these line-items to the recipe, does it? Is mainlabel=- is omitted, somewhat ugly links are added to the subobjects themselves (and thus the page containing them), but as far as I can see there is no way to output a link to the page which defines that object.

This could be worked around by, for example, adding the property Is part of recipe={{PAGENAME}}. Is this necessary for the recipe example to function as intended, or am I missing something? Thanks :) Andru

Yes, you're missing something - the first parameter to #set_internal - "Part of recipe", in the case of the example - is set to point to the page that it's on; so it's implicitly calling "Part of recipe={{PAGENAME}}". Yaron Koren (talk) 02:21, 8 June 2012 (UTC)
Superb. Not sure how I missed that. Thanks for the help :) - Andru

Question concerning special character sequences[edit | edit source]

Hi Yaron,

thanks for your outstanding work. One Question: On http://semantic-mediawiki.org/wiki/Help:Type_String they say:

  • If you want to store special character sequences like "::", you need to store them using the parser function #set, instead of with the more standard "[[property::value]]" notation.

Question: Does SIO act likewise, is it possible to store special character sequences?

-- 13:05, 26 June 2012 (UTC)

Hi, thanks. I think so, yes. Yaron Koren (talk) 14:40, 26 June 2012 (UTC)

SIO Inserted Repeatedly (Object Duplication)[edit | edit source]

I appear to be having this problem, referenced in archived talk pages:

It appears to be related to my use of the Text data type. SIO is set using a template:

  Set the Internal Object

-->{{#set_internal:Subject significant to mission
  | From page={{PAGENAME}}
  | Has date={{#show: {{PAGENAME}} | ?Start date }} 
  | Has related subject#list={{{Has related subject|}}}
  | Has significance={{{Has significance|}}}

Display the data in a table

-->|- class="zebra-row"
! style="vertical-align:top;" | {{#arraymap:{{{Has related subject|}}}|,|x|[[x]]}}
| style="vertical-align:top;" | {{{Has significance|}}}{{PAGENAME}}
  • From page: Sidenote: I think this might be excessive, and there may be a better way to point to the page the SIO was created on
  • Has date: Need to be able to query SIOs and sort by date...have to duplicate date here
  • Has related subject: List of wiki pages that this SIO is related to. The contents of this SIO are auto-populated on these pages using Extension:Header Footer.
  • Has significance: This is the property I'm seeing duplicated. It is currently set as a Text property.

On each page the the SIO is retrieved using the following query:

{{#ask: [[Subject significant to mission::+]][[Has related subject::{{PAGENAME}}]]
|? From page
|? Has date
|? Has related subject
|? Has significance
|link = none
|format = template
|template = Mission references row
|intro = <h2 style="margin-top:15px;">Mission References</h2>
|introtemplate = Mission references table start
|outrotemplate = HTML table end
|offset = 0
|limit = 10
|sort = Has date
|order = DESC
|searchlabel=Click to browse earlier mission references

My stack is:

  • Windows NT 6.1 build 7601 with Microsoft-IIS/7.5
  • MW: 1.17.0
  • PHP: 5.2.14 (cgi-fcgi)
  • MySQL 5.5.25-log
  • SMW 1.7.1
  • Semantic Compound Queries 0.3.2
  • Semantic Forms 2.4.2
  • SIO 0.6.8
  • WhoIsWatching 0.10
  • CharInsert
  • Cite
  • DynamicPageList
  • External Data
  • LabeledSectionTransclusion
  • ParserFunctions
  • Pipe Escape
  • HeaderFooter
  • StubManager
  • Validator
  • Vector extension
That's unfortunate. Yes, "From page" is unnecessary - that first value you passed in, "Subject significant to mission", is already the name of a property that points back to that page. Maybe simplifying that will fix the problem? Who knows. Yaron Koren (talk) 00:24, 6 July 2012 (UTC)

-- 18:10, 6 July 2012 (UTC) Same duplication with my installation. (Downloaded latest versions (one week ago) and mediawiki 1.18 Every page reload of very simple SIO duplicates the TEXT properties Nothing complicated At 'save' it's ok again. But: Thanks for the great work! Norbert

queries on values in multiple use templates[edit | edit source]

I have tasks that are being tracked on a client form.

My client wants a list of tasks that are assigned to herself. Of course the task form is an embedded template and can be used multiple times. This creates multiple task values. Some of those values are my clients and some are her employees.

When I use the table format query all the items display in the table center justified and you can't clearly see what Task Due date lines up with Task. Plus the query doesn't filter out the task assignment. It shows all the task not just Task Assignment property.

{{#ask:Task Assignment::CathyTask Completion::No |?Task |?Task Assignment |?Task Due Date |?Task Note |?Task Completion |format=broadtable |sort=Task Assignment |headers=plain |mainlabel=Clients |link=all |class=sortable wikitable smwtable }}

Is there a solution here to query on multiple values? Thanks again for any help you can offer. --Amblerllc (talk) 23:53, 27 October 2012 (UTC)

You should switch that multiple-instance template to use Semantic Internal Objects to store its data. Yaron Koren (talk) 22:00, 28 October 2012 (UTC)
OH. I was afraid you might say that. I hope I can figure that out in the next 8 hours! :) Thank you so much! --Amblerllc (talk) 15:33, 29 October 2012 (UTC)
Am I understanding this... if I remove the multiple templates statement then I am generating multiple pages through a querylink and the pages are the "object"? such as carrotcake in the example? Is there a good display for the use of semantic internal objects? --Amblerllc (talk) 22:30, 29 October 2012 (UTC)
No, you should keep it as a multiple-instance template - you just need to modify the template itself. Here is an example of a template that uses SIO. Yaron Koren (talk) 22:52, 29 October 2012 (UTC)
I thought I would move this article here. This link was very helpful. I have it working. Just in time for the install tomorrow. Thank you again. Also, I ran into the problem where I ran runJobs.php and my {{#ask calls disappeared. As soon as I saved the pages it viewed just fine.

-- 08:55, 30 October 2012 (UTC)

Semantic Internal Objects v 0.7 not working with SMWSQLStore3[edit | edit source]

Hi, I testing Semantic Internal Objects v 0.7 with SemanticMediaWiki 1.8rc1. and found that it does not not worked --Pastakhov (talk) 06:27, 29 November 2012 (UTC)

After switching to SMWSQLStore3 and SIO 0.7, the pages containing #set_internal need to be resaved, or you need to refresh all the semantic data in the wiki. Could that be the issue? Yaron Koren (talk) 15:41, 29 November 2012 (UTC)
I run SMW_refreshData.php and resave page, but this does not work. (MediaWiki 1.19.2) --Pastakhov (talk) 05:33, 30 November 2012 (UTC)
Did the exact syntax work for you when using SMWSQLStore2, or are you trying SIO for the first time on that wiki? Yaron Koren (talk) 14:08, 30 November 2012 (UTC)
I update the existing data, which worked fine with SMWSQLStore2 --Pastakhov (talk) 07:55, 2 December 2012 (UTC)
Are you including SIO in LocalSettings.php after the store is set to SMWSQLStore3? Yaron Koren (talk) 15:14, 2 December 2012 (UTC)
Yes, of course. I have everything working on the old version, I just decided to try new.--Pastakhov (talk) 16:01, 2 December 2012 (UTC)

Can you paste here the #set_internal call you're making, and the query you use to get the data? Yaron Koren (talk) 17:30, 2 December 2012 (UTC)

Hi, Bug in namespace. This worked only in main namespase .
{{#ask: [[Test::{{FULLPAGENAME}}]] |?a |?b }}

in other namespaces worked only with [[Test::{{PAGENAME}}]]

So which one is handling namespaces correctly - the old version, or the new one (that calls #subobject)? I know there were problems with namespace handling in SIO before. Yaron Koren (talk) 14:10, 5 December 2012 (UTC)
IMHO old version it was correctly. Now, page special:browse displays backlinks SIO only in main namespace. I think the reason is the same.--Pastakhov (talk) 16:33, 5 December 2012 (UTC)
If it's possible, could you try calling #subobject directly in one of those pages in the non-main namespace? If that doesn't work either, it might be a bug in SMW itself. Yaron Koren (talk) 20:28, 5 December 2012 (UTC)
I changed #set_internal to #subobject in a non-main namespace. The result is not changed and is still binding to the page goes by its name without namespase.--Pastakhov (talk) 05:24, 6 December 2012 (UTC)

Okay - it sounds like an SMW bug, then. If possible, could you please file a report about it on Bugzilla? Yaron Koren (talk) 13:41, 6 December 2012 (UTC)

Bug 42784 I do not speak English, so I wrote so succinctly --Pastakhov (talk) 16:19, 6 December 2012 (UTC)
This namespace-handling bug was in fact an SIO bug, and was fixed in Git - it will also go into the next SIO version, 0.7.1. Yaron Koren (talk) 02:50, 10 December 2012 (UTC)
Thanks, #set_internal now works fine, but i not understand how to works #subobject and I cannot #ask data back, it all works?--Pastakhov (talk) 05:55, 10 December 2012 (UTC)
Sorry, I don't understand the question. Yaron Koren (talk) 15:39, 10 December 2012 (UTC)

#list is not working[edit | edit source]

Hello, I just download the latest version and I can successfully ask the internal objects and displayed a table. But when I changed one of my properties to #list, the whole column simply disappear for single value and multiple value. Does anyone successfully used it?

This one works:

{{#set_internal:Is record of
|Has name = {{{1}}}

This one doesn't works:

{{#set_internal:Is record of
|Has name#list = {{{1}}}

I have a page calling this template Group and call like this {{Group|John}} {{Group|John,Mary}} As said before, without #list it can display correctly but with #list it simply not works.

Anyone have ideas? Thank you!

What version of Semantic MediaWiki are you using? Yaron Koren (talk) 15:34, 12 December 2012 (UTC)
Never mind - I figured out you must be using SMW 1.8. This was indeed a bug, that I just fixed. It was good timing, because I was about to release a new version of SIO, so this fix is now in SIO 0.7.1. Yaron Koren (talk) 06:09, 13 December 2012 (UTC)

Nested object.[edit | edit source]

Is it possible to have an internal object inside another internal object? So the I can create a list of records in a page, and then in each record there's another list of record, which have a type different than its parent's.

You can't do that kind of three-dimensional data with SIO, although you can do it with subobjects in Semantic MediaWiki, though I wouldn't recommend it - too complex a structure for one page. Yaron Koren (talk) 01:12, 16 December 2012 (UTC)

Set data for internal objects in other page.[edit | edit source]

Is it possible to set data of internal objects in other page?

Yes and no - you can't actually set an internal object for one page in another, but you can have one page's internal objects point with a property toward another, which in queries can appear the same way. Yaron Koren (talk) 01:14, 16 December 2012 (UTC)

Bug when using multiple list properties[edit | edit source]

I believe I found a bug in 0.7.1 (and potential fix) when using multiple #list properties with a #set_internal call. For example if you create a wiki page with:

{{#set_internal:Is president of
|Has vice president#list=Person1, Person2
|Has vice president2#list=Person3, Person4, Person5

{{#ask:[[Is president of::{{PAGENAME}}]]
|?Has vice president
|?Has vice president2

It will throw an "Allowed memory size of NNN bytes exhausted" php error. After some debugging it looks like the problem is in SemanticInternalObjects_body.php, line 376:

for ( $i = 1; $i < count( $actualValues ); $i++ ) {
     $subobjectArgs[] = $actualValues[$i];

I *believe* the issue is the re-use of the $i variable which is already being used in the surrounding for loop (line 364). When I changed that block of code in my SMW installation to:

for ( $avIdx = 1; $avIdx < count( $actualValues ); $avIdx++ ) {
     $subobjectArgs[] = $actualValues[$avIdx];

it seemed to fix it... Arcarlucci (talk) 16:56, 4 January 2013 (UTC)

Wow - that was a pretty big error! Thanks for finding it, and correctly diagnosing it. I just checked in a similar fix to the code. Yaron Koren (talk) 03:25, 3 January 2013 (UTC)
Great, glad I could help! Arcarlucci (talk) 16:56, 4 January 2013 (UTC)

Question marks in strings aren't being saved[edit | edit source]

I am running:

  • Semantic Internal Objects 0.7.3
  • MediaWiki 1.20.2
  • Semantic MediaWiki 1.8

I am having a problem where if I have a string containing a question mark it is not being saved by semantic internal object. Details follow.

I have a Template:Resource that is being called on (on the page Emacs-IDE):

|Resource audience=Support
|Resource kind=Support
|Resource URL=http://emacs-ide.tuxfamily.org/index.html?tab=support

The template calls set_internal as follows:

{{#set_internal:Resource of
|Has resource audience=
|Has resource kind=
|Has resource URL=

Where Resource of is of type page and Has resource audience, Has resource kind, and Has resource URL are all of type string. (Please note that I am using type string instead of type URL because I handle many uncommon URL types such as gopher, irc, news, etc., which are not currently supported by the JQuery URL validator in Semantic Forms).

When I query "Resource of"

{{#ask:Resource of::Emacs-IDE
|?Has resource audience=
|?Has resource kind=
|?Has resource URL=

It does not display the string "http://emacs-ide.tuxfamily.org/index.html?tab=support". Also when I browse the properties on the page it does not appear either, so I don't htink it is a matter of the query not returning the value of "Has resource URL", but it has to do with #set_internal not working properly.

Note that if I remove "?tab=support" from the string, then it does get stored as a property value of Has resource URL on the page and my #ask query returns it correctly.

This has been fixed in Git, after some private discussion - it turned out that the issue was with equals signs in the values, not question marks. Yaron Koren (talk) 20:20, 5 March 2013 (UTC)

SMW_refreshData.php not refreshing SIOs[edit | edit source]

I'm working on upgrading from MW 1.17 to 1.20, plus bringing all extensions up to latest versions. When I run SMW_refreshData.php it seems to have refreshed everything properly except SIOs. If I go to pages containing SIOs and edit and re-save without making any changes the SIOs work normally. So the data is definitely just not refreshing properly. Any ideas? --Jamesmontalvo3 (talk) 20:31, 15 May 2013 (UTC)

Problem solved. I'm not sure what I did differently. I ran the following commands once before and it had no affect. I tried it again and for whatever reason it worked this time.
php SMW_refreshData.php -v -b SMWSQLStore3 -fp
php SMW_refreshData.php -v -b SMWSQLStore3
--Jamesmontalvo3 (talk) 20:39, 15 May 2013 (UTC)

Seperator for list-object[edit | edit source]

I try to store values as list-object in a SIO. Something like ...


As a german, values are given by Semantic Forms as values with a colon. Therefor I have to seperate the values with a different separator like '#'. SUBOBJECTs should work with |TestEntry#list=0,5#1#2,5|+sep=#. Is there a way to do so with SIO?

I try to set the MediaWiki:Smw decseparator to '.' and everything worked fine with "," as separator (|TestEntry#list=0.5,1,2.5). But this is not a final solution to me, leading me to other problems, and I don't want to change each given value from SF by {{#replace: }} and later back to the input.

It would be nice to define the separator by parameter (like |+sep=), by global setting (like a page MediaWiki:Smw listseparator) or at least by a global var I can set by my Extension. --Letofred (talk) 07:38, 4 July 2013 (UTC)

Yes, unfortunately there's no good solution for that... for now, you can switch to using #subobject (the code behind the scenes is the same), or as you suggest, use #replace - two #replace calls would be needed. Yaron Koren (talk) 13:42, 7 July 2013 (UTC)
It should no big deal to replace the colon in SemanticInternalObjects_body.php line 321 to a var - may I request this for a later version? --Letofred (talk) 17:30, 9 July 2013 (UTC)
something like:
and replacing line 321 to:
$listValues = explode( $separator, $value );
Yes, I agree that would be a good change - I'll try to do that at some point. Yaron Koren (talk) 21:58, 9 July 2013 (UTC)

Conflict between DPL (Third party) and SIO[edit | edit source]

I am forced to use rather old versions in my company, so the issue might have been silently fixed already. Just to be sure i ask if the issue still is valid and what might be a remedy:
SIO: V0.6.6 & DynamicPageLink (Third-Party) V1.8.9 on a MW 1.17.5.
I dont know if this is an issue for the SIO extension or the DPL extension, so i will ask both.

If i assign some SIO on a page and have a DPL with inclusion of template-parameters later on:

{{#set_internal:Steckbrief/SOAService_Users |Steckbrief/SOAService-Username=EX-ample |Steckbrief/SOAService-Userversion=V03}}
{{#dpl: title={{FULLPAGENAME}}|include={sometemplate}:a_parameter|skipthispage=no}} 

everyting works fine.
If i happen to have that kind of DPL somewhere on the page prior to the SIO statement (e.g. in a template(!)) no properties are set.:

{{some template with a DPL like the one in the first example|param=someting}}
{{#set_internal:Steckbrief/SOAService_Users |Steckbrief/SOAService-Username=EX-ample |Steckbrief/SOAService-Userversion=V03}}

Taking the DLP out of the template like below doesnt change anything. Still no properties are set.

{{#dpl: title={{FULLPAGENAME}} }} 
{{#set_internal:Steckbrief/SOAService_Users |Steckbrief/SOAService-Username=EX-ample |Steckbrief/SOAService-Userversion=V03}}

If I happen to use tags for the DPL instead of a call it works again.

{{#set_internal:Steckbrief/SOAService_Users |Steckbrief/SOAService-Username=EX-ample |Steckbrief/SOAService-Userversion=V03}}

Sadly there is no way to change all calls of DPL to DPL tags as both work slightly different (usability of magic words).
Took me several hours to find out that these two dont like each other and that its based upon sequence within the code.
Are there any hints, known fixes on this issue? Ciannicay (talk) 11:48, 29 October 2013 (UTC)

Just to clarify - is the issue that you can call #set_internal before #dpl, but not the other way around? Yaron Koren (talk) 13:12, 29 October 2013 (UTC)
Right. I can call #set_internal before #dpl and i can use <dpl></dpl> before #set_internal. Calling #dpl before #set_internal causes the issue. Ciannicay (talk) 14:01, 29 October 2013 (UTC)
Okay. How big is an issue is that; I mean, how hard would it be to flip the calls around, as a workaround? Yaron Koren (talk) 15:51, 29 October 2013 (UTC)
If it was that easy, I would not be here :). I will put an example of one of the pages here (replacing any internal data with "internalData") maybe that helps.
The whole bunch of templates is edited using seven different forms atm (!). The sequence of the templates cant be changed to overcome the issue, as most of the templates do use #dpl:. Both templates "SOA-Service-Versionen" and "SOA-Servicenutzer" shall use #set_internal: to store the values. "SOA-Servicenutzer" does not display anything itself and might be relocated within the sequence. Its data is shown via "Steckbrief Element" template. "SOA-Service-Versionen" displays its content thus a relocation is not possible.
There are 2 major forms for editing the page. One for the basic content description and contol of what to display (a) and one for the vital detailed information on the element (b). The form for (a) holds ALL templates but will pass thru most values by setting the fields to hidden. This one is no partial form. Form (b) is a partial form that applies to "Steckbrief Element", "SOA-Service-Versionen", "SOA-Servicenutzer", and all those "Ansprechpartner **" templates. Except for "Steckbrief Element" all are used with option "multiple" within form(b). Ciannicay (talk) 17:15, 29 October 2013 (UTC)
|Elementtyp=SOA Service
|subpagetitle=Infrastruktur, Schnittstellen
|elementlist=Enthaltene Elemente
{{Elemente/Default Element}}
{{Steckbrief Element
|produktiv seit=internalData
|Angeboten von Element=internalData
|produktiv seit=internalData
|Angeboten von Element=internalData
|produktiv seit=internalData
{{Ansprechpartner PV
{{Ansprechpartner AV
{{Ansprechpartner AV
{{:SOA Services/allgemeines}}
As i continued to dig into the matter i narrowed the issue down to some more explicit DPL statements like {{#dpl: title=Extension talk:Semantic Internal Objects|include={sometemplate}:a_parameter|skipthispage=no}}.
I editied my the first post to reflect that. Ciannicay (talk) 09:10, 31 October 2013 (UTC)
That's quite a page structure! Here's another question I should have asked at the beginning: what version of SMW are you using, and more specifically are you using SQLStore2 or SQLStore3? The inner workings of SIO changed nearly completely between those two SQL stores, so if you're using SQLStore2 I would suggest upgrading. Yaron Koren (talk) 12:54, 1 November 2013 (UTC)
I am forced to use the versions we have and we just had our latest upgrade so i wont exspect any upgrade within the next 1-2 years. The recent update was the first since 2008 (!)
Its a MW 1.17.5. with Semantic Bundle (Version 2011-08-24.20110824) so the SMW is V1.6.1 with PHP 5.2.14 & MySQL 5.0.96-log. I dont know anything about SQLStore, but I will ask the department in charge. Ciannicay (talk) 11:59, 4 November 2013 (UTC)
Ooh - if you're using SMW 1.6.1, it's definitely SQLStore2. The only solution I can think of, given all your constraints, is to maybe cut out #dpl and use #ask instead. Would that be possible? I don't know exactly what those #dpl calls do. Yaron Koren (talk) 12:06, 4 November 2013 (UTC)
Rather not. Is it the only possible way? There are literally hundreds of pages using #dpl. It would work for some of them, sure, but there's bunch of pages that use #dpl i a manner that is hard to impossible to replace using #ask.
Is it possible that my problem has the same origins as the problem described here: http://www.mediawiki.org/wiki/Extension_talk:DynamicPageList_%28third-party%29#Problems_with_VariableExtension ?
The above #dpl does:
  • select a page defined by title
  • look into the found page and search for a named template ("sometemplate")
  • get the value for a named parameter ("a_parameter")of template on the found pages
  • Build a list/table etc. from the results (UL)
Ciannicay (talk) 13:19, 4 November 2013 (UTC)
I really don't know anything about the internals of DPL, so I couldn't say. But if each of those parameters you're displaying is also stored with a semantic property, it should be possible to get the same results using #ask... Yaron Koren (talk) 13:25, 4 November 2013 (UTC)
You are right. It might be possible if we get all the gardeners (those who write the more complex pages) to learn #ask as most of them didnt use it up to now. And we would have to rework all pages with #dpl in it. And we would have to find replacements for the other methods of #dpl that are harder to replace like "Give me all pages that do link to a specific page" (o.k,o.k. theres a special page for it, but #dpl can more than just list pages e.g. pass them to templates) or "What links are in a specific page". etc.
Your idea enabled me to implement a workaround to my pages
BUT: Thats more a remedy of the symptoms - for me it would be better to eradicate the error at its origin.
I take it, that you are rather sure the problem may affect your extension but it's origins are the other extension?Ciannicay (talk) 15:15, 4 November 2013 (UTC)

Well I'm not sure what the source of the error is, but the internals of SIO changed almost completely between the version you're using and now - so I'd say there's a good chance that this problem no longer exists with the latest code. Yaron Koren (talk) 17:15, 4 November 2013 (UTC)

Which is sadly the one thing I cant change. Is there perhaps a higher Version of SIO (> 0.6.6) that is fully compatible with MW 1.17.5, SMW 1.6.1. and the other components of Semantic Bundle (Version 2011-08-24.20110824)? Getting SIO patched /upgrades and not touching everything else might work (probability of getting it done 40%) Ciannicay (talk) 12:54, 13 November 2013 (UTC)
The latest version of SIO, 0.7.5, will still work with all those other versions, I'm pretty sure. I doubt it'll help the issue, though - basically, SIO now contains two totally different sets of code - one that's called with more recent versions of SMW, and one that's called with older versions - and the one that works with older versions hasn't changed that much. Yaron Koren (talk) 14:45, 13 November 2013 (UTC)
So i take it, that "my" error would still be there. I wish i would get any feedback from those DPL guys, too. I still hope its an error that could be easily patched on their side. Thanks for your help!Ciannicay (talk) 18:07, 13 November 2013 (UTC)

Querying Semantic internal objects and iterating through the list returned to display each property of the item in the List[edit | edit source]

I am creating a wiki for various applications. I have an application Page and an Environment page. User Can select Environments using Form I created using Internal Objects.Now In application Page I Use #Ask query to fetch List Of Environments.Till this its working But Now I want to display The properties of each environment. I am unable to achieve this. How can I iterate the list of environments and then get each property in each environment and display it as a Table?

= Environments =
{{#ask:[[Application Has Environments::+ ::Is Environment]][[ForWhatPage::{{BASEPAGENAME}}]]
| ?Application Has Environment

here is How I set internal Objects

{{#set_internal:Application Has Environments
|Application Has Environment={{ #arraymap: {{{Environments}}}|,|x|[[Has Environment::x]]|,|}}}}
There seem to be errors in both your #ask and #set_internal calls. I'm not sure what's going on with your #ask call, but for your #set_internal call - the way to handle lists is not with #arraymap, but with the "#list" directive - see the documentation. Yaron Koren (talk) 14:49, 13 November 2013 (UTC)

If you managed to get a list of the environments, would it help to do this environment #ask again but send the results to a template which itself has an other #ask to get the properties of each enviroment?Ciannicay (talk) 17:59, 13 November 2013 (UTC)

Thanks for your quick replies. I posted the code taking it in middle of some experimentation the actual code is

= Environments =
{{#ask:[[Application Has Environments::+]][[ForWhatPage::{{BASEPAGENAME}}]]
|?Application Has Environment

And Thanks Yaron #List also works

{{#set_internal:Application Has Environments
|Application Has Environment={{ #list: {{{Environments}}}|,|x|[[Has Environment::x]]|,|}}

Thanks Mr.Ciannicay But could you show some example as to how I can achieve this without possibly iterating the list.

That's not the correct way to use #list, so I doubt that works. Yaron Koren (talk) 13:47, 14 November 2013 (UTC)

This should #ask for the environments for the specific application defined by Semantic Internal Objects (as you described above)
The #ask is used to call a subsequent template for each found result.
= Environments =
{{#ask:[[Application Has Environments::+ ::Is Environment]][[ForWhatPage::{{BASEPAGENAME}}]]
| ?Application Has Environment
| format=template
| template=get_props_of_env
{{{1}}} is the first parameter that is given to the subsequent template.
This parameter is supposed to hold the name of an environemt which has several properties set.
The properies should be known by name, as i dont know how to #ask for arbitrary properties.
{{#ask [[{{{1}}}]]
You might want to hand these results over to an other template in order to beautify the output.-- Ciannicay (talk) 11:26, 22 November 2013 (UTC)

Parsing tab-delimited tables to SIOs with Lua[edit | edit source]

Below is some proof-of-concept Lua code that I've written to allow for users to copy-paste data from a spreadsheet and get the data in the rows mapped to SIOs. Rows are delimited by newline characters and the entries are tab delimited. The semantic properties are specified in the header of the table. I'm not sure how robust the code is to "creative user inputs", but this looks like a promising way to enter a large amount of data without having to use lots of multiple-instance templates.

--ChrisDavis (talk) 13:39, 14 November 2013 (UTC)

Module call:

{{#invoke:ParseTable|parse|s=Has quantity       Has unit        Has ingredient
1       cup     flour
2               egg

Lua code:

local p = {}
function p.parse(frame)
        rows = mw.text.split( frame.args['s'], '\n' )
        headers = {}
        for k, v in pairs( rows ) do
                columns = mw.text.split( v, '\t' )
                if (k == 1) then 
                        for k, v in pairs(columns) do 
                                headers[k] = v
                        sioArgs = {}
                        for k, v in pairs(columns) do 
                                sioArgs[headers[k]] = v
                        frame:callParserFunction{ name = '#set_internal:Part of recipe', args = sioArgs }
return p
Cool! I'm glad this works for you. Another potential option to do the same thing (I think), is to use the External Data extension, specifically a combination of Special:GetData, #get_web_data, and #store_external_table. (Though there the data has to be in comma-separated, not tab-separated, format.) Yaron Koren (talk) 13:50, 14 November 2013 (UTC)
Thanks, the External Data extension looks quite useful, and I'll take a deeper look into it. --ChrisDavis (talk) 14:25, 14 November 2013 (UTC)

Handling of multiple SIOs in #ask template-format[edit | edit source]

Dear all,

I'm using Semantic Forms and SIO to build a SMW about cultural transfer in 18th century literary journals. A common case is a journal article that refers to foreign books, e.g. an article in a german journal that reviews an english book. Usually, one article refers to several works, so each reference to a work is a SIO in the articles wiki page. The Transfer-template is called multiple times, like this:

|Work=Hāfez: Dīvān
|Work=Sir John Shore, European Magazine, Mai 1794.

The template is defined as following:


The information about the article itself (author, title, etc.) are stored as semantic properties on the article page. Data about the books the article is referring to are saved in the respective wiki page of the book. The SIO attribute Work is defined as datatype Page.

Article -- Attribute:transfers --> #SIO1 -- Attribute:Work --> Hāfez: Dīvān
        -- Attribute:transfers --> #SIO2 -- Attribute:Work --> European Magazine, Mai 1794.

My aim was to create a query with the result format template that lists both the information about the article and some details about the referred works. To query a property chain, my approach is to use a template including #show-calls which extract the information. Here you see the template call via #ask (for example all articles published between 1796 and 1797):

{{#ask: [[published::>01.01.1796]] [[published::<31.12.1797]]
| ? Author
| ? Title
| ?- Transfers
| format=template
| template=Graph(Work)
| link=none

And the corresponding template Graph(Work) which gets the following parameters: {{{1}}} = page title, {{{2}}}= author of the article, {{{3}}} = title of the article, {{{4}}} = all page title of the SIOs the article refers to via the property Transfers.

{| class="wikitable sortable"
! Autor !! Titel !! Transfer
''Publisher'' {{#show: {{#show:x|?Transfers|link=none}} | ?Publisher}}
''Language'' {{#show: {{#show:x|?Transfers|link=none}} | ?Language}} 

The first column of the table links to the article {{{1}}} via the ¶-sign and list the author {{{2}}}. The second column shows the title {{{3}}}. The third column contains a list of all SIOs {{{4}}}, i.e. works being referred, with the following information: Publisher and Language. This is done via an #arraymap-call that splits the SIO-listing and spreads it on nested #show-queries. The result is a list of small tables with the mentioned informations. So far, so fine. It works very well.

The problem is that it cannot be done with articles whose page titles contains commas, like "Edinburg, d 26 Nov 1796". The list of SIOs then looks like

Edinburg, d 26 Nov 1796#_16596386ac8b7d078a1b3113abbe2b07, 
Edinburg, d 26 Nov 1796#_68e8b29e81b77ccbe5e50b9482934e69

It should be clear that #arraymap will not work anymore like intended. The question now is: Is there a way to set the separator between the SIOs? Can I change it from , to ! or whatever? Furthermore, I can imagine that my approach is not the right way to get the aimed results.

I would appreciate an opinion about this a lot! Sorry for the long topic and thanks in advance, Michael

That is a hack, of course... so let me suggest a smaller hack. When dealing with internal objects (or subobjects - same thing), it's almost always better to query on the internal objects themselves, rather than on the pages. So that's what I would recommend doing. The downside on that is that you unfortunately can't display the pages' own properties (Author, Title, etc.), due to a limitation in #ask. But you can get around that by storing that information in each internal object. You can do that by adding things like "|Article author={{#show:{{PAGENAME}}|?Author}}" to the #set_internal call, and then you can additionally display "? Article author" or whatever you call that property. Would that work for you? Yaron Koren (talk) 13:11, 9 October 2014 (UTC)
Cool! Thanks so much for your quick response, Yaron. Your small hack works very fine for me!

Unique ID of Internal Objects[edit | edit source]

It seems that an internal object's random number is changed every time the value of an internal object's property has been modified. Thus you can not use the automatically-generated name as an unique identifier over time. Is there a way to create a unique ID like with the old numbering mechanism? --Planetenxin (talk) 11:14, 3 December 2014 (UTC)

That's true, although a simple numbering system won't always work as a unique identifier either, because it won't handle things correctly if the items get rearranged. Anyway, I think you can use the NumerAlpha extension for that, storing the value with a hidden property. Yaron Koren (talk) 16:36, 3 December 2014 (UTC)