Discussion:
Selecting SMW-Properties based on SMW-Properties
(too old to reply)
Bjoern Decker
2017-06-22 09:09:25 UTC
Permalink
Hello,

I am currently evaluating to use Semantic Media Wiki as to document a graph data model.

I currently have nodes and relationship, that have properties. Nodes, relationships and properties of them are represented as separate pages with attributes. What I want is to have a table on the page Node1 that contains all the attributes of the corresponding properties.

So the example would be as follows:
Page Node1:
[[hasProperty:id]]
[[hasProperty:comment]]

[[Category:Node]]

Page Id:
[[hasType::Text]]
[[hasDescription::Contains id, unique within the whole graph]]
[[isUnique::true]]
[[isOptional::false]]

[[Category:Property]]

Page Comment:
[[hasType::Text]]
[[hasDescription::Comment about the node]]
[[isUnique::false]]
[[isOptional::true]]

[[Category: Property]]

Page Not Related Property:
[[hasType::Text]]
[[hasDescription::This property should NOT be shown]]
[[isUnique::false]]
[[isOptional::true]]

[[Category: Property]]



I tried the following that did not work:
{{#ask:
[[Category:Property]]
[[<q> [[Object]] |?has_attribute</q>]]
|?hasName
|?hasDescription
|?hasType
|format=debug
}}


The current workaround I found so far is to specify the related nodes in the property page (maybe using a subobject, to have the whole information in one page)
Page Comment:
[[hasNode::Node1]]
[[hasType::Text]]
[[hasDescription::Comment about the node]]
[[isUnique::false]]
[[isOptional::true]]

[[Category: Property]]

However, my hope is that I could use the representation mentioned in the beginning.


If you need further information - e.g. a sandbox example, let me know.

Thanks in advance.


Best wishes

Björn
Krabina Bernhard
2017-06-22 13:03:28 UTC
Permalink
Hi Bjoern,

I don't have much experience with subqueries, but this does not look right:

[[Object]] |?has_attribute

What is [[Object]]? And also your attribute has_attribute does not show in your data structure...

What you put in the subquery between <q> and </q> must be a coorrect query. And I also think it must not be
[[<q> [[Object]] |?has_attribute</q>]]
but
[[some Property::<q>some other query</q>]]

cheers,
Bernhard

[1] https://www.semantic-mediawiki.org/wiki/Help:Selecting_pages
Post by Bjoern Decker
Hello,
I am currently evaluating to use Semantic Media Wiki as to document a graph data model.
I currently have nodes and relationship, that have properties. Nodes,
relationships and properties of them are represented as separate pages with
attributes. What I want is to have a table on the page Node1 that contains all
the attributes of the corresponding properties.
[[hasProperty:id]]
[[hasProperty:comment]]
[[Category:Node]]
[[hasType::Text]]
[[hasDescription::Contains id, unique within the whole graph]]
[[isUnique::true]]
[[isOptional::false]]
[[Category:Property]]
[[hasType::Text]]
[[hasDescription::Comment about the node]]
[[isUnique::false]]
[[isOptional::true]]
[[Category: Property]]
[[hasType::Text]]
[[hasDescription::This property should NOT be shown]]
[[isUnique::false]]
[[isOptional::true]]
[[Category: Property]]
[[Category:Property]]
[[<q> [[Object]] |?has_attribute</q>]]
|?hasName
|?hasDescription
|?hasType
|format=debug
}}
The current workaround I found so far is to specify the related nodes in the
property page (maybe using a subobject, to have the whole information in one
page)
[[hasNode::Node1]]
[[hasType::Text]]
[[hasDescription::Comment about the node]]
[[isUnique::false]]
[[isOptional::true]]
[[Category: Property]]
However, my hope is that I could use the representation mentioned in the beginning.
If you need further information - e.g. a sandbox example, let me know.
Thanks in advance.
Best wishes
Björn
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Semediawiki-user mailing list
https://lists.sourceforge.net/lists/listinfo/semediawiki-user
Bjoern Decker
2017-06-22 14:53:27 UTC
Permalink
Hello,

