Re: [SMW-devel] Hidden categories in semantic queries

2012-05-24 Thread Leonard Wallentin
A simple but beautiful solution, thank you Neill!
Den 24 maj 2012 17.35 skrev "Neill Mitchell" :

>  I have a separate property hasCategory which I set appropriately in my
> templates. I then query that instead of the category.
>
> #ask:[[My page]]|?hasCategory
>
> Of course this only works if your pages are generated by templates :)
>
> Cheers
> Neill.
>
> On 23/05/12 21:11, Leonard Wallentin wrote:
>
>  >
> >
> >> is there a way to hide hidden categories from showing up in query
> results that I have missed?
> >
> >If you mean excluding the pages for a certain category from your query
> result, then no, you cannot do this. I think.
>
>  Sorry, that was unclear. I mean hiding the categories with the magic
> word __HIDDENCAT__ from catagory printouts in queries like:
>
>   #ask:[[My page]]|?Category
>
>  Normally, if you don't want the categories to be rendered in the pages
> by MediaWiki, you probably don't want them printed by SMW either, at least
> me.
>
>  /Leo
>
>
> --
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>
>
>
> ___
> Semediawiki-devel mailing 
> listSemediawiki-devel@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/semediawiki-devel
>
>
>
> --
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> ___
> Semediawiki-devel mailing list
> Semediawiki-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/semediawiki-devel
>
>
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel


Re: [SMW-devel] Hidden categories in semantic queries

2012-05-24 Thread Neill Mitchell
I have a separate property hasCategory which I set appropriately in my 
templates. I then query that instead of the category.


#ask:[[My page]]|?hasCategory

Of course this only works if your pages are generated by templates :)

Cheers
Neill.

On 23/05/12 21:11, Leonard Wallentin wrote:

>
>
>> is there a way to hide hidden categories from showing up in query 
results that I have missed?

>
>If you mean excluding the pages for a certain category from your 
query result, then no, you cannot do this. I think.


Sorry, that was unclear. I mean hiding the categories with the magic 
word __HIDDENCAT__ from catagory printouts in queries like:


 #ask:[[My page]]|?Category

Normally, if you don't want the categories to be rendered in the pages 
by MediaWiki, you probably don't want them printed by SMW either, at 
least me.


/Leo


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/


___
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel


Re: [SMW-devel] Hidden categories in semantic queries

2012-05-24 Thread Markus Krötzsch
On 23/05/12 21:11, Leonard Wallentin wrote:
>  >
>  >
>  >> is there a way to hide hidden categories from showing up in query
> results that I have missed?
>  >
>  >If you mean excluding the pages for a certain category from your query
> result, then no, you cannot do this. I think.
>
> Sorry, that was unclear. I mean hiding the categories with the magic
> word __HIDDENCAT__ from catagory printouts in queries like:
>
> #ask:[[My page]]|?Category
>
> Normally, if you don't want the categories to be rendered in the pages
> by MediaWiki, you probably don't want them printed by SMW either, at
> least me.

We do not have this feature yet (I was not actually aware of this option 
until now). This should best become a feature request. The documentation 
mentions that the display should be governed by user preferences, and 
that it can be toggled through CSS [1]. So we probably should use the 
same CSS when displaying categories in SMW (problem: not all cases where 
categories are displayed in SMW should hide the category when it is 
marked as hidden). In any case, SMW should store and query for hidden 
categories like for all other categories; the change must be in the display.

Markus

[1] http://meta.wikimedia.org/wiki/Help:Category#Hidden_categories

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel


Re: [SMW-devel] Semantic mediawiki and map data

2012-05-24 Thread Kim Eik
So I've managed to get past my issues, even without help! ;) Anyways, you
knock one down, and another one pops up, isn't that how it usually is? So
what i have done so far is that i put all the coordinates in a Container
object instead. that solved the  one to many mapping, however now it seems
that i can't retrieve the data when i try to query it through the #ask:
parser function.

I have a page where i have defined the property
[[Polygon::,]], the page belongs to a category Polygon.

on the category page i have the following contents:

