Skip to content

Commit 8508bf0

Browse files
committed
fixed weblinks being truncated by oslcquery
1 parent a5b25ae commit 8508bf0

File tree

17 files changed

+404
-403
lines changed

17 files changed

+404
-403
lines changed

elmclient/_project.py

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -353,23 +353,15 @@ def resolve_uri_to_name(self, uri, trytouseasid=False):
353353
# print( f"2 {uri=} {result=}")
354354

355355
if result is None:
356-
if '#' in uri:
357-
result = uri.rsplit( "#",1)[1]
358-
elif "/" in uri:
359-
result = uri.rsplit( "/",1)[1]
356+
if uri.startswith( self.reluri("/") ) or rdfxml.startswith_known_prefix( uri ):
357+
if '#' in uri:
358+
result = uri.rsplit( "#",1)[1]
359+
elif "/" in uri:
360+
result = uri.rsplit( "/",1)[1]
361+
else:
362+
result = rdfxml.uri_to_default_prefixed_tag( uri )
360363
else:
361-
result = rdfxml.uri_to_default_prefixed_tag( uri )
362-
# print( f"3 {uri=} {result=}")
363-
# # this is tentative code to allow another app to resolve the URI
364-
# # the challenge is how to get the config (maybe only do this if GC was specified)
365-
# # and how to get a project-like context to provide headers
366-
# if result is None:
367-
# # try to find another app that might resolve this
368-
# otherapp = self.server.find_app_for_uri( uri )
369-
# if otherapp is not None:
370-
# # check with the other app to get the name
371-
# result = otherapp.app_resolve_uri_to_name( uri )
372-
# print( f"rutn {result=}" )
364+
result = uri
373365
logger.debug( f"rutn {uri=} {result=}" )
374366
return result
375367

elmclient/rdfxml.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,3 +334,12 @@ def remove_tag(s):
334334
s = s[s.find('}') + 1:]
335335
return s
336336

337+
def startswith_known_prefix( uri, default_map=RDF_DEFAULT_PREFIX):
338+
for prefix, prefixurl in default_map.items():
339+
# print( f"{uri=} {prefix=} {prefixurl=}" )
340+
if uri.startswith( prefixurl ):
341+
# print( f"skp {uri=} True" )
342+
return True
343+
# print( f"skp {uri=} False" )
344+
return False
345+

elmclient/tests/results/qm201.html

Lines changed: 84 additions & 84 deletions
Large diffs are not rendered by default.

elmclient/tests/results/rm101b.html

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

elmclient/tests/results/test101.csv

Lines changed: 23 additions & 23 deletions
Large diffs are not rendered by default.

elmclient/tests/results/test115.csv

Lines changed: 27 additions & 27 deletions
Large diffs are not rendered by default.

elmclient/tests/results/test116.csv

Lines changed: 34 additions & 34 deletions
Large diffs are not rendered by default.

elmclient/tests/results/test117.csv

Lines changed: 39 additions & 39 deletions
Large diffs are not rendered by default.

elmclient/tests/results/test124.csv

Lines changed: 11 additions & 11 deletions
Large diffs are not rendered by default.

elmclient/tests/results/test127.csv

Lines changed: 20 additions & 20 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)