and first of all thanks a lot for the support.
As James pointed out, there is a Bug in my Example.
However, meanwhile I was able to find a solution using Inverse Properties
https://www.semantic-mediawiki.org/wiki/Help:Inverse_properties

Here is the correction / solution

Page Node1:
[[hasProperty::id]]
[[hasProperty::comment]]

[[Category:Node]]

Page Id:
[[Has type::Text]]
[[hasName::id]]
[[hasDescription::Contains id, unique within the whole graph]]
[[isUnique::true]]
[[isOptional::false]]

[[Category:Property]]

Page Comment:
[[Has type::Text]]
[[hasName::comment]]
[[hasDescription::Comment about the node]]
[[isUnique::false]]
[[isOptional::true]]

[[Category: Property]]

Page Not Related Property:
[[Has type::Text]]
[[hasName::Whatever]]
[[hasDescription::This property should NOT be shown]]
[[isUnique::false]]
[[isOptional::true]]

[[Category: Property]]

------ Query

{{#ask:
[[-hasProperty::Object]]
|?hasName
|?hasDescription
|?isUnique
|?isOptional
}}

The Minus before hasProperty does the trick.
I cannot create a sandbox right now since I do not have the permission yet.

Best wishes and thanks for the quick response.

Best wishes

Björn



-----Original Message-----
From: Krabina Bernhard [mailto:***@kdz.or.at]
Sent: Donnerstag, 22. Juni 2017 15:03
To: Bjoern Decker <***@basf.com>
Cc: semediawiki-user <semediawiki-***@lists.sourceforge.net>
Subject: Re: [Semediawiki-user] Selecting SMW-Properties based on SMW-Properties

Hi Bjoern,

I don't have much experience with subqueries, but this does not look right:

[[Object]] |?has_attribute

What is [[Object]]? And also your attribute has_attribute does not show in your data structure...

What you put in the subquery between <q> and </q> must be a coorrect query. And I also think it must not be [[<q> [[Object]] |?has_attribute</q>]] but [[some Property::<q>some other query</q>]]

cheers,
Bernhard

[1] https://www.semantic-mediawiki.org/wiki/Help:Selecting_pages
Post by Bjoern Decker
Hello,
I am currently evaluating to use Semantic Media Wiki as to document a graph data model.
I currently have nodes and relationship, that have properties. Nodes,
relationships and properties of them are represented as separate pages
with attributes. What I want is to have a table on the page Node1 that
contains all the attributes of the corresponding properties.
[[hasProperty:id]]
[[hasProperty:comment]]
[[Category:Node]]
[[hasType::Text]]
[[hasDescription::Contains id, unique within the whole graph]]
[[isUnique::true]] [[isOptional::false]]
[[Category:Property]]
[[hasType::Text]]
[[hasDescription::Comment about the node]] [[isUnique::false]]
[[isOptional::true]]
[[Category: Property]]
[[hasType::Text]]
[[hasDescription::This property should NOT be shown]]
[[isUnique::false]] [[isOptional::true]]
[[Category: Property]]
[[Category:Property]]
[[<q> [[Object]] |?has_attribute</q>]]
|?hasName
|?hasDescription
|?hasType
|format=debug
}}
The current workaround I found so far is to specify the related nodes
in the property page (maybe using a subobject, to have the whole
information in one
page)
[[hasNode::Node1]]
[[hasType::Text]]
[[hasDescription::Comment about the node]] [[isUnique::false]]
[[isOptional::true]]
[[Category: Property]]
However, my hope is that I could use the representation mentioned in the beginning.
If you need further information - e.g. a sandbox example, let me know.
Thanks in advance.
Best wishes
Björn
----------------------------------------------------------------------
-------- Check out the vibrant tech community on one of the world's
most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Semediawiki-user mailing list
https://lists.sourceforge.net/lists/listinfo/semediawiki-user
Loading...