Group Abstract Group Abstract

Message Boards Message Boards

1
|
3.5K Views
|
4 Replies
|
7 Total Likes
View groups...
Share
Share this post:

How to Structure a Simple EntityStore

I posted this on Stack Exchange, but received no replies. Maybe someone in the community has an answer. I have modified a simple example from the documentation:

store = EntityStore[
  "t" -> <|"Entities" -> <|"e1" -> <|"p1" -> 17|>, 
      "e2" -> <|"p2" -> 288|>|>|>];
EntityRegister[store];
Entity["t", "e1"]["Properties"]

In this modified example, entity e1 only has property p1, while entity e2 only has property p2. However, when you query the properties for each entity, both properties p1 and p2 are listed.

Is there a way to structure the store so that only property p1 shows for entity e1 and only property p2 shows for entity e2?

POSTED BY: Jonathan Kinlay
4 Replies

In any event my question remains unanswered. I.e. is there a way to construct an EntityStore so that entities can have different properties. Or can the EntityStore construct only handle regular (non-ragged) datasets? Imputing properties or property values is not what is required here...

POSTED BY: Jonathan Kinlay

But I don't agree with our characterization that entities of type "t" have two properties.

By definition they do. Properties are defined for each semantic type defined in a given entity store. Your entity store has one semantic type with two defined properties. There is only one value stored for each property, because your data is ragged rather than rectangular. But EntityValue does a great job with non-rectangular data and will return a Missing for any property value not stored in the data.

POSTED BY: Jason Biggs

Your store is structured properly, and the return from "Properties" is correct because entities of type "t" have two properties. I don't see this in the documentation anywhere but it looks like you can get the list of properties from a given entity that would return a non-missing value with the following:

In[23]:= Entity["t", "e1"]["NonMissingProperties"]

Out[23]= {EntityProperty["t", "p1"]}
POSTED BY: Jason Biggs
POSTED BY: Jonathan Kinlay
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard