Re: [SMW-devel] Getting DB keys from a Data Value in SMW 1.7?

2012-07-25 Thread Markus Krötzsch
On 24/07/12 22:49, Yaron Koren wrote:
> Hi Markus,
>
> Semantic Internal Objects still does direct storage of rows in the
> database - that part of the code hasn't changed much from the beginning.
> If there's a better way to store data now, I'd like to know about it.

Yes, there is. The store has full support for internal objects, whatever 
direction properties are pointing to. You can create an internal object 
using a DIContainer object, and have it link back to its "parent" page. 
The small file includes/parserhooks/SMW_Subobject.php shows how this is 
done.

The only limitation is that SWMSemanticData can only hold data that has 
some relation from the page. So one needs an additional property to 
associate the subobject with the page in a forward direction. This does 
not affect the other properties (including the one in backward 
direction); it just is an additional property to add; you can use the 
existing SMW subobject property for this. Basically, the code would look 
almost exactly as the code in SMW_Subobject.php, only with slightly 
different parsing, an additional backwards link, and another method of 
getting a name for the subobject (you can have anonymous subobjects as 
well, if you prefer, by starting the subobject name with a "_"; see also 
SMW_DV_Record.php line 42ff).

If you change the implementation like this, SIO will work with all SMW 
stores without any DB insider knowledge.

Markus

>
> On Tue, Jul 24, 2012 at 4:03 PM, Markus Krötzsch
> mailto:mar...@semantic-mediawiki.org>>
> wrote:
>
> Yaron, what in the world do you need the DB keys for? :-) In the
> end, the keys are supposed to mirror how data is stored in DB
> tables. If you just want to store data somehow, there are much
> simpler ways. I thought SIO uses SMW's container feature to avoid
> direct reference to DB internals now? This would also be a useful
> thing to ensure a smooth transition to SMW 1.8 in general.
>
> Best regards,
>
> Markus
>
>
> On 24/07/12 14:40, Jeroen De Dauw wrote:
>
> Hey,
>
>   > Should I keep the SMWCompatibilityHelpers code in SIO for
> now, since
> there's no alternative at the moment?
>
> There is no reason to do effort changing it to whatever the new
> approach
> is since it's going to break in 1.8 anyway. So I'd just stick
> with using
> the compatibility helper class for now.
>
> Cheers
>
> --
> Jeroen De Dauw
> http://www.bn2vs.com
> Don't panic. Don't be evil.
> --
>
>
>
>
>
>
> --
> WikiWorks · MediaWiki Consulting · http://wikiworks.com



--
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] Getting DB keys from a Data Value in SMW 1.7?

2012-07-24 Thread Yaron Koren
Hi Markus,

Semantic Internal Objects still does direct storage of rows in the database
- that part of the code hasn't changed much from the beginning. If there's
a better way to store data now, I'd like to know about it.

-Yaron

On Tue, Jul 24, 2012 at 4:03 PM, Markus Krötzsch <
mar...@semantic-mediawiki.org> wrote:

> Yaron, what in the world do you need the DB keys for? :-) In the end, the
> keys are supposed to mirror how data is stored in DB tables. If you just
> want to store data somehow, there are much simpler ways. I thought SIO uses
> SMW's container feature to avoid direct reference to DB internals now? This
> would also be a useful thing to ensure a smooth transition to SMW 1.8 in
> general.
>
> Best regards,
>
> Markus
>
>
> On 24/07/12 14:40, Jeroen De Dauw wrote:
>
>> Hey,
>>
>>  > Should I keep the SMWCompatibilityHelpers code in SIO for now, since
>> there's no alternative at the moment?
>>
>> There is no reason to do effort changing it to whatever the new approach
>> is since it's going to break in 1.8 anyway. So I'd just stick with using
>> the compatibility helper class for now.
>>
>> Cheers
>>
>> --
>> Jeroen De Dauw
>> http://www.bn2vs.com
>> Don't panic. Don't be evil.
>> --
>>
>
>
>


-- 
WikiWorks · MediaWiki Consulting · http://wikiworks.com
--
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] Getting DB keys from a Data Value in SMW 1.7?

