Help with Symmetric Property

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Help with Symmetric Property

Ed Swing-2
Fellow SMWers,
    I am trying to use a property that is Symmetric - let's call it friendOf. Pages in a particular category (Person) may have values assigned to the property, and I want to create a list of all friends on a person's page. But the property is symmetric, so I want to get all friends that are both referenced on the page AND those who are friends of the page.

To put it more plainly, assume I have a page for John, which mentions [[friendOf:: Mary]]. I also have a page for Robert that mentions [[friendOf:: John]]. I know I can query with #ask to find Robert, but I want to have an integrated list containing both Robert and Mary on John's page. How would I do this?


Edward Swing
Applied Research Technologist
Vision Systems + Technology, Inc.
6021 University Boulevard * Suite 360 * Ellicott City * Maryland * 21043
Tel: 410.418.5555 Ext: 919 * Fax: 410.418.8580
Email: [hidden email]<mailto:[hidden email]>
Web: http://www.vsticorp.com<http://www.vsticorp.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-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/semediawiki-user
Reply | Threaded
Open this post in threaded view
|

Re: Help with Symmetric Property

AnAlienHolakres3
What about using subquery?

Sent from my Windows Phone
________________________________
Od:Ed Swing
Odesláno:23.8.2012 14:17
Komu:[hidden email]
Předmět:[Semediawiki-user] Help with Symmetric Property

Fellow SMWers,
    I am trying to use a property that is Symmetric - let's call it friendOf. Pages in a particular category (Person) may have values assigned to the property, and I want to create a list of all friends on a person's page. But the property is symmetric, so I want to get all friends that are both referenced on the page AND those who are friends of the page.

To put it more plainly, assume I have a page for John, which mentions [[friendOf:: Mary]]. I also have a page for Robert that mentions [[friendOf:: John]]. I know I can query with #ask to find Robert, but I want to have an integrated list containing both Robert and Mary on John's page. How would I do this?


Edward Swing
Applied Research Technologist
Vision Systems + Technology, Inc.
6021 University Boulevard * Suite 360 * Ellicott City * Maryland * 21043
Tel: 410.418.5555 Ext: 919 * Fax: 410.418.8580
Email: [hidden email]<mailto:[hidden email]>
Web: http://www.vsticorp.com<http://www.vsticorp.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-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/semediawiki-user
------------------------------------------------------------------------------
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-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/semediawiki-user
Reply | Threaded
Open this post in threaded view
|

Re: Help with Symmetric Property

Alex M. Hendler-2
In reply to this post by Ed Swing-2
Here are a few options:

1) The fastest way is probably something like this:

{{#ask: [[{{PAGENAME}}]]
|?friendOf=Outgoing Friends
|?-friendOf=Incoming friends
}}

This would give you a sortable and discrete table of friends and let
you (manually) see whether there is a mutual friendship.

2) If you use the SemanticCompoundQueries extension, you can get them
all to appear in one list/column:

{{#compound_query: [[friendOf::{{PAGENAME}}]]
|[[-friendOf::{{PAGENAME}}]]
}}

but I think you would lose some important data there, e.g., whether
there is a mutual relationship and the direction of the relationship.

3) If you want to infer a mutual relationship and get a lot more
flexibility, you will need to pass the results of a query into an
array (simplest is the #arraymap parser function from SemanticForms)
and record the relationship there. I frequently use this strategy. If
you do that, I would recommend recording an additional (and/or sub-)
property with your inferred property so you can track the provenance
of the relationships, e.g.,
[[friendOf::friendOf/Inferred::ArrayElement]].

The inference would look something like this:

{{#arraymap: {{#ask:
[[friendOf::{{PAGENAME}}]]|link=none|sep=SEPARATOR}}|SEPARATOR|IncomingFriend|[[friendOf::friendOf/Inferred::IncomingFriend|
]]}}

