# HG changeset patch # User drewp@bigasterisk.com # Date 1684884392 25200 # Node ID 165fc8ed28ab2d64937e8ac0c0ef47283c6d23e9 # Parent 436a1fdbfe4a41f55ee90647f96a97bb76534838 clearly this approach is wrong diff -r 436a1fdbfe4a -r 165fc8ed28ab light9/typedgraph.py --- a/light9/typedgraph.py Tue May 23 15:52:26 2023 -0700 +++ b/light9/typedgraph.py Tue May 23 16:26:32 2023 -0700 @@ -72,6 +72,8 @@ try: if ConvFrom == URIRef and _typeIncludes(ConvTo, URIRef): conv = obj + elif ConvFrom == URIRef and issubclass(URIRef, ConvTo) and not issubclass(str, ConvTo): # rewrite please + conv = obj elif ConvFrom == BNode and issubclass(BNode, ConvTo): conv = obj elif ConvFrom == Literal: diff -r 436a1fdbfe4a -r 165fc8ed28ab light9/typedgraph_test.py --- a/light9/typedgraph_test.py Tue May 23 15:52:26 2023 -0700 +++ b/light9/typedgraph_test.py Tue May 23 16:26:32 2023 -0700 @@ -49,6 +49,9 @@ def test_getsUri(self): assert typedValue(URIRef, g, subj, L9['uri']) == L9['c'] + def test_getsAsNode(self): + assert typedValue(Node, g, subj, L9['uri']) == L9['c'] + def test_getsBNode(self): # this is unusual usage since users ought to always be able to replace BNode with URIRef assert typedValue(BNode, g, subj, L9['bnode']) == g.value(subj, L9['bnode'])