Extension talk:Semantic Internal Objects

Property type for the 'first argument'?
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
Hello,

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
I want to do

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
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
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= . 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= ". 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
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?

--163.244.24.4 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)
I appear to be having this problem, referenced in archived talk pages:
 * 2011
 * 2009 to 2010

It appears to be related to my use of the Text data type. SIO is set using a template: ! style="vertical-align:top;" |
 * - class="zebra-row"
 * style="vertical-align:top;" |
 * 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:

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)

--188.195.59.3 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
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.

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.

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

Semantic Internal Objects v 0.7 not working with SMWSQLStore3
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.

in other namespaces worked only with Test::  


 * 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
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: This one doesn't works: I have a page calling this template Group and call like this 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.
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.
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
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:

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
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):



The template calls set_internal as follows:



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"



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
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
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. 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. 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  and later back to the input.

It would be nice to define the separator by parameter (like ), 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:
 * and replacing line 321 to:
 * and replacing line 321 to:


 * 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
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 you or the other guys from the DPL extension, so i will ask both of you. If i assign some SIO on a page and have a DPL later on:

everyting works fine. If i happen to have a DPL somewhere on the page prior to the SIO statement (e.g. in a template(!)):

no properties are set. Taking the DLP out of the template like:

doesnt change anything. If i happen to use tags for the DPL instead of brackets: title=

it works again. Sadly there is no way to change all usages of DPL to the tag-version 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 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 forms (!). 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" should 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. 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)


 * }

Regional