This will hide the display of that relationship by default, but you
can query on it after you save the page (or possibly in real-time if
you put this into a template that you include on every relevant page,
but that may depend on your system's caching setup).

Hope this helps,

Alex
--
Alex M. Hendler
ontolawgy™ LLC: connect . . . the . . . dots
http://ontolawgy.com

On Thu, Aug 23, 2012 at 3:17 PM, Ed Swing <[hidden email]> wrote:

> Fellow SMWers,
>     I am trying to use a property that is Symmetric - let's call it friendOf. Pages in a particular category (Person) may have values assigned to the property, and I want to create a list of all friends on a person's page. But the property is symmetric, so I want to get all friends that are both referenced on the page AND those who are friends of the page.
>
> To put it more plainly, assume I have a page for John, which mentions [[friendOf:: Mary]]. I also have a page for Robert that mentions [[friendOf:: John]]. I know I can query with #ask to find Robert, but I want to have an integrated list containing both Robert and Mary on John's page. How would I do this?
>
>
> Edward Swing
> Applied Research Technologist
> Vision Systems + Technology, Inc.
> 6021 University Boulevard * Suite 360 * Ellicott City * Maryland * 21043
> Tel: 410.418.5555 Ext: 919 * Fax: 410.418.8580
> Email: [hidden email]<mailto:[hidden email]>
> Web: http://www.vsticorp.com<http://www.vsticorp.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-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/semediawiki-user

------------------------------------------------------------------------------
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-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/semediawiki-user
Reply | Threaded
Open this post in threaded view
|

Re: Help with Symmetric Property

CWinDC
In reply to this post by AnAlienHolakres3
Ed,
I've been playing with the Arrays extension to solve exactly this problem.
For better or for worse, this is what I've done:

1. Collect the set of property values on a page in a named array
2. Query for the subject page as a property value of other pages (incoming
links) and collect those pages in another named array
3. Merge the arrays from steps 1 and 2 in a third named array and print it.

What I do like about this approach is that it does not change the data.
What I don't like about the approach is that the relationships that appear
to exist on the screen are not the same as relationships that exist in the
data.

I suppose (now that I think about it) it might be reasonable to define a
new property for symmetric relationships and silently set it to take the
values of the merged array. But, I think it's best to keep this processed
data distinct from the raw data. Besides, in this particular case you can
detect open triads in the social network graph by looking for pages that
contain the symmetric property value but not the asymmetric property
value.

-Clarence


On Thu, Aug 23, 2012 at 10:00 AM, Jakub Holásek <[hidden email]>wrote:

> What about using subquery?
>
> Sent from my Windows Phone
> ________________________________
> Od:Ed Swing
> Odesláno:23.8.2012 14:17
> Komu:[hidden email]
> Předmět:[Semediawiki-user] Help with Symmetric Property
>
> Fellow SMWers,
>     I am trying to use a property that is Symmetric - let's call it
> friendOf. Pages in a particular category (Person) may have values assigned
> to the property, and I want to create a list of all friends on a person's
> page. But the property is symmetric, so I want to get all friends that are
> both referenced on the page AND those who are friends of the page.
>
> To put it more plainly, assume I have a page for John, which mentions
> [[friendOf:: Mary]]. I also have a page for Robert that mentions
> [[friendOf:: John]]. I know I can query with #ask to find Robert, but I
> want to have an integrated list containing both Robert and Mary on John's
> page. How would I do this?
>
>
> Edward Swing
> Applied Research Technologist
> Vision Systems + Technology, Inc.
> 6021 University Boulevard * Suite 360 * Ellicott City * Maryland * 21043
> Tel: 410.418.5555 Ext: 919 * Fax: 410.418.8580
> Email: [hidden email]<mailto:[hidden email]>
> Web: http://www.vsticorp.com<http://www.vsticorp.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-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/semediawiki-user
>
> ------------------------------------------------------------------------------
> 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-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/semediawiki-user
>
------------------------------------------------------------------------------
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-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/semediawiki-user
Reply | Threaded
Open this post in threaded view
|

Re: Help with Symmetric Property

rotsee
In reply to this post by AnAlienHolakres3

You could probably use the extension Semantic Compound Queries, that lets you combine two queries into one.
/Leo

> Fellow SMWers,
>     I am trying to use a property that is Symmetric - let's call it friendOf. Pages in a particular category (Person) may have values assigned to the property, and I want to create a list of all friends on a person's page. But the property is symmetric, so I want to get all friends that are both referenced on the page AND those who are friends of the page.
>
> To put it more plainly, assume I have a page for John, which mentions [[friendOf:: Mary]]. I also have a page for Robert that mentions [[friendOf:: John]]. I know I can query with #ask to find Robert, but I want to have an integrated list containing both Robert and Mary on John's page. How would I do this?
>
>
> Edward Swing
> Applied Research Technologist
> Vision Systems + Technology, Inc.
> 6021 University Boulevard * Suite 360 * Ellicott City * Maryland * 21043
> Tel: 410.418.5555 Ext: 919 * Fax: 410.418.8580
> Email: [hidden email]<mailto:[hidden email]>
> Web: http://www.vsticorp.com<http://www.vsticorp.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-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/semediawiki-user
> ------------------------------------------------------------------------------
> 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-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/semediawiki-user
     
------------------------------------------------------------------------------
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-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/semediawiki-user
---
Leo Wallentin
Skype: leo_wallentin
Twitter: @leo_wallentin
Säsongsmat.nu
Reply | Threaded
Open this post in threaded view
|

Re: Help with Symmetric Property

Kirk McDermid-2
In reply to this post by Alex M. Hendler-2
Can someone point me to any docs that describe the use of the minus sign
in queries to (I'm assuming) get results from pages that point to the
queried page (with a certain property)?  I had no idea SMW had that
capability.  (I'm a noob.)

Thanks!

Kirk

On 8/23/2012 10:07 AM, Alex M. Hendler (public) wrote:

> Here are a few options:
>
> 1) The fastest way is probably something like this:
>
> {{#ask: [[{{PAGENAME}}]]
> |?friendOf=Outgoing Friends
> |?-friendOf=Incoming friends
> }}
>
> This would give you a sortable and discrete table of friends and let
> you (manually) see whether there is a mutual friendship.
>
> 2) If you use the SemanticCompoundQueries extension, you can get them
> all to appear in one list/column:
>
> {{#compound_query: [[friendOf::{{PAGENAME}}]]
> |[[-friendOf::{{PAGENAME}}]]
> }}
>
> but I think you would lose some important data there, e.g., whether
> there is a mutual relationship and the direction of the relationship.
>
> 3) If you want to infer a mutual relationship and get a lot more
> flexibility, you will need to pass the results of a query into an
> array (simplest is the #arraymap parser function from SemanticForms)
> and record the relationship there. I frequently use this strategy. If
> you do that, I would recommend recording an additional (and/or sub-)
> property with your inferred property so you can track the provenance
> of the relationships, e.g.,
> [[friendOf::friendOf/Inferred::ArrayElement]].
>
> The inference would look something like this:
>
> {{#arraymap: {{#ask:
> [[friendOf::{{PAGENAME}}]]|link=none|sep=SEPARATOR}}|SEPARATOR|IncomingFriend|[[friendOf::friendOf/Inferred::IncomingFriend|
> ]]}}
>
> This will hide the display of that relationship by default, but you
> can query on it after you save the page (or possibly in real-time if
> you put this into a template that you include on every relevant page,
> but that may depend on your system's caching setup).
>
> Hope this helps,
>
> Alex
> --
> Alex M. Hendler
> ontolawgy™ LLC: connect . . . the . . . dots
> http://ontolawgy.com
>
> On Thu, Aug 23, 2012 at 3:17 PM, Ed Swing <[hidden email]> wrote:
>> Fellow SMWers,
>>      I am trying to use a property that is Symmetric - let's call it friendOf. Pages in a particular category (Person) may have values assigned to the property, and I want to create a list of all friends on a person's page. But the property is symmetric, so I want to get all friends that are both referenced on the page AND those who are friends of the page.
>>
>> To put it more plainly, assume I have a page for John, which mentions [[friendOf:: Mary]]. I also have a page for Robert that mentions [[friendOf:: John]]. I know I can query with #ask to find Robert, but I want to have an integrated list containing both Robert and Mary on John's page. How would I do this?
>>
>>
>> Edward Swing
>> Applied Research Technologist
>> Vision Systems + Technology, Inc.
>> 6021 University Boulevard * Suite 360 * Ellicott City * Maryland * 21043
>> Tel: 410.418.5555 Ext: 919 * Fax: 410.418.8580
>> Email: [hidden email]<mailto:[hidden email]>
>> Web: http://www.vsticorp.com<http://www.vsticorp.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-user mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/semediawiki-user
> ------------------------------------------------------------------------------
> 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-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/semediawiki-user


------------------------------------------------------------------------------
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-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/semediawiki-user
Reply | Threaded
Open this post in threaded view
|

Re: Help with Symmetric Property

kghbln
Heiya Kirk,

there are protoinformation on smw.o [1] which have to be rewritten (see the talk page). The best we currently
have on this is [2]

[1] http://semantic-mediawiki.org/wiki/Help:Inverse_properties

[2] http://wikimedia.7.n6.nabble.com/New-feature-inverse-properties-in-SMW-tp607323.html

Cheers Karsten


Am 23.08.2012 18:54, schrieb Kirk McDermid:

> Can someone point me to any docs that describe the use of the minus sign
> in queries to (I'm assuming) get results from pages that point to the
> queried page (with a certain property)?  I had no idea SMW had that
> capability.  (I'm a noob.)
>
> Thanks!
>
> Kirk
>
> On 8/23/2012 10:07 AM, Alex M. Hendler (public) wrote:
>> Here are a few options:
>>
>> 1) The fastest way is probably something like this:
>>
>> {{#ask: [[{{PAGENAME}}]]
>> |?friendOf=Outgoing Friends
>> |?-friendOf=Incoming friends
>> }}
>>
>> This would give you a sortable and discrete table of friends and let
>> you (manually) see whether there is a mutual friendship.
>>
>> 2) If you use the SemanticCompoundQueries extension, you can get them
>> all to appear in one list/column:
>>
>> {{#compound_query: [[friendOf::{{PAGENAME}}]]
>> |[[-friendOf::{{PAGENAME}}]]
>> }}
>>
>> but I think you would lose some important data there, e.g., whether
>> there is a mutual relationship and the direction of the relationship.
>>
>> 3) If you want to infer a mutual relationship and get a lot more
>> flexibility, you will need to pass the results of a query into an
>> array (simplest is the #arraymap parser function from SemanticForms)
>> and record the relationship there. I frequently use this strategy. If
>> you do that, I would recommend recording an additional (and/or sub-)
>> property with your inferred property so you can track the provenance
>> of the relationships, e.g.,
>> [[friendOf::friendOf/Inferred::ArrayElement]].
>>
>> The inference would look something like this:
>>
>> {{#arraymap: {{#ask:
>> [[friendOf::{{PAGENAME}}]]|link=none|sep=SEPARATOR}}|SEPARATOR|IncomingFriend|[[friendOf::friendOf/Inferred::IncomingFriend|
>> ]]}}
>>
>> This will hide the display of that relationship by default, but you
>> can query on it after you save the page (or possibly in real-time if
>> you put this into a template that you include on every relevant page,
>> but that may depend on your system's caching setup).
>>
>> Hope this helps,
>>
>> Alex
>> --
>> Alex M. Hendler
>> ontolawgy™ LLC: connect . . . the . . . dots
>> http://ontolawgy.com
>>
>> On Thu, Aug 23, 2012 at 3:17 PM, Ed Swing <[hidden email]> wrote:
>>> Fellow SMWers,
>>>       I am trying to use a property that is Symmetric - let's call it friendOf. Pages in a particular category (Person) may have values assigned to the property, and I want to create a list of all friends on a person's page. But the property is symmetric, so I want to get all friends that are both referenced on the page AND those who are friends of the page.
>>>
>>> To put it more plainly, assume I have a page for John, which mentions [[friendOf:: Mary]]. I also have a page for Robert that mentions [[friendOf:: John]]. I know I can query with #ask to find Robert, but I want to have an integrated list containing both Robert and Mary on John's page. How would I do this?
>>>
>>>
>>> Edward Swing
>>> Applied Research Technologist
>>> Vision Systems + Technology, Inc.
>>> 6021 University Boulevard * Suite 360 * Ellicott City * Maryland * 21043
>>> Tel: 410.418.5555 Ext: 919 * Fax: 410.418.8580
>>> Email: [hidden email]<mailto:[hidden email]>
>>> Web: http://www.vsticorp.com<http://www.vsticorp.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-user mailing list
>>> [hidden email]
>>> https://lists.sourceforge.net/lists/listinfo/semediawiki-user
>> ------------------------------------------------------------------------------
>> 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-user mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/semediawiki-user
>
> ------------------------------------------------------------------------------
> 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-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/semediawiki-user
>


------------------------------------------------------------------------------
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-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/semediawiki-user