Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Collecting multiple results from a resource path into a list #149

@jg10-mastodon-social

Description

@jg10-mastodon-social

I'd like to be able to take a resource path that returns multiple results and then apply list operations to them.

It looks like I can get close but not quite, so I'm looking for advice - and potentially a new built-in suited to this case - a resource path version of log:collectAllIn, e.g. log:asList.

It looks like this works, but only because it's counting number of blank nodes for ?x

{?formula ex:asList ?list.} <= {
  ( ?x  ?formula  ?list ) log:collectAllIn _:x .
}.

{
  ?product a schema:Product.
  {?product^sosa:observedProperty}!ex:asList!list:length log:equalTo ?nObs.
}=>
{
  ?product ex:nobs ?nObs.
}.

This then doesn't work, because ?last is just a blank node:

{
  ?product a schema:Product.                                              
  {?product^sosa:observedProperty}!ex:asList!list:last log:equalTo ?last.
}=>
{
  ?product ex:last ?last.
}.

Is there a way to match the result from a resource path so that it can be extracted by log:collectAllIn?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions