How to automatically find out whether a nanopublication is retracted?

8 views
Skip to first unread message

Anatoly Scherbakov

unread,
Jan 25, 2025, 9:39:58 AMJan 25
to Nanopublications
Hi,

I am still playing with the same example nanopublication: https://nanodash.knowledgepixels.com/explore?3&id=RARv1-bZWsdvQs88TDH2trcwNoGF1g5AawE2sPKeh5K_0 — which is retracted, as this page rightfully says.

However, the JSON-LD download link in the bottom of the page does not return that information (again rightfully, since this info is not a part of the nanopublication itself).

I would like to try finding that information but I cannot find where exactly I can get that.

- I tried nanopub Python library but its dedicated NanopubClient.find_retractions_of() method won't work, I have filed an issue for that: https://github.com/fair-workflows/nanopub/issues/168

- I looked through Nanodash UI but haven't found any options for APIs or SPARQL querying;

- Maybe https://github.com/knowledgepixels/nanopub-query is the project to look at — but what is its API like? I would like to access a publicly available endpoint if possible instead of downloading the whole nanopublications index into the local machine.

I am sure there should be an obvious solution I am missing, would appreciate pointers to it. Thank you!

Anatoly

Piotr Sowiński

unread,
Jan 25, 2025, 10:14:57 AMJan 25
to nanopu...@googlegroups.com

Hi Anatoly,

This page lists some publicly available endpoints: https://nanopub.net/docs/network

Including a SPARQL one: https://virtuoso.nps.petapico.org/sparql

I use this in my application to filter out retracted nanopubs: https://github.com/RiverBench/ci-worker/blob/a3fcd6378e8339f3ef170182fac537e1970c5fc4/src/main/resources/sparql/getNanopubsForCategory.rq#L42

Maybe there is an easier way to do this... Quite possibly you could do the same by querying a Linked Data Fragments endpoint, like this one, with simple GET requests: http://ldf.nanopubs.lod.labs.vu.nl/np?graph=http%3A%2F%2Fwww.openlinksw.com%2Fschemas%2Fvirtrdf%23

(this endpoint is listed on the aforementioned page)

Piotr Sowiński
--
You received this message because you are subscribed to the Google Groups "Nanopublications" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nanopub-user...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/nanopub-users/fde22518-12f7-4c97-9036-0127f11a916cn%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Anatoly Scherbakov

unread,
Jan 25, 2025, 10:38:58 AMJan 25
to Nanopublications

Thanks for the link Piotr!

I was able to successfully get he response from http://grlc.nanopubs.lod.labs.vu.nl/api/local/local/ server, which I found on that page, via nanopub. A bit slow but it works!

Anatoly

Tobias Kuhn

unread,
Jan 27, 2025, 3:17:58 AMJan 27
to nanopu...@googlegroups.com
Hi Anatoly,

Piotr is right, but these are the first-generation services. We have now
second-generation query services in place, which are up and running and
stable (but under-documented at this point).

You can access this API method to check for latest versions /
retractions:
https://query.knowledgepixels.com/api/RAiRsB2YywxjsBMkVRTREJBooXhf2ZOHoUs5lxciEl37I/get-latest-version-of-np?np=...

E.g. (for automated access; your browser probably doesn't know what to
do with it):
https://query.knowledgepixels.com/api/RAiRsB2YywxjsBMkVRTREJBooXhf2ZOHoUs5lxciEl37I/get-latest-version-of-np?np=https://w3id.org/np/RAG6IQLcgknIZQSAjAx4srvRE3AR5_AuGwLYUYxtCajDY

(The SPARQL query template itself is stored in a nanopublication as well)

You can try it out here:
https://tapas.knowledgepixels.com/tapas.html?api=knowledgepixels/nanopub-query-api&op=/get-latest-version

If you get the same nanopub URI back, that means that it is the latest
version. If you get an empty set of URIs back, that means the nanopub
has been retracted (or has never been properly published in the first
place; for this distinction I still need to work on better queries).

You can in theory also get several URIs back, if several latest versions
exist (i.e. versions branching out).

Or you can write your own SPARQL queries through one of the endpoints
you can find here: https://query.knowledgepixels.com/

We will have some more documentation on this soon. In the meantime, feel
free to ask for help here.