2012-07-24 Thread Markus Krötzsch
Yaron, what in the world do you need the DB keys for? :-) In the end, 
the keys are supposed to mirror how data is stored in DB tables. If you 
just want to store data somehow, there are much simpler ways. I thought 
SIO uses SMW's container feature to avoid direct reference to DB 
internals now? This would also be a useful thing to ensure a smooth 
transition to SMW 1.8 in general.

Best regards,

Markus

On 24/07/12 14:40, Jeroen De Dauw wrote:
> Hey,
>
>  > Should I keep the SMWCompatibilityHelpers code in SIO for now, since
> there's no alternative at the moment?
>
> There is no reason to do effort changing it to whatever the new approach
> is since it's going to break in 1.8 anyway. So I'd just stick with using
> the compatibility helper class for now.
>
> Cheers
>
> --
> Jeroen De Dauw
> http://www.bn2vs.com
> Don't panic. Don't be evil.
> --



--
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] Getting DB keys from a Data Value in SMW 1.7?

2012-07-24 Thread Jeroen De Dauw
Hey,

> Should I keep the SMWCompatibilityHelpers code in SIO for now, since
there's no alternative at the moment?

There is no reason to do effort changing it to whatever the new approach is
since it's going to break in 1.8 anyway. So I'd just stick with using the
compatibility helper class for now.

Cheers

--
Jeroen De Dauw
http://www.bn2vs.com
Don't panic. Don't be evil.
--
--
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] Getting DB keys from a Data Value in SMW 1.7?

2012-07-24 Thread Yaron Koren
Hi,

Sorry, I'm still not sure I understand. Should I keep the
SMWCompatibilityHelpers code in SIO for now, since there's no alternative
at the moment?

-Yaron

On Mon, Jul 23, 2012 at 4:57 PM, Jeroen De Dauw wrote:

> You can use the compat helpers for 1.6 and 1.7, but will need non trivial
> changes to support 1.8 because of the store rewrite.
>
> AFAIK this code still needs to stabilize, so you cannot add in forwards
> compat just yet.
>
> Sent from my Android phone.
> On 23 Jul 2012 22:53, "Yaron Koren"  wrote:
>
>> Hi,
>>
>> Sorry, what's the actual code I should use? That's all I wanted to know.
>>
>> -Yaron
>>
>> On Mon, Jul 23, 2012 at 4:47 PM, Nischay Nahata wrote:
>>
>>> Hey,
>>>
>>> SMWCompatibilityHelpers has been removed in 1.8 Store3, though its still
>>> in the repository to support Store2.
>>> Store3 instead uses DIHelper classes (interface SMWDataItemHandler) to
>>> access the DB.
>>>
>>> I also just looked at Semantic Internal Objects and saw that it extends
>>> Store2 and directly accesses db tables, these tables won't be
>>> there anymore in 1.8.
>>>
>>>
>>> On Mon, Jul 23, 2012 at 11:48 PM, Yaron Koren wrote:
>>>
 Hi,

 In the Semantic Internal Objects extension, I'm getting the "DB keys"
 for an object of type SMWDataValue with the following code:

 $dataItem = $value->getDataItem();
 $keys = SMWCompatibilityHelpers::getDBkeysFromDataItem( $dataItem );


 However, the file for the SMWCompatibilityHelpers says that "This file
 and its contents will vanish before SMW 1.7." So what code should be used
 instead?

 -Yaron

>>>
>>>
>>> --
>>> Cheers,
>>>
>>> Nischay Nahata
>>> nischayn22.in
>>>
>>
>>
>>
>> --
>> WikiWorks · MediaWiki Consulting · http://wikiworks.com
>>
>>
>> --
>> 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
>>
>>


-- 
WikiWorks · MediaWiki Consulting · http://wikiworks.com
--
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] Getting DB keys from a Data Value in SMW 1.7?

2012-07-23 Thread Jeroen De Dauw
You can use the compat helpers for 1.6 and 1.7, but will need non trivial
changes to support 1.8 because of the store rewrite.

AFAIK this code still needs to stabilize, so you cannot add in forwards
compat just yet.

