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

Add API support for displaying all evidence for a dataObject #254

Open
slarson opened this issue Aug 24, 2015 · 6 comments
Open

Add API support for displaying all evidence for a dataObject #254

slarson opened this issue Aug 24, 2015 · 6 comments

Comments

@slarson
Copy link
Member

slarson commented Aug 24, 2015

A dataObject such as a neuron may have a variety of properties. Currently, in order to look up what evidence is associated with a given object, you will have to ask for each property in turn, and look up if there is evidence associated with that property.

If dataObjects supported a .get_evidence() method that took all properties registered with that dataObject and returned a list of evidence associated with whichever property there was, this would make for an easier time interrogating the data.

@mwatts15
Copy link
Contributor

Something like this is very doable. The contexts which make statements about an object will have a statement object rdf:type object_type.

A more precise implementation is also possible by encapsulating queries for each statement and then getting the contexts in which those statements are made. The query_context.py example shows how this can be done.

@mwatts15 mwatts15 pinned this issue Mar 6, 2019
@jaideep-seth jaideep-seth mentioned this issue Mar 7, 2019
@mwatts15
Copy link
Contributor

The idea is basically to retrieve the contexts for each statement and then to retrieve the evidence for each of those contexts.

I would test what happens when there is no evidence attached to any of the contexts (should return no evidence), test that no evidence object is returned more than once (edited)

Also test what happens when there is no context associated with the object you are querying

Here's an example for an evidence_for function:

>>> c1 = Context(key='c1')
>>> c2 = Context(key='c2')
>>> c3 = Context(key='c3')
>>> evc = Context(key='evc')

>>> c1(Apple)('red-delicious').color('red')
PyOpenWorm.statement.Statement(...)

>>> c1(Apple)('red-delicious').sweetness(7)
PyOpenWorm.statement.Statement(...)

>>> c2(Apple)('red-delicious').sweetness(2)
PyOpenWorm.statement.Statement(...)

>>> ev1 = evc(Evidence)(key='mw2019')
>>> ev1.supports(c1)
PyOpenWorm.statement.Statement(...)

>>> ev2 = evc(Evidence)(key='mw2020')
>>> ev2.supports(c2)
PyOpenWorm.statement.Statement(...)

>>> c3.add_import(c1)
>>> c3.add_import(c2)
>>> c3.add_import(evc)
>>> c3.save()

Get evidence about the Apple 'red-delicious':

>>> for x in evidence_for(Apple('red-delicious'), context=c3.stored):
...     print(x)
Evidence(http://openworm.org/entities/Evidence/mw2019)
Evidence(http://openworm.org/entities/Evidence/mw2020)

Should get the union of contexts for each of the statements for which the
given argument is in subject position (at the head of the statement) and then
the union of the evidence supporting each of these contexts. Should return an
iterable of Evidence objects that support any one of the statements.

I don't care what the function is called as long as it makes sense. I'm against
the idea of putting something like a get_evidence on DataObject -- I don't
think, for arbitrary DataObject subclasses, that Evidence makes sense since
arbitrary objects don't have a scholarly reference which is mainly what Evidence is for.

This was referenced Mar 16, 2019
@mwatts15
Copy link
Contributor

Hi, @jaideep-seth .

For the integrity test you will use the integrity test conf, but the setUp method will take care of that for you. readme.conf is just for the sake of the README.md doctests.

Also, just some operational stuff:

  • Generally, you should make comments about code within a pull request on the pull request itself rather than on the issue so we can tie the conversation to the related code and keep the issue comments to progress on the issue as a whole.
  • Please keep to one pull request at a time for a single issue until the work is complete on that part of the solution.

@jaideep-seth
Copy link
Collaborator

jaideep-seth commented Mar 30, 2019

@mwatts15 , could you please assign me to this issue?

-Thank you!

mwatts15 pushed a commit that referenced this issue Mar 31, 2019
@mwatts15 mwatts15 added this to Backlog in openworm/ChannelWorm Apr 13, 2019
@mwatts15 mwatts15 added this to Backlog in OpenWorm Top-level Apr 13, 2019
@jaideep-seth
Copy link
Collaborator

  • querying evidence_for with Contexts for statements having/not having an associated Evidence object.
  • adding support for querying evidence_for for DataObjects other than Contexts holding statements.
  • adding support for querying evidence_for for Contexts that do have an identifier.

hello @mwatts15, Is this how evidence_for could be queried for Evidence of DataObjects(2nd Checkpoint)?
`

from PyOpenWorm.neuron import Neuron
neuron = Neuron('AVAL')
neuron
Neuron(ident=rdflib.term.URIRef('http://openworm.org/entities/Neuron/AVAL'))

for x in evidence_for(neuron):
... print(x)
Evidence(http://openworm.org/entities/Evidence/js2019)
`

Like evidence_for in evidence.py should the above shown form of evidence_for be added to dataObject.py?

-Thanks!

@mwatts15
Copy link
Contributor

mwatts15 commented Apr 23, 2019

That's what it should look like.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
owmeta
  
Ready
Development

No branches or pull requests

3 participants