Convert Entity Property to String
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
I am doing some work with my own EntityStores
as well as the built in Wolfram Entities. After pulling a subset of data, I am wanting to structure it as a dataset and to do so I need to be able to extract the property names to use as keys in an association thread.
It easy to get the Properties, but as you can see, the result comes out structured like an Entity
.
I tried using TextString
but essentially got the input form:
If I were dealing with the Entities themselves, I could use simply use ["Name:]
I can do a work around with StringSplit, but that seems like a very round about way to do things.
StringSplit[#, "[", ","] & /@
TextString /@ EntityProperties["Aircraft"][[All, 2]] // Flatten
Is there a solution that I am missing that doesn't require such Wolfram Gymnastics?
entity
add a comment |Â
up vote
1
down vote
favorite
I am doing some work with my own EntityStores
as well as the built in Wolfram Entities. After pulling a subset of data, I am wanting to structure it as a dataset and to do so I need to be able to extract the property names to use as keys in an association thread.
It easy to get the Properties, but as you can see, the result comes out structured like an Entity
.
I tried using TextString
but essentially got the input form:
If I were dealing with the Entities themselves, I could use simply use ["Name:]
I can do a work around with StringSplit, but that seems like a very round about way to do things.
StringSplit[#, "[", ","] & /@
TextString /@ EntityProperties["Aircraft"][[All, 2]] // Flatten
Is there a solution that I am missing that doesn't require such Wolfram Gymnastics?
entity
2
Doesn't alreadyEntityProperties["Aircraft"][[All , 2]]
give you what you want?
â Kubaâ¦
2 hours ago
Wow... it does... I had no idea you could select a part of the variables of a function. Essentially that code would be:EntityProperty["Aircraft","Ceiling"][[2]]
which in fact returns "Ceiling". I had only seenPart
used with lists and not with functions. Thanks for the simple solution!
â kickert
2 hours ago
2
Unless an expression is atomic (AtomQ), you can manipulate it like aList
can be manipulated.
â Kubaâ¦
1 hour ago
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I am doing some work with my own EntityStores
as well as the built in Wolfram Entities. After pulling a subset of data, I am wanting to structure it as a dataset and to do so I need to be able to extract the property names to use as keys in an association thread.
It easy to get the Properties, but as you can see, the result comes out structured like an Entity
.
I tried using TextString
but essentially got the input form:
If I were dealing with the Entities themselves, I could use simply use ["Name:]
I can do a work around with StringSplit, but that seems like a very round about way to do things.
StringSplit[#, "[", ","] & /@
TextString /@ EntityProperties["Aircraft"][[All, 2]] // Flatten
Is there a solution that I am missing that doesn't require such Wolfram Gymnastics?
entity
I am doing some work with my own EntityStores
as well as the built in Wolfram Entities. After pulling a subset of data, I am wanting to structure it as a dataset and to do so I need to be able to extract the property names to use as keys in an association thread.
It easy to get the Properties, but as you can see, the result comes out structured like an Entity
.
I tried using TextString
but essentially got the input form:
If I were dealing with the Entities themselves, I could use simply use ["Name:]
I can do a work around with StringSplit, but that seems like a very round about way to do things.
StringSplit[#, "[", ","] & /@
TextString /@ EntityProperties["Aircraft"][[All, 2]] // Flatten
Is there a solution that I am missing that doesn't require such Wolfram Gymnastics?
entity
entity
asked 2 hours ago
kickert
53715
53715
2
Doesn't alreadyEntityProperties["Aircraft"][[All , 2]]
give you what you want?
â Kubaâ¦
2 hours ago
Wow... it does... I had no idea you could select a part of the variables of a function. Essentially that code would be:EntityProperty["Aircraft","Ceiling"][[2]]
which in fact returns "Ceiling". I had only seenPart
used with lists and not with functions. Thanks for the simple solution!
â kickert
2 hours ago
2
Unless an expression is atomic (AtomQ), you can manipulate it like aList
can be manipulated.
â Kubaâ¦
1 hour ago
add a comment |Â
2
Doesn't alreadyEntityProperties["Aircraft"][[All , 2]]
give you what you want?
â Kubaâ¦
2 hours ago
Wow... it does... I had no idea you could select a part of the variables of a function. Essentially that code would be:EntityProperty["Aircraft","Ceiling"][[2]]
which in fact returns "Ceiling". I had only seenPart
used with lists and not with functions. Thanks for the simple solution!
â kickert
2 hours ago
2
Unless an expression is atomic (AtomQ), you can manipulate it like aList
can be manipulated.
â Kubaâ¦
1 hour ago
2
2
Doesn't already
EntityProperties["Aircraft"][[All , 2]]
give you what you want?â Kubaâ¦
2 hours ago
Doesn't already
EntityProperties["Aircraft"][[All , 2]]
give you what you want?â Kubaâ¦
2 hours ago
Wow... it does... I had no idea you could select a part of the variables of a function. Essentially that code would be:
EntityProperty["Aircraft","Ceiling"][[2]]
which in fact returns "Ceiling". I had only seen Part
used with lists and not with functions. Thanks for the simple solution!â kickert
2 hours ago
Wow... it does... I had no idea you could select a part of the variables of a function. Essentially that code would be:
EntityProperty["Aircraft","Ceiling"][[2]]
which in fact returns "Ceiling". I had only seen Part
used with lists and not with functions. Thanks for the simple solution!â kickert
2 hours ago
2
2
Unless an expression is atomic (AtomQ), you can manipulate it like a
List
can be manipulated.â Kubaâ¦
1 hour ago
Unless an expression is atomic (AtomQ), you can manipulate it like a
List
can be manipulated.â Kubaâ¦
1 hour ago
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
5
down vote
accepted
You could use EntityValue
instead:
EntityValue["Aircraft","PropertyCanonicalNames"]
"Ceiling", "Crew", "CruiseSpeed", "DesignedBy", "EmptyWeightPerBooster",
"Height", "Image", "Introduced", "Length", "LoadedWeight", "MaidenFlight",
"Manufacturer", "MaxSpeed", "MaxWeight", "Name", "NumberBuilt", "PowerPlant",
"PowerPlantCount", "Range", "RateOfClimb", "Status", "Type", "WingArea",
"WingLoading", "Wingspan"
Another possibility is to use the function CanonicalName
:
CanonicalName /@ EntityProperties["Aircraft"]
Also, for built-in entity types, you could use the subproperty "Dataset" to create a dataset:
EntityValue[
EntityClass["Aircraft", "Harlow"],
"Ceiling", "Height", "Length",
"Dataset"
]
Excellent. That works great. I was afraid it wouldn't work with my ownEntityStores
since they include very limited properties, but everything translates nicely.
â kickert
2 hours ago
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
5
down vote
accepted
You could use EntityValue
instead:
EntityValue["Aircraft","PropertyCanonicalNames"]
"Ceiling", "Crew", "CruiseSpeed", "DesignedBy", "EmptyWeightPerBooster",
"Height", "Image", "Introduced", "Length", "LoadedWeight", "MaidenFlight",
"Manufacturer", "MaxSpeed", "MaxWeight", "Name", "NumberBuilt", "PowerPlant",
"PowerPlantCount", "Range", "RateOfClimb", "Status", "Type", "WingArea",
"WingLoading", "Wingspan"
Another possibility is to use the function CanonicalName
:
CanonicalName /@ EntityProperties["Aircraft"]
Also, for built-in entity types, you could use the subproperty "Dataset" to create a dataset:
EntityValue[
EntityClass["Aircraft", "Harlow"],
"Ceiling", "Height", "Length",
"Dataset"
]
Excellent. That works great. I was afraid it wouldn't work with my ownEntityStores
since they include very limited properties, but everything translates nicely.
â kickert
2 hours ago
add a comment |Â
up vote
5
down vote
accepted
You could use EntityValue
instead:
EntityValue["Aircraft","PropertyCanonicalNames"]
"Ceiling", "Crew", "CruiseSpeed", "DesignedBy", "EmptyWeightPerBooster",
"Height", "Image", "Introduced", "Length", "LoadedWeight", "MaidenFlight",
"Manufacturer", "MaxSpeed", "MaxWeight", "Name", "NumberBuilt", "PowerPlant",
"PowerPlantCount", "Range", "RateOfClimb", "Status", "Type", "WingArea",
"WingLoading", "Wingspan"
Another possibility is to use the function CanonicalName
:
CanonicalName /@ EntityProperties["Aircraft"]
Also, for built-in entity types, you could use the subproperty "Dataset" to create a dataset:
EntityValue[
EntityClass["Aircraft", "Harlow"],
"Ceiling", "Height", "Length",
"Dataset"
]
Excellent. That works great. I was afraid it wouldn't work with my ownEntityStores
since they include very limited properties, but everything translates nicely.
â kickert
2 hours ago
add a comment |Â
up vote
5
down vote
accepted
up vote
5
down vote
accepted
You could use EntityValue
instead:
EntityValue["Aircraft","PropertyCanonicalNames"]
"Ceiling", "Crew", "CruiseSpeed", "DesignedBy", "EmptyWeightPerBooster",
"Height", "Image", "Introduced", "Length", "LoadedWeight", "MaidenFlight",
"Manufacturer", "MaxSpeed", "MaxWeight", "Name", "NumberBuilt", "PowerPlant",
"PowerPlantCount", "Range", "RateOfClimb", "Status", "Type", "WingArea",
"WingLoading", "Wingspan"
Another possibility is to use the function CanonicalName
:
CanonicalName /@ EntityProperties["Aircraft"]
Also, for built-in entity types, you could use the subproperty "Dataset" to create a dataset:
EntityValue[
EntityClass["Aircraft", "Harlow"],
"Ceiling", "Height", "Length",
"Dataset"
]
You could use EntityValue
instead:
EntityValue["Aircraft","PropertyCanonicalNames"]
"Ceiling", "Crew", "CruiseSpeed", "DesignedBy", "EmptyWeightPerBooster",
"Height", "Image", "Introduced", "Length", "LoadedWeight", "MaidenFlight",
"Manufacturer", "MaxSpeed", "MaxWeight", "Name", "NumberBuilt", "PowerPlant",
"PowerPlantCount", "Range", "RateOfClimb", "Status", "Type", "WingArea",
"WingLoading", "Wingspan"
Another possibility is to use the function CanonicalName
:
CanonicalName /@ EntityProperties["Aircraft"]
Also, for built-in entity types, you could use the subproperty "Dataset" to create a dataset:
EntityValue[
EntityClass["Aircraft", "Harlow"],
"Ceiling", "Height", "Length",
"Dataset"
]
edited 29 mins ago
answered 2 hours ago
Carl Woll
57.3k273149
57.3k273149
Excellent. That works great. I was afraid it wouldn't work with my ownEntityStores
since they include very limited properties, but everything translates nicely.
â kickert
2 hours ago
add a comment |Â
Excellent. That works great. I was afraid it wouldn't work with my ownEntityStores
since they include very limited properties, but everything translates nicely.
â kickert
2 hours ago
Excellent. That works great. I was afraid it wouldn't work with my own
EntityStores
since they include very limited properties, but everything translates nicely.â kickert
2 hours ago
Excellent. That works great. I was afraid it wouldn't work with my own
EntityStores
since they include very limited properties, but everything translates nicely.â kickert
2 hours ago
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f182117%2fconvert-entity-property-to-string%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
2
Doesn't already
EntityProperties["Aircraft"][[All , 2]]
give you what you want?â Kubaâ¦
2 hours ago
Wow... it does... I had no idea you could select a part of the variables of a function. Essentially that code would be:
EntityProperty["Aircraft","Ceiling"][[2]]
which in fact returns "Ceiling". I had only seenPart
used with lists and not with functions. Thanks for the simple solution!â kickert
2 hours ago
2
Unless an expression is atomic (AtomQ), you can manipulate it like a
List
can be manipulated.â Kubaâ¦
1 hour ago