class ModelCatalog(): @staticmethod def generate_graph(username): return "{}{}".format(GRAPH_BASE, username) def setUp(self): self.query_manager = QueryManager(queries_dir=QUERY_DIRECTORY, context_dir=CONTEXT_DIRECTORY, queries_types=QUERIES_TYPES) username = "******" self.username = self.generate_graph(username) def test_get_one_setup_custom(self, _id): """ Test to obtain one resource by the uri and a custon query """ owl_class_name = "custom" resource_uri = "https://w3id.org/okn/i/mint/{}".format(_id) resource_type_uri = "https://w3id.org/okn/o/sdm#ModelConfigurationSetup" query_type = "get_setup" #grlc args request_args: Dict[str, str] = { "resource": resource_uri, "g": self.username } resource = self.query_manager.obtain_query( query_directory=owl_class_name, owl_class_uri=resource_type_uri, query_type=query_type, endpoint=ENDPOINT, request_args=request_args) return resource
from obasparql import QueryManager from openapi_server.settings import * import logging try: logging.config.fileConfig(logging_file) except: logging.error("Logging config file does not exist {}".format(logging_file)) exit(0) logger = logging.getLogger(__name__) query_manager = QueryManager(queries_dir=QUERY_DIRECTORY, context_dir=CONTEXT_DIRECTORY, queries_types=QUERIES_TYPES, endpoint=ENDPOINT, endpoint_username=ENDPOINT_USERNAME, endpoint_password=ENDPOINT_PASSWORD, graph_base=ENDPOINT_GRAPH_BASE, prefix=ENDPOINT_RESOURCE_PREFIX)
def setUp(self): self.query_manager = QueryManager(queries_dir=QUERY_DIRECTORY, context_dir=CONTEXT_DIRECTORY, queries_types=QUERIES_TYPES) username = "******" self.username = self.generate_graph(username)
from obasparql import QueryManager from openapi_server.settings import CONTEXT_DIRECTORY, QUERY_DIRECTORY, QUERIES_TYPES query_manager = QueryManager(queries_dir=QUERY_DIRECTORY, context_dir=CONTEXT_DIRECTORY, queries_types=QUERIES_TYPES) import logging.config import os # Disable Django's logging setup LOGGING_CONFIG = None LOGLEVEL = os.environ.get('LOGLEVEL', 'info').upper() logging.config.dictConfig({ 'version': 1, 'disable_existing_loggers': False, 'formatters': { 'default': { # exact format is not important, this is the minimum information 'format': '%(asctime)s %(name)-12s %(levelname)-8s %(message)s', }, }, 'handlers': { # console logs to stderr 'console': { 'class': 'logging.StreamHandler', 'formatter': 'default', }, },