-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
If OBA does not find a base ontology, it will load no paths #132
Comments
Thanks @DougalW, |
Thanks @dgarijo - it's a very minimal ontology just for testing purposes so it may well be missing sufficient metadata. |
@DougalW I dug into it, and I think there is something weird with the way you declared the namespace prefixes. I changed the first two lines of your ontology file to:
And obtained the yaml I attach below. Before, these two lines did not have the I add the YAML and the changes in the ontology. In this case, I think OBA should tell you that it wasn't able to load a base ontology. I will rephrase the issue, and I will leave it open. |
Thanks for looking at this. I used your new version of the ontology but it won't generate a server. I ran OBA using the same config file as before, and the new version of the ontology you sent. It completes successfully:
But each class seems to be parsed twice. Did you get this output? It successfully generates a new server config: but then returns an error when running the generate-server.sh script:
|
When I generated the yaml I tested it in the swagger editor and gave me an
error, but was unrelated to the issue so I ignored it. There was a line
which was expecting it to be a url but was a description (maybe there is
something I overlooked in the config).
Have you tried to execute the server with the yaml I sent?
El vie., 9 oct. 2020 12:51 a. m., Dougal Watt <notifications@github.com>
escribió:
… Thanks for looking at this. I used your new version of the ontology but it
won't generate the yaml.
I ran OBA using the same config file as before, and the new version of the
ontology you sent. It completes successfully when generating the server
config:
openapi.yaml.zip
<https://github.com/KnowledgeCaptureAndDiscovery/OBA/files/5353326/openapi.yaml.zip>
but then generates an error when running the generate-server.sh script:
OBA dwatt$ java -jar oba-3.5.0-jar-with-dependencies.jar -c config.yaml
outputs/BusinessOntology/ontology0.owl
[main] WARN org.semanticweb.owlapi.util.SAXParsers - http://www.oracle.com/xml/jaxp/properties/entityExpansionLimit not supported by parser type org.apache.xerces.jaxp.SAXParserImpl, error message: Property 'http://www.oracle.com/xml/jaxp/properties/entityExpansionLimit' is not recognized.
[main] WARN org.semanticweb.owlapi.util.SAXParsers - entityExpansionLimit not supported by parser type org.apache.xerces.jaxp.SAXParserImpl, error message: Property 'entityExpansionLimit' is not recognized.
<https://businessontology.com/ontology/Artifact>
<https://businessontology.com/ontology/Building>
<https://businessontology.com/ontology/Business_User>
<https://businessontology.com/ontology/Customer>
<https://businessontology.com/ontology/Location>
<https://businessontology.com/ontology/Transaction_Document>
[2020-10-09 20:42:46] [INFO ] Analyzing restrictions of Class: <https://businessontology.com/ontology/Building> with axiom: ObjectSomeValuesFrom(<https://businessontology.com/ontology/locatedAt> <https://businessontology.com/ontology/Location>)
[2020-10-09 20:42:46] [INFO ] Analyzing restrictions of Class: <https://businessontology.com/ontology/Building> with axiom: ObjectSomeValuesFrom(<https://businessontology.com/ontology/locatedAt> <https://businessontology.com/ontology/Location>)
[2020-10-09 20:42:46] [INFO ] Parsing class <https://businessontology.com/ontology/Building>
[2020-10-09 20:42:46] [INFO ] Parsing class <https://businessontology.com/ontology/Building>
[2020-10-09 20:42:46] [INFO ] Parsing class <https://businessontology.com/ontology/Business_User>
[2020-10-09 20:42:46] [INFO ] Parsing class <https://businessontology.com/ontology/Business_User>
[2020-10-09 20:42:46] [INFO ] Analyzing restrictions of Class: <https://businessontology.com/ontology/Customer> with axiom: ObjectSomeValuesFrom(<https://businessontology.com/ontology/hasOrder> <https://businessontology.com/ontology/Transaction_Document>)
[2020-10-09 20:42:46] [INFO ] Analyzing restrictions of Class: <https://businessontology.com/ontology/Customer> with axiom: ObjectSomeValuesFrom(<https://businessontology.com/ontology/hasOrder> <https://businessontology.com/ontology/Transaction_Document>)
[2020-10-09 20:42:46] [INFO ] Parsing class <https://businessontology.com/ontology/Customer>
[2020-10-09 20:42:46] [INFO ] Parsing class <https://businessontology.com/ontology/Customer>
[2020-10-09 20:42:46] [INFO ] Parsing class <https://businessontology.com/ontology/Location>
[2020-10-09 20:42:46] [INFO ] Parsing class <https://businessontology.com/ontology/Location>
[2020-10-09 20:42:46] [INFO ] Parsing class <https://businessontology.com/ontology/Transaction_Document>
[2020-10-09 20:42:46] [INFO ] Parsing class <https://businessontology.com/ontology/Transaction_Document>
Each class seems to be parsed twice. Did you get this output?
Next, when I try to generate the server it fails with this warning:
`Dougal-Watts-Retina-MacBook-Pro:python dwatt$ bash generate-server.sh
Docker is installed
Exception in thread "main"
org.openapitools.codegen.SpecValidationException: There were issues with
the specification. The option can be disabled via validateSpec
(Maven/Gradle) or --skip-validate-spec (CLI).
| Error count: 1, Warning count: 0
Errors:
-attribute .servers.url is missing
at org.openapitools.codegen.config.CodegenConfigurator.toContext(CodegenConfigurator.java:424)
at org.openapitools.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:453)
at org.openapitools.codegen.cmd.Generate.run(Generate.java:407)
at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:60)
`
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#132 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AALTIGU63EDHBDZXZ7UR3TLSJ26JLANCNFSM4SITSXCQ>
.
|
I copied the yaml into the python director and ran the generate-server.sh script and it still returns this error:
|
Ok, I have re-checked, and I did not share the right yaml with you.
instead of a URL. This happens because in the config.yaml used as input there is a:
and the |
I removed the description line from the config.yaml file and re-generated it. Everything works fine until I try and start the server when it returns two errors:
|
Hmmm we will have to debug this, I will report here when we have updates,
thx!
El vie., 9 oct. 2020 9:27 p. m., Dougal Watt <notifications@github.com>
escribió:
… I removed the description line from the config.yaml file and re-generated
it. Everything works fine until I try and start the server when it returns
two errors:
Dougal-Watts-Retina-MacBook-Pro:server dwatt$ docker run -p 8080:8080
openapi_server
2020-10-10 04:20:29,473 - root - ERROR -
/usr/src/app/contexts/context_overwrite.json missing
2020-10-10 04:20:29,905 - openapi_server.cached - WARNING - Cache file
does not exist: [Errno 2] No such file or directory:
'/usr/src/app/openapi_server/openapi/openapi.yaml.cache'
2020-10-10 04:20:30,018 - root - ERROR -
/usr/src/app/contexts/context_overwrite.json missing
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/connexion/apis/abstract.py",
line 209, in add_paths
self.add_operation(path, method)
File "/usr/local/lib/python3.8/site-packages/connexion/apis/abstract.py",
line 162, in add_operation
operation = make_operation(
File "/usr/local/lib/python3.8/site-packages/connexion/operations/*init*.py",
line 8, in make_operation
return spec.operation_cls.from_spec(spec, *args, **kwargs)
File
"/usr/local/lib/python3.8/site-packages/connexion/operations/openapi.py",
line 128, in from_spec
return cls(
File
"/usr/local/lib/python3.8/site-packages/connexion/operations/openapi.py",
line 75, in *init*
super(OpenAPIOperation, self).*init*(
File
"/usr/local/lib/python3.8/site-packages/connexion/operations/abstract.py",
line 96, in *init*
self._resolution = resolver.resolve(self)
File "/usr/local/lib/python3.8/site-packages/connexion/resolver.py", line
40, in resolve
return Resolution(self.resolve_function_from_operation_id(operation_id),
operation_id)
File "/usr/local/lib/python3.8/site-packages/connexion/resolver.py", line
64, in resolve_function_from_operation_id
raise ResolverError(msg, sys.exc_info())
connexion.exceptions.ResolverError: <ResolverError: Cannot resolve
operationId
"openapi_server.controllers.business_user_controller.business_users_get"!
Import error was "cannot import name 'BUSINESSUSER_TYPE_NAME' from
'openapi_server.utils.vars' (/usr/src/app/openapi_server/utils/vars.py)">
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/local/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/usr/src/app/openapi_server/__main__.py", line 20, in <module>
main()
File "/usr/src/app/openapi_server/__main__.py", line 13, in main
app.add_api('openapi.yaml',
File "/usr/local/lib/python3.8/site-packages/connexion/apps/flask_app.py", line 57, in add_api
api = super(FlaskApp, self).add_api(specification, **kwargs)
File "/usr/local/lib/python3.8/site-packages/connexion/apps/abstract.py", line 144, in add_api
api = self.api_cls(specification,
File "/usr/local/lib/python3.8/site-packages/connexion/apis/abstract.py", line 111, in __init__
self.add_paths()
File "/usr/local/lib/python3.8/site-packages/connexion/apis/abstract.py", line 216, in add_paths
self._handle_add_operation_error(path, method, err.exc_info)
File "/usr/local/lib/python3.8/site-packages/connexion/apis/abstract.py", line 231, in _handle_add_operation_error
raise value.with_traceback(traceback)
File "/usr/local/lib/python3.8/site-packages/connexion/resolver.py", line 61, in resolve_function_from_operation_id
return self.function_resolver(operation_id)
File "/usr/local/lib/python3.8/site-packages/connexion/utils.py", line 123, in get_function_from_name
raise last_import_error
File "/usr/local/lib/python3.8/site-packages/connexion/utils.py", line 111, in get_function_from_name
module = importlib.import_module(module_name)
File "/usr/local/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/usr/src/app/openapi_server/controllers/business_user_controller.py", line 4, in <module>
from openapi_server.utils.vars import BUSINESSUSER_TYPE_NAME, BUSINESSUSER_TYPE_URI
ImportError: cannot import name 'BUSINESSUSER_TYPE_NAME' from 'openapi_server.utils.vars' (/usr/src/app/openapi_server/utils/vars.py)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#132 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AALTIGWP74LOA42Q6F5TH5DSJ7PDPANCNFSM4SITSXCQ>
.
|
* fix: wrong opeanpi spec fix: #132 * fix: remove '_' from the class_name mustache (the template manager used by the openapi generator) is removing the underscore symbol from the class name The serializer python creates a variable file with the URI and name of the class. However, it wasn't removing the symbol. The commit fixes #134
@DougalW the issue seems to have been fixed. Can you please give it another try? |
Just re-ran it and it runs just fine. Thanks! |
Hi, I created a simple ontology and ran OBA to create a server. It completes successfully but then returns "No operations defined in spec!" when I access the swagger spec through the UI as shown here:
I have attached my config.yaml and ontology.xml files. The ontology is very simple, and was created using Protege v5.5.
Archive.zip
When I run these through OBA as per the instructions, each step completes successfully, but when I checked through the config files in the servers directory I noticed a few odd things:
servers_files.zip
I am also running a local copy of GraphDB as a sparql endpoint.
Please let me know what's missing or incorrect here.
Regards
Dougal
The text was updated successfully, but these errors were encountered: