Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get thing of type #1488

Open
michaud opened this issue Feb 23, 2022 · 1 comment
Open

get thing of type #1488

michaud opened this issue Feb 23, 2022 · 1 comment
Labels
enhancement New feature request

Comments

@michaud
Copy link

michaud commented Feb 23, 2022

Search terms you've used

getThing

Feature suggestion

Get a Thing not by iri but by type.
const bag = getThingOfType(ds, golf.classes.Bag)
const clubs = getThingAllOfType(ds, golf.classes.Club)

Expected functionality/enhancement

getThingOfType returns the first Thing of that type,
getThingAllOfType returns all Things of that type

Actual functionality/enhancement

at the moment you have to know the iri of the Thing to be able to get the Thing from the Dataset or you have to use getThingAll and filter the items by checking the type. If you have one Thing of type in the document this seems overly verbose. Also you don't always know the iri of the Thing: "https://test.inrupt.net/public/golf/data/clubs.ttl#164561119414735272867392814433"

Use Cases

load a list of Things, show those things in a UI, manipulate those Things

@michaud michaud added the enhancement New feature request label Feb 23, 2022
@NSeydoux
Copy link
Contributor

That's a good idea, and it could be generalized to something like getThingMatching(predicate, object). getThingOfType would then approximately be const getThingOfType = (type) => getThingMatching(RDF.type, type);

I haven't forgotten about this issue, but I don't know when I'll be able to work on it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature request
Projects
None yet
Development

No branches or pull requests

2 participants