{{#ask: [[Category:Polygon]]
| ?Coordinates
| ?Polygon
| template=Oilfield-popup
| format=table
}}

which draws a table on the cateogory page, however, the column with the
polygon data is empty.

When digging in the sourcecode i can see that there is a call made to
SMWResultArray::getNextDataValue(), this however seems to always return
false instead of the expected container value when it comes to the polygon
property. Can someone please explain why that is?


Kim

On Wed, May 23, 2012 at 2:23 PM, Kim Eik  wrote:

> Ok, so i figured out how to create the necessary table.. however i'm
> unsure of how i should set up a one to many mapping towards the sm_coords
> table..
>
> as of now i have defined the following table:
>
> self::$prop_tables['smw_polygon'] = new SMWSQLStore2Table(
> 'sm_polygon',
>  array( 'coordinate_id' => 'p'),
> array( 'coordinate_id' )
>  );
>
> where coordinate_id is supposed to refer to sm_coords table entries.
> however, it seems that no other table here has this type of
> structure/mapping. So i'm guessing this is the wrong way to go? I could
> always just have all the data in a clob field instead, but this i'm
> guessing isn't very optimal when taking semantic search into account.
>
> So how should i create a one to many mapping on the database level as well
> as on the logic level? or should polygons be stored in some other way?
>
> Cheers.
>
> On Wed, May 23, 2012 at 12:49 PM, Kim Eik  wrote:
>
>> Ok, so i have run into an issue.
>>
>> A database query syntax error has occurred. This may indicate a bug in
>> the software. The last attempted database query was:
>>
>> (SQL query hidden)
>>
>> from within function "SMW::getPropertySubjects". Database returned error
>> "1103: Incorrect table name '' (localhost)".
>>
>> What i have done so far is defined a new property Geographic polygon. and
>> in my test wiki i tried setting the property [[Has type::Geographical
>> polygon]]
>>
>> By doing that i'm now getting this database issue. From what i can gather
>> i'm missing a database table to store my structure.
>> In the existing code i can see tht TYPE_GEO is defined as smw_coords
>> which im guessing is the table name that stores Geographic coordinates.
>>
>> SMWDataItem::TYPE_GEO=> 'smw_coords', // currently created only
>> if Semantic Maps are installed
>>
>> Now, how should i proceed to add a table for a polygon?
>> a polygon is just a collection of coords, so i guess i could use
>> smw_coords as my main table for storing the coordinates of polygons, and
>> then another table that refers to smw_coords with a one to many mapping.
>>
>> And where in the semantic maps extension can i actually find som sql code
>> that creates the given table?
>>
>> Oh, and btw, i could use some code review as im piecing this together.
>> would it be ok if i added the code ive written so far to gerrit? so you
>> guys can follow my progress line by line? that way you could probably help
>> me better if other issues arise. So far i have written code for
>> SemanticMediaWiki and SemanticMaps.
>>
>> Cheers
>>
>>
>> On Wed, May 23, 2012 at 11:11 AM, Markus Krötzsch <
>> mar...@semantic-mediawiki.org> wrote:
>>
>>> On 23/05/12 09:02, Kim Eik wrote:
>>>
  >From your descritpion, a container data item looks like the way to go
 for storing my structures. Do you have a practical example on how
 container data item is used?

  From the code documentation i can see that:

  * Being a mere placeholder/template for other data, an SMWDIContainer
 is not
  * immutable as the other basic data items. New property-value pairs
 can always
  * be added to the internal SMWContainerSemanticData.

 so is it correct to assume that in a practical example, in order to
 create a container data item, you actually create a template which holds
 all your other properties (like a set of [[Polygon::...]] properties)?

>>>
>>> The word "template" is not well chosen in this documentation. It has
>>> nothing to do with a MW template. When using containers to store data, they
>>> are simply like an "internal wiki page" together with property-value
>>> assignments. Instead of using containers, one could also create a new wiki
>>> page, assign all the data to that wiki page, and then use the wiki page
>>> instead of the Container DI as a property value. But this would not fit
>>> into one property assignment and would require multip