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

Latest dev to test branch #475

Open
wants to merge 5 commits into
base: test_dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/scheduled-dev-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Build develop

on:
schedule:
- cron: '39 4,10,16,22 * * *'
- cron: '39 12 10,23 * *'

jobs:
test:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/scheduled-master-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Build master

on:
schedule:
- cron: '13 2 * * *'
- cron: '13 2 10,23 * *'

jobs:
test:
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
[![Docs](https://readthedocs.org/projects/owmeta/badge/?version=latest)](https://owmeta.readthedocs.io/en/latest)
[![Coverage Status](https://coveralls.io/repos/github/openworm/owmeta/badge.svg?branch=dev)](https://coveralls.io/github/openworm/owmeta?branch=dev)

owmeta
owmeta
======
<img width="1207" alt="pyow_in_overview" src="openworm-overview.png">

Expand Down Expand Up @@ -170,7 +170,7 @@ data and models to corresponding articles from peer-reviewed literature:
>>> evctx = conn(Context)(ident='http://example.org/evidence/context')

# Make a context for defining domain knowledge
>>> dctx = conn(Context)(ident='http://example.org/data/context')
>>> dctx = evctx(Context)(ident='http://example.org/data/context')
>>> doc = evctx(Document)(key="Sulston83", author='Sulston et al.', date='1983')
>>> e = evctx(Evidence)(key="Sulston83", reference=doc)
>>> avdl = dctx(Neuron)(name="AVDL")
Expand Down
21 changes: 18 additions & 3 deletions examples/add_reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,27 @@

import owmeta_core as P
from owmeta_core.data import Data
from owmeta_core.context import Context
from owmeta_core.dataobject import DataObject
from owmeta_core.context import Context, IMPORTS_CONTEXT_KEY

from owmeta.evidence import Evidence
from owmeta.neuron import Neuron
from owmeta.document import Document

# Create dummy database configuration.
d = Data()
d[IMPORTS_CONTEXT_KEY] = 'http://example.org/imports'

# Connect to database with dummy configuration
conn = P.connect(conf=d)
conn.mapper.add_class(Evidence)
conn.mapper.add_class(Document)
ctx = conn(Context)(ident='http://example.org/data')
evctx = conn(Context)(ident='http://example.org/meta')
ctx = evctx(Context)(ident='http://example.org/data')

# Add the Context RDF class to the mapper -- normally you'd get these from the
# openworm/owmeta-core bundle as a dependency
conn.mapper.add_class(type(ctx.rdf_object))

# Create a new Neuron object to work with
n = ctx(Neuron)(name='AVAL')
Expand All @@ -46,9 +52,18 @@
ctx.save_context()
evctx.save_context()

evctx.add_import(Document.definition_context)
evctx.save_imports()

# Add a couple contexts to the store so we can resolve needed types. normally you'd get
# these from the openworm/owmeta-core bundle as a dependency, so they don't have to be
# added to the database again.
Document.definition_context.save_context(conn.rdf)
DataObject.definition_context.save_context(conn.rdf)

# What does my evidence object contain?
for e_i in evctx.stored(Evidence)().load():
print(e_i.reference(), e_i.supports())

# Disconnect from the database.
P.disconnect(conn)
conn.disconnect()
5 changes: 4 additions & 1 deletion tests/EvidenceTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from owmeta_core.dataobject import DataObject
from owmeta_core.configure import Configurable
from owmeta_core.context import Context

from owmeta.evidence import Evidence

Expand All @@ -14,6 +15,7 @@
except ImportError:
from mock import patch

import rdflib

class EvidenceTest(_DataTest):
ctx_classes = (Evidence,)
Expand All @@ -32,7 +34,8 @@ def test_asserts(self):
Asserting something should allow us to get it back.
"""
e = self.ctx.Evidence(key='WBPaper00044600')
r = DataObject(key="context_data_object")
ctx = self.context(Context)(rdflib.URIRef('https://example.org/context'))
r = ctx.rdf_object
e.supports(r)
s = list(e.supports.get())
self.assertIn(r, s)
Expand Down
Loading