Sent from my Android phone.
On 23 Jul 2012 22:53, "Yaron Koren"  wrote:

> Hi,
>
> Sorry, what's the actual code I should use? That's all I wanted to know.
>
> -Yaron
>
> On Mon, Jul 23, 2012 at 4:47 PM, Nischay Nahata wrote:
>
>> Hey,
>>
>> SMWCompatibilityHelpers has been removed in 1.8 Store3, though its still
>> in the repository to support Store2.
>> Store3 instead uses DIHelper classes (interface SMWDataItemHandler) to
>> access the DB.
>>
>> I also just looked at Semantic Internal Objects and saw that it extends
>> Store2 and directly accesses db tables, these tables won't be
>> there anymore in 1.8.
>>
>>
>> On Mon, Jul 23, 2012 at 11:48 PM, Yaron Koren wrote:
>>
>>> Hi,
>>>
>>> In the Semantic Internal Objects extension, I'm getting the "DB keys"
>>> for an object of type SMWDataValue with the following code:
>>>
>>> $dataItem = $value->getDataItem();
>>> $keys = SMWCompatibilityHelpers::getDBkeysFromDataItem( $dataItem );
>>>
>>>
>>> However, the file for the SMWCompatibilityHelpers says that "This file
>>> and its contents will vanish before SMW 1.7." So what code should be used
>>> instead?
>>>
>>> -Yaron
>>>
>>
>>
>> --
>> Cheers,
>>
>> Nischay Nahata
>> nischayn22.in
>>
>
>
>
> --
> WikiWorks · MediaWiki Consulting · http://wikiworks.com
>
>
> --
> 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] Getting DB keys from a Data Value in SMW 1.7?

2012-07-23 Thread Yaron Koren
Hi,

Sorry, what's the actual code I should use? That's all I wanted to know.

-Yaron

On Mon, Jul 23, 2012 at 4:47 PM, Nischay Nahata wrote:

> Hey,
>
> SMWCompatibilityHelpers has been removed in 1.8 Store3, though its still
> in the repository to support Store2.
> Store3 instead uses DIHelper classes (interface SMWDataItemHandler) to
> access the DB.
>
> I also just looked at Semantic Internal Objects and saw that it extends
> Store2 and directly accesses db tables, these tables won't be
> there anymore in 1.8.
>
>
> On Mon, Jul 23, 2012 at 11:48 PM, Yaron Koren  wrote:
>
>> Hi,
>>
>> In the Semantic Internal Objects extension, I'm getting the "DB keys" for
>> an object of type SMWDataValue with the following code:
>>
>> $dataItem = $value->getDataItem();
>> $keys = SMWCompatibilityHelpers::getDBkeysFromDataItem( $dataItem );
>>
>>
>> However, the file for the SMWCompatibilityHelpers says that "This file
>> and its contents will vanish before SMW 1.7." So what code should be used
>> instead?
>>
>> -Yaron
>>
>
>
> --
> Cheers,
>
> Nischay Nahata
> nischayn22.in
>



-- 
WikiWorks · MediaWiki Consulting · http://wikiworks.com
--
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] Getting DB keys from a Data Value in SMW 1.7?

2012-07-23 Thread Nischay Nahata
Hey,

SMWCompatibilityHelpers has been removed in 1.8 Store3, though its still in
the repository to support Store2.
Store3 instead uses DIHelper classes (interface SMWDataItemHandler) to
access the DB.

I also just looked at Semantic Internal Objects and saw that it extends
Store2 and directly accesses db tables, these tables won't be
there anymore in 1.8.

On Mon, Jul 23, 2012 at 11:48 PM, Yaron Koren  wrote:

> Hi,
>
> In the Semantic Internal Objects extension, I'm getting the "DB keys" for
> an object of type SMWDataValue with the following code:
>
> $dataItem = $value->getDataItem();
> $keys = SMWCompatibilityHelpers::getDBkeysFromDataItem( $dataItem );
>
>
> However, the file for the SMWCompatibilityHelpers says that "This file and
> its contents will vanish before SMW 1.7." So what code should be used
> instead?
>
> -Yaron
>


-- 
Cheers,

Nischay Nahata
nischayn22.in
--
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