Regards,
Tobias


On 25.01.25 16:38, Anatoly Scherbakov wrote:
>
> Thanks for the link Piotr!
>
> I was able to successfully get he response from http://
> grlc.nanopubs.lod.labs.vu.nl/api/local/local/ server, which I found on
> that page, via nanopub. A bit slow but it works!
>
> Anatoly
> On Saturday, January 25, 2025 at 7:14:57 PM UTC+4 psowi...@gmail.com wrote:
>
> __
>
> Hi Anatoly,
>
> This page lists some publicly available endpoints: https://
> nanopub.net/docs/network <https://nanopub.net/docs/network>
>
> Including a SPARQL one: https://virtuoso.nps.petapico.org/sparql
> <https://virtuoso.nps.petapico.org/sparql>
>
> I use this in my application to filter out retracted nanopubs:
> https://github.com/RiverBench/ci-worker/blob/
> a3fcd6378e8339f3ef170182fac537e1970c5fc4/src/main/resources/sparql/
> getNanopubsForCategory.rq#L42 <https://github.com/RiverBench/ci-
> worker/blob/a3fcd6378e8339f3ef170182fac537e1970c5fc4/src/main/
> resources/sparql/getNanopubsForCategory.rq#L42>
>
> Maybe there is an easier way to do this... Quite possibly you could
> do the same by querying a Linked Data Fragments endpoint, like this
> one, with simple GET requests: http://ldf.nanopubs.lod.labs.vu.nl/
> np?graph=http%3A%2F%2Fwww.openlinksw.com%2Fschemas%2Fvirtrdf%23
> <http://ldf.nanopubs.lod.labs.vu.nl/np?
> graph=http%3A%2F%2Fwww.openlinksw.com%2Fschemas%2Fvirtrdf%23>
>
> (this endpoint is listed on the aforementioned page)
>
> Piotr Sowiński
> On 1/25/25 15:39, Anatoly Scherbakov wrote:
>> Hi,
>>
>> I am still playing with the same example nanopublication: https://
>> nanodash.knowledgepixels.com/explore?3&id=RARv1-
>> bZWsdvQs88TDH2trcwNoGF1g5AawE2sPKeh5K_0 <https://
>> nanodash.knowledgepixels.com/explore?3&id=RARv1-
>> bZWsdvQs88TDH2trcwNoGF1g5AawE2sPKeh5K_0> — which is *retracted*,
>> as this page rightfully says.
>>
>> However, the JSON-LD download link in the bottom of the page does
>> not return that information (again rightfully, since this info is
>> not a part of the nanopublication itself).
>>
>> I would like to try finding that information but I cannot find
>> where exactly I can get that.
>>
>> - I tried nanopub Python library but its dedicated
>> NanopubClient.find_retractions_of() method won't work, I have
>> filed an issue for that: https://github.com/fair-workflows/
>> nanopub/issues/168 <https://github.com/fair-workflows/nanopub/
>> issues/168>
>>
>> - I looked through Nanodash UI but haven't found any options for
>> APIs or SPARQL querying;
>>
>> - Maybe https://github.com/knowledgepixels/nanopub-query <https://
>> github.com/knowledgepixels/nanopub-query> is the project to look
>> at — but what is its API like? I would like to access a publicly
>> available endpoint if possible instead of downloading the whole
>> nanopublications index into the local machine.
>>
>> I am sure there should be an obvious solution I am missing, would
>> appreciate pointers to it. Thank you!
>>
>> Anatoly
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Nanopublications" group.
>> To unsubscribe from this group and stop receiving emails from it,
>> send an email to nanopub-user...@googlegroups.com.
>> To view this discussion visit https://groups.google.com/d/msgid/
>> nanopub-users/
>> fde22518-12f7-4c97-9036-0127f11a916cn%40googlegroups.com <https://
>> groups.google.com/d/msgid/nanopub-users/
>> fde22518-12f7-4c97-9036-0127f11a916cn%40googlegroups.com?
>> utm_medium=email&utm_source=footer>.
>> For more options, visit https://groups.google.com/d/optout
>> <https://groups.google.com/d/optout>.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Nanopublications" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to nanopub-user...@googlegroups.com <mailto:nanopub-
> users+un...@googlegroups.com>.
> To view this discussion visit https://groups.google.com/d/msgid/nanopub-
> users/41052333-c120-46bb-8af0-d8613c74103an%40googlegroups.com <https://
> groups.google.com/d/msgid/nanopub-users/41052333-c120-46bb-8af0-
> d8613c74103an%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout <https://
> groups.google.com/d/optout>.

