Message Boards Message Boards

0
|
6849 Views
|
2 Replies
|
3 Total Likes
View groups...
Share
Share this post:

[?] Get the value of an Entity's property ?

Posted 7 years ago

Hi, I am trying to put into variable the value of the "region" of the "PhysicalSystem"'s "rectangular bar magnet"...without success, although it looks trivial. EntityValue[] shows me that there is a "type" called "PhysicalSystem".

EntityValue[Entity["PhysicalSystem"],"Entities"]

is listing "rectangular bar magnet".

EntityValue[rectangular bar magnet  (physical system),"Properties"]

is listing the "region" property. Also the

EntityValue[rectangular bar magnet  (physical system),"PropertyAssociation"]

lists the region property value as:

EntityProperty["PhysicalSystem", "Region"] -> 
 Cuboid[{-(QuantityVariable["a","Length"]/2), -(QuantityVariable[
    "b","Length"]/2), -(QuantityVariable["c","Length"]/
    2)}, {QuantityVariable["a","Length"]/2, QuantityVariable[
   "b","Length"]/2, QuantityVariable["c","Length"]/2}]

However when I try to get that value directly with:

In[24]:= EntityProperty[rectangular bar magnet  (physical system),Entity[rectangular bar magnet  (physical system),region (word)]]
Out[24]= EntityProperty[rectangular bar magnet,Entity[rectangular bar magnet,region]]

or

In[33]:= EntityValue[rectangular bar magnet (physical system),Entity[rectangular bar magnet (physical system),region    (word)]]
Out[33]= EntityValue[rectangular bar magnet,Entity[rectangular bar magnet,region]]

I am not getting the Cuboid. Any good advise is highly appreciated. János

POSTED BY: Janos Lobb
2 Replies
Posted 7 years ago

Alan,

Thanks a lot. Now I start to "see". :-) Best, János

POSTED BY: Janos Lobb

It's hard to tell exactly what you're doing, since you're copying plain text instead of InputForm, which would be more helpful, but it looks to me like you're a) not using any correct syntax to request a property value and b) somehow also including the "Word" type entity "region" instead of the "Region" property associated with physical systems. Any of these will get you what you want, I think:

(Local2) In[5]:= 
Entity["PhysicalSystem", "RectangularBarMagnet"]["Region"]

(Local2) Out[5]= Cuboid[{-(QuantityVariable["a","Length"]/2), -(
   QuantityVariable["b","Length"]/2), -(QuantityVariable[
   "c","Length"]/2)}, {QuantityVariable["a","Length"]/2, 
  QuantityVariable["b","Length"]/2, QuantityVariable["c","Length"]/2}]

(Local2) In[10]:= 
Entity["PhysicalSystem", "RectangularBarMagnet"][
 EntityProperty["PhysicalSystem", "Region"]]

(Local2) Out[10]= Cuboid[{-(QuantityVariable["a","Length"]/2), -(
   QuantityVariable["b","Length"]/2), -(QuantityVariable[
   "c","Length"]/2)}, {QuantityVariable["a","Length"]/2, 
  QuantityVariable["b","Length"]/2, QuantityVariable["c","Length"]/2}]

(Local2) In[6]:= EntityValue[
 Entity["PhysicalSystem", "RectangularBarMagnet"], "Region"]

(Local2) Out[6]= Cuboid[{-(QuantityVariable["a","Length"]/2), -(
   QuantityVariable["b","Length"]/2), -(QuantityVariable[
   "c","Length"]/2)}, {QuantityVariable["a","Length"]/2, 
  QuantityVariable["b","Length"]/2, QuantityVariable["c","Length"]/2}]

(Local2) In[9]:= EntityValue[
 Entity["PhysicalSystem", "RectangularBarMagnet"], 
 EntityProperty["PhysicalSystem", "Region"]]

(Local2) Out[9]= Cuboid[{-(QuantityVariable["a","Length"]/2), -(
   QuantityVariable["b","Length"]/2), -(QuantityVariable[
   "c","Length"]/2)}, {QuantityVariable["a","Length"]/2, 
  QuantityVariable["b","Length"]/2, QuantityVariable["c","Length"]/2}]
POSTED BY: Alan Joyce
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract