Skip to content
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 src/cx_rdf/aspect_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import logging
from typing import Dict, List, Optional

from ndex2.cx import known_aspects
from ndex2 import known_aspects
from rdflib import BNode, Graph, Literal, RDF, RDFS

from .constants import CX
Expand Down
2 changes: 1 addition & 1 deletion src/cx_rdf/predicate_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import logging
from typing import Dict, List, Optional

from ndex2.cx import known_aspects
from ndex2 import known_aspects
from rdflib import BNode, Graph, Literal, Namespace, RDF

from .abstract_policy import _handle_aspects
Expand Down
16 changes: 6 additions & 10 deletions tests/test_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@

from cx_rdf import cx_to_rdf_graph
from ndex2 import NiceCXNetwork
from ndex2.cx import CX_CONSTANTS
from ndex2.cx.aspects.CitationElement import CitationElement
from ndex2.cx.aspects.SupportElement import SupportElement
from rdflib import Graph


Expand Down Expand Up @@ -42,11 +39,11 @@ def setUpClass(cls):
edge_interaction='increases',
)

c1 = CitationElement(id=0, title='Hi')
cx_network.add_citation(c1)
c1 = cx_network.add_citation(id=0, title='Hi')
cx_network.add_edge_citations(e1, c1.get('@id'))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The interface would be much more user friendly if it accepted c1 directly, and inside add_edge_citations the code could use isinstance() to check if it's a str or dict, then run this call to get()

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. I'll update add_edge_citations()


s1 = SupportElement(id=0, text='Hi')
cx_network.add_support(s1)
s1 = cx_network.add_support(id=0, text='Hi')
cx_network.add_edge_supports(e1, s1.get('@id'))

cx_network.add_node_attribute(property_of=a, name='Color', values='Red')
cx_network.add_node_attribute(property_of=b, name='Color', values='Red')
Expand All @@ -65,10 +62,9 @@ def setUpClass(cls):
cx_network.add_edge_attribute(property_of=e1, name='Color', values='Green')
cx_network.add_edge_attribute(property_of=e2, name='Color', values='Purple')

cx_network.add_edge_citations(edge_id=e1, citation_id=c1.get_id())
cx_network.add_edge_citations(edge_id=e1, citation_id=c1.get('@id'))

edge_support_element_1 = {CX_CONSTANTS.PROPERTY_OF: [e1], CX_CONSTANTS.SUPPORTS: [c1.get_id()]}
cx_network.add_edge_supports(edge_supports_element=edge_support_element_1)
cx_network.add_edge_supports(e1, c1.get('@id'))

cls.cx_json = json.loads(json.dumps(cx_network.to_cx()))
print(json.dumps(cls.cx_json, indent=2))
Expand Down