Anatoly Scherbakov

unread,
Jan 27, 2025, 1:17:19 PMJan 27
to Nanopublications
Thanks Tobias! Checking these out:

$ http --json --body --follow get 'https://query.knowledgepixels.com/api/RAiRsB2YywxjsBMkVRTREJBooXhf2ZOHoUs5lxciEl37I/get-latest-version-of-np?np=http://purl.org/np/RARv1-bZWsdvQs88TDH2trcwNoGF1g5AawE2sPKeh5K_0'
{
    "head": {
        "vars": [
            "latest",
            "date"
        ]
    },
    "results": {
        "bindings": []
    }
}

Indeed, this nanopublication has been revoked so the output is empty.

1. However, this output does not let us know why it is retracted, which other nanopub retracted it: do the v2 services provide a way to find that out?
2. In addition to retractions, I think there are other relations among nanopublications, like contests (which I could use to dispute someone else's publication), is there a way to find out which publications have contested this one?

Thank you!
Anatoly

Tobias Kuhn

unread,
Jan 28, 2025, 7:08:54 AMJan 28
to nanopu...@googlegroups.com
Hi Anatoly,

Yes, good points. You can create your own APIs with nanopublications
containing SPARQL templates, as I mentioned in my last email, but this
is currently not well documented. We are working on this.

For now, I made this API method that returns all newer versions,
including retracted and superseded ones, together with the
nanopublication IDs that retract/supersede them.

You can find the defining nanopub including the SPARQL template here:
https://w3id.org/np/RA9OeciFLech0WuB4asnAnRylExdNGlryV07EhR4ZnnCw

You can try it out here:
https://tapas.knowledgepixels.com/tapas.html?api=RA9OeciFLech0WuB4asnAnRylExdNGlryV07EhR4ZnnCw&op=/get-newer-versions-of-np

And you can call it in your code with this URL:
https://query.knowledgepixels.com/api/RA9OeciFLech0WuB4asnAnRylExdNGlryV07EhR4ZnnCw/get-newer-versions-of-np?np=http://purl.org/np/RASVryv0gZQcauqi68N4cxu7kLVDxIBobPbDd2Ar2FvOA

btw, this is all decentralized, so instead of
"query.knowledgepixels.com" you can also use one of the other Nanopub
Query URLs that you can find here: https://monitor.knowledgepixels.com/

We can do a similar query/API for a relation like "contests". Will that
be a relation like "THIS-NANOPUB contests OTHER-NANOPUB" in the
assertion graph, or something more general like "THING/PERSON contests
OTHER-NANOPUB"? In the first case there is an easier/faster way to query
it, but both are possible.

Regards,
Tobias
> np?np=. <https://query.knowledgepixels.com/api/
> RAiRsB2YywxjsBMkVRTREJBooXhf2ZOHoUs5lxciEl37I/get-latest-version-of-
> np?np=.>..
>
> E.g. (for automated access; your browser probably doesn't know what to
> do with it):
> https://query.knowledgepixels.com/api/
> RAiRsB2YywxjsBMkVRTREJBooXhf2ZOHoUs5lxciEl37I/get-latest-version-of-
> np?np=https://w3id.org/np/
> RAG6IQLcgknIZQSAjAx4srvRE3AR5_AuGwLYUYxtCajDY <https://
> query.knowledgepixels.com/api/
> RAiRsB2YywxjsBMkVRTREJBooXhf2ZOHoUs5lxciEl37I/get-latest-version-of-
> np?np=https://w3id.org/np/
> RAG6IQLcgknIZQSAjAx4srvRE3AR5_AuGwLYUYxtCajDY>
>
> (The SPARQL query template itself is stored in a nanopublication as
> well)
>
> You can try it out here:
> https://tapas.knowledgepixels.com/tapas.html?api=knowledgepixels/
> nanopub-query-api&op=/get-latest-version <https://
> tapas.knowledgepixels.com/tapas.html?api=knowledgepixels/nanopub-
> query-api&op=/get-latest-version>
>
> If you get the same nanopub URI back, that means that it is the latest
> version. If you get an empty set of URIs back, that means the nanopub
> has been retracted (or has never been properly published in the first
> place; for this distinction I still need to work on better queries).
>
> You can in theory also get several URIs back, if several latest
> versions
> exist (i.e. versions branching out).
>
> Or you can write your own SPARQL queries through one of the endpoints
> you can find here: https://query.knowledgepixels.com/ <https://
> query.knowledgepixels.com/>
>
> We will have some more documentation on this soon. In the meantime,
> feel
> free to ask for help here.
>
> Regards,
> Tobias
>
>
> On 25.01.25 16:38, Anatoly Scherbakov wrote:
> >
> > Thanks for the link Piotr!
> >
> > I was able to successfully get he response from http://
> > grlc.nanopubs.lod.labs.vu.nl/api/local/local/ <http://
> grlc.nanopubs.lod.labs.vu.nl/api/local/local/> server, which I found on
> > that page, via nanopub. A bit slow but it works!
> >
> > Anatoly
> > On Saturday, January 25, 2025 at 7:14:57 PM UTC+4
> psowi...@gmail.com wrote:
> >
> > __
> >
> > Hi Anatoly,
> >
> > This page lists some publicly available endpoints: https://
> > nanopub.net/docs/network <http://nanopub.net/docs/network>
> <https://nanopub.net/docs/network <https://nanopub.net/docs/network>>
> > <https://virtuoso.nps.petapico.org/sparql <https://
> virtuoso.nps.petapico.org/sparql>>
> >
> > I use this in my application to filter out retracted nanopubs:
> > https://github.com/RiverBench/ci-worker/blob/ <https://
> github.com/RiverBench/ci-worker/blob/>
> > a3fcd6378e8339f3ef170182fac537e1970c5fc4/src/main/resources/sparql/
> > getNanopubsForCategory.rq#L42 <https://github.com/RiverBench/ci-
> <https://github.com/RiverBench/ci->
> > worker/blob/a3fcd6378e8339f3ef170182fac537e1970c5fc4/src/main/
> > resources/sparql/getNanopubsForCategory.rq#L42>
> >
> > Maybe there is an easier way to do this... Quite possibly you could
> > do the same by querying a Linked Data Fragments endpoint, like this
> > one, with simple GET requests: http://
> ldf.nanopubs.lod.labs.vu.nl/ <http://ldf.nanopubs.lod.labs.vu.nl/>
> > np?graph=http%3A%2F%2Fwww.openlinksw.com
> <http://2Fwww.openlinksw.com>%2Fschemas%2Fvirtrdf%23
> > <http://ldf.nanopubs.lod.labs.vu.nl/np <http://
> ldf.nanopubs.lod.labs.vu.nl/np>?
> > graph=http%3A%2F%2Fwww.openlinksw.com
> <http://2Fwww.openlinksw.com>%2Fschemas%2Fvirtrdf%23>
> >
> > (this endpoint is listed on the aforementioned page)
> >
> > Piotr Sowiński
> > On 1/25/25 15:39, Anatoly Scherbakov wrote:
> >> Hi,
> >>
> >> I am still playing with the same example nanopublication: https://
> >> nanodash.knowledgepixels.com/explore?3&id=RARv1- <http://
> nanodash.knowledgepixels.com/explore?3&id=RARv1->
> >> bZWsdvQs88TDH2trcwNoGF1g5AawE2sPKeh5K_0 <https://
> >> nanodash.knowledgepixels.com/explore?3&id=RARv1- <http://
> nanodash.knowledgepixels.com/explore?3&id=RARv1->
> >> bZWsdvQs88TDH2trcwNoGF1g5AawE2sPKeh5K_0> — which is *retracted*,
> >> as this page rightfully says.
> >>
> >> However, the JSON-LD download link in the bottom of the page does
> >> not return that information (again rightfully, since this info is
> >> not a part of the nanopublication itself).
> >>
> >> I would like to try finding that information but I cannot find
> >> where exactly I can get that.
> >>
> >> - I tried nanopub Python library but its dedicated
> >> NanopubClient.find_retractions_of() method won't work, I have
> >> filed an issue for that: https://github.com/fair-workflows/
> <https://github.com/fair-workflows/>
> >> nanopub/issues/168 <https://github.com/fair-workflows/nanopub/
> <https://github.com/fair-workflows/nanopub/>
> >> issues/168>
> >>
> >> - I looked through Nanodash UI but haven't found any options for
> >> APIs or SPARQL querying;
> >>
> >> - Maybe https://github.com/knowledgepixels/nanopub-query
> <https://github.com/knowledgepixels/nanopub-query> <https://
> >> github.com/knowledgepixels/nanopub-query <http://github.com/
> knowledgepixels/nanopub-query>> is the project to look
> >> at — but what is its API like? I would like to access a publicly
> >> available endpoint if possible instead of downloading the whole
> >> nanopublications index into the local machine.
> >>
> >> I am sure there should be an obvious solution I am missing, would
> >> appreciate pointers to it. Thank you!
> >>
> >> Anatoly
> >> --
> >> You received this message because you are subscribed to the Google
> >> Groups "Nanopublications" group.
> >> To unsubscribe from this group and stop receiving emails from it,
> >> send an email to nanopub-user...@googlegroups.com.
> >> To view this discussion visit https://groups.google.com/d/msgid/
> <https://groups.google.com/d/msgid/>
> >> nanopub-users/
> >> fde22518-12f7-4c97-9036-0127f11a916cn%40googlegroups.com
> <http://40googlegroups.com> <https://
> >> groups.google.com/d/msgid/nanopub-users/ <http://
> groups.google.com/d/msgid/nanopub-users/>
> >> fde22518-12f7-4c97-9036-0127f11a916cn%40googlegroups.com
> <http://40googlegroups.com>?
> >> utm_medium=email&utm_source=footer>.
> >> For more options, visit https://groups.google.com/d/optout
> <https://groups.google.com/d/optout>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Nanopublications" group.
> > To unsubscribe from this group and stop receiving emails from it,
> send
> > an email to nanopub-user...@googlegroups.com <mailto:nanopub-
> > users+un...@googlegroups.com>.
> > To view this discussion visit https://groups.google.com/d/msgid/
> nanopub- <https://groups.google.com/d/msgid/nanopub->
> > users/41052333-c120-46bb-8af0-d8613c74103an%40googlegroups.com
> <http://40googlegroups.com> <https://
> > groups.google.com/d/msgid/nanopub-users/41052333-c120-46bb-8af0-
> <http://groups.google.com/d/msgid/nanopub-users/41052333-
> c120-46bb-8af0->
> > d8613c74103an%40googlegroups.com?
> utm_medium=email&utm_source=footer <http://40googlegroups.com?
> utm_medium=email&utm_source=footer>>.
> > For more options, visit https://groups.google.com/d/optout
> <https://groups.google.com/d/optout> <https://
> > groups.google.com/d/optout <http://groups.google.com/d/optout>>.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Nanopublications" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to nanopub-user...@googlegroups.com <mailto:nanopub-
> users+un...@googlegroups.com>.
> To view this discussion visit https://groups.google.com/d/msgid/nanopub-
> users/b26612bd-408d-42af-895d-71117342cad6n%40googlegroups.com <https://
> groups.google.com/d/msgid/nanopub-users/
> b26612bd-408d-42af-895d-71117342cad6n%40googlegroups.com?

Anatoly Scherbakov

unread,
Jan 28, 2025, 1:59:45 PMJan 28
to Tobias Kuhn, nanopu...@googlegroups.com
Tobias,

Interesting! I did not realize a nanopublication could contain SPARQL and thus become executable. I will look into integrating this API instead of the older one as powered by nanopub.

The implementation of a contests relation in a similar fashion would be interesting; I'll try to do it myself a bit later using this one as an example.

Thanks,
Anatoly

You received this message because you are subscribed to a topic in the Google Groups "Nanopublications" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/nanopub-users/timA_pmETz0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to nanopub-user...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/nanopub-users/22772ecb-1e50-47ce-9d2f-e75940c78dfc%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages