diff --git a/tenet/febTransduction/uriref_computer.py b/tenet/febTransduction/uriref_computer.py index 7bf24cc652e8a10e8ae09e717af35a74360c60a1..f508fd3eec689e73a9985ef108ebc5e0d2055ee5 100644 --- a/tenet/febTransduction/uriref_computer.py +++ b/tenet/febTransduction/uriref_computer.py @@ -14,11 +14,20 @@ from rdflib import URIRef, Graph, RDF, SDO from rdflib.term import _is_valid_uri + +#============================================================================== +# Checking Method(s) +#============================================================================== + class InvalidURIRef(Exception): """Raise when URIs are invalid.""" pass +#============================================================================== +# Main Method(s) +#============================================================================== + def create_uriref(uri): """Create a URIRef with the same validation func used by URIRef diff --git a/tests/test_transduction_prefix_handle.py b/tests/test_transduction_prefix_handle.py index 545ca2f63084888185a408d25efc83fca1035f1b..5af17c53e963031e29fe8374547fca06ef767485 100644 --- a/tests/test_transduction_prefix_handle.py +++ b/tests/test_transduction_prefix_handle.py @@ -8,8 +8,7 @@ #============================================================================== import subprocess, os -from rdflib import Graph -from rdflib import Namespace +from rdflib import Graph, Namespace from rdflib.namespace import NamespaceManager FILE_PATH = f'{os.path.dirname(os.path.abspath(__file__))}' @@ -18,11 +17,8 @@ OUTPUT_DIR_PATH = f'{FILE_PATH}/output/' TEST_GRAPH = f'{INPUT_DIR_PATH}testGraph1.ttl' from context import tenet -from tenet.febTransduction import phenomena_application_or as test_rule from tenet.febTransduction import prefix_handle -INDENT_STR = ' ' - #============================================================================== diff --git a/tests/test_transduction_uriref_computer.py b/tests/test_transduction_uriref_computer.py new file mode 100644 index 0000000000000000000000000000000000000000..fea2b124570822b183ae0fe11dc4d8892e02e636 --- /dev/null +++ b/tests/test_transduction_uriref_computer.py @@ -0,0 +1,70 @@ +#!/usr/bin/python3.10 +# -*-coding:Utf-8 -* + +#============================================================================== +# TENET: Extraction Rule Test +#------------------------------------------------------------------------------ +# Script to test rules under development +#============================================================================== + +import subprocess, os +from rdflib import Graph, Namespace +from rdflib.namespace import NamespaceManager +from rdflib.term import _is_valid_uri + +FILE_PATH = f'{os.path.dirname(os.path.abspath(__file__))}' +INPUT_DIR_PATH = f'{FILE_PATH}/input/' +OUTPUT_DIR_PATH = f'{FILE_PATH}/output/' +TEST_GRAPH = f'{INPUT_DIR_PATH}testGraph1.ttl' + +from context import tenet +from tenet.febTransduction import uriref_computer + + + +#============================================================================== +# Useful Methods +#============================================================================== + +# None + + +#============================================================================== +# Development Test +#============================================================================== + +def devtest_check_uri(uri): + print(f'\n -- Test URI checking') + print(f' ----- uri: {uri}') + print(f' ----- check 1: {_is_valid_uri(uri)}') + + +#============================================================================== +# Unit Test +#============================================================================== + +# TODO + + + + +#============================================================================== +# Test Script +#============================================================================== + +if __name__ == '__main__': + + print('\n *** Test Preparation ***') + pass + print('\n \n') + + print('\n *** Development Test ***') + devtest_check_uri('<net:compositeClass_orbit_hasManner_conjunction-OR>') + devtest_check_uri('net:compositeClass_orbit_hasManner_conjunction-OR') + print('\n \n') + + print('\n *** Unit Test ***') + pass + print('\n \n') + + print('\n *** - ***') \ No newline at end of file