Bioprotocols / labop-specification

Specification for the Laboratory Open Protocol Language (LabOP)
12 stars 3 forks source link

SBOLFactory bug in regenerating standard #14

Closed danbryce closed 1 year ago

danbryce commented 1 year ago

Running the doc/generate_specification_content.py script in the labop repo results in a problem with malformed URIs. There are several classes that have URIs of the form Nad89d29866a44d88bd2222f91669e8ec that cause the conversion to fail. I suspect these URIs are not being generated correctly (by rdflib? or sbol3?), rather than SBOLFactory interpreting them correctly.

(.venv) Daniels-MBP-13:labop danbryce$ python --version
Python 3.10.6

(.venv) Daniels-MBP-13:labop danbryce$ pip show sbol-factory
Name: sbol-factory
Version: 1.0
Summary: Ontology-driven data modeling
Home-page: UNKNOWN
Author: 
Author-email: 
License: UNKNOWN
Location: /opt/homebrew/Caskroom/miniforge/base/lib/python3.10/site-packages
Requires: graphviz, pylatex, PyPDF2, pyshacl, python-dateutil, requests, sbol3, sparqlwrapper
Required-by: labop
Name: sbol3
Version: 1.0.1
Summary: Python implementation of SBOL 3 standard
Home-page: https://github.com/SynBioDex/pySBOL3
Author: Tom Mitchell
Author-email: tcmitchell@users.noreply.github.com
License: MIT License
Location: /opt/homebrew/Caskroom/miniforge/base/lib/python3.10/site-packages
Requires: pyshacl, python-dateutil, rdflib
Required-by: labop, sbol-factory

(.venv) Daniels-MBP-13:labop danbryce$ pip show rdflib
Name: rdflib
Version: 6.2.0
Summary: RDFLib is a Python library for working with RDF, a simple yet powerful language for representing information.
Home-page: https://github.com/RDFLib/rdflib
Author: Daniel 'eikeon' Krech
Author-email: eikeon@eikeon.com
License: bsd-3-clause
Location: /opt/homebrew/Caskroom/miniforge/base/lib/python3.10/site-packages
Requires: isodate, pyparsing, setuptools
Required-by: container-ontology, owlrl, pyshacl, sbol3, SPARQLWrapper, tyto

(.venv) Daniels-MBP-13:labop danbryce$ python doc/generate_specification_content.py 
Warning: this script is fragile and assumes that LabOP and LabOP-specification are sibling directories on Mac or Unix.
Loading uml
Generating uml specification materials
Skipping Nad89d29866a44d88bd2222f91669e8ec
Skipping Nef8dc656bafc4dbfaa312a048817eb6b
Skipping N81c3c841c9eb4d95a93be3ac73436b45
Skipping N116b4414e912487f8b128b9f2ccdd293
Skipping N76bb70c4ba0840a999803c8f16a5c632
Skipping N252a60fddfee47f68ab53c48e36df6b2
Skipping N09cd4be850ad47b89cf1e705fe839343
Skipping N74b9b9fcb1ea4314b91648fd366d237c
Skipping Ne50675a598734aaeb91106f346ed9630
Skipping http://sbols.org/v3#Identified
Skipping http://sbols.org/v3#TopLevel
Skipping http://sbols.org/v3#Sequence
Skipping http://sbols.org/v3#Component
Skipping http://sbols.org/v3#Model
Skipping http://sbols.org/v3#Implementation
Skipping http://sbols.org/v3#Attachment
Skipping http://sbols.org/v3#Collection
Skipping http://sbols.org/v3#Experiment
Skipping http://sbols.org/v3#ExperimentalData
Skipping http://sbols.org/v3#CombinatorialDerivation
Skipping http://sbols.org/v3#Interaction
Skipping http://sbols.org/v3#Constraint
Skipping http://sbols.org/v3#Interface
Skipping http://sbols.org/v3#Feature
Skipping http://sbols.org/v3#SubComponent
Skipping http://sbols.org/v3#ComponentReference
Skipping http://sbols.org/v3#ExternallyDefined
Skipping http://sbols.org/v3#LocalSubComponent
Skipping http://sbols.org/v3#SequenceFeature
Skipping http://sbols.org/v3#Location
Skipping http://sbols.org/v3#Range
Skipping http://sbols.org/v3#Cut
Skipping http://sbols.org/v3#EntireSequence
Skipping http://sbols.org/v3#Participation
Skipping http://sbols.org/v3#VariableFeature
Skipping http://sbols.org/v3#SBOLTerm
Skipping http://sbols.org/v3#Orientation
Skipping N48cd7f92f5044462a57eb2176e57581d
Skipping http://sbols.org/v3#inline
Skipping http://sbols.org/v3#reverseComplement
Skipping http://sbols.org/v3#CombinatorialDerivationStrategy
Skipping N3f44cc7062fe45dd8caeb279695d2ec9
Skipping http://sbols.org/v3#enumerate
Skipping http://sbols.org/v3#sample
Skipping http://sbols.org/v3#Cardinality
Skipping Na2de11bf9c24470494416e183382ca2b
Skipping http://sbols.org/v3#zeroOrOne
Skipping http://sbols.org/v3#one
Skipping http://sbols.org/v3#zeroOrMore
Skipping http://sbols.org/v3#oneOrMore
Skipping Na0eaaa86ea1f42fc9ee7df0d98a4d099
Skipping Ncf31827be46c4dd895e7b4a1c2038155
Skipping N607070e246fb40da929f35c3b6089745
Skipping N5231f2414fad4bc199a84fac8a505a27
Skipping Nda14ee8e1d2c44918740a2daf3980d5a
Skipping N5e9ae8630f7f427b8ce6b5e37c57b350
Skipping Nf57712d29c884933a79a7aaa02d88b46
Skipping N3635b087d2ad482eb55a5d3b0a9bc500
Skipping http://www.w3.org/2002/07/owl#Thing
Skipping http://www.w3.org/ns/prov#Activity
Skipping http://www.w3.org/ns/prov#ActivityInfluence
Skipping http://www.w3.org/ns/prov#Agent
Skipping http://www.w3.org/ns/prov#AgentInfluence
Skipping http://www.w3.org/ns/prov#Association
Skipping http://www.w3.org/ns/prov#Attribution
Skipping http://www.w3.org/ns/prov#Bundle
Skipping http://www.w3.org/ns/prov#Collection
Skipping http://www.w3.org/ns/prov#Communication
Skipping http://www.w3.org/ns/prov#Delegation
Skipping http://www.w3.org/ns/prov#Derivation
Skipping http://www.w3.org/ns/prov#EmptyCollection
Skipping http://www.w3.org/ns/prov#End
Skipping http://www.w3.org/ns/prov#Entity
Skipping http://www.w3.org/ns/prov#EntityInfluence
Skipping http://www.w3.org/ns/prov#Generation
Skipping http://www.w3.org/ns/prov#Influence
Skipping http://www.w3.org/ns/prov#InstantaneousEvent
Skipping http://www.w3.org/ns/prov#Invalidation
Skipping http://www.w3.org/ns/prov#Location
Skipping http://www.w3.org/ns/prov#Organization
Skipping http://www.w3.org/ns/prov#Person
Skipping http://www.w3.org/ns/prov#Plan
Skipping http://www.w3.org/ns/prov#PrimarySource
Skipping http://www.w3.org/ns/prov#Quotation
Skipping http://www.w3.org/ns/prov#Revision
Skipping http://www.w3.org/ns/prov#Role
Skipping http://www.w3.org/ns/prov#SoftwareAgent
Skipping http://www.w3.org/ns/prov#Start
Skipping http://www.w3.org/ns/prov#Usage
Generating http://bioprotocols.org/uml#ControlFlow
Generating http://bioprotocols.org/uml#FlowFinalNode
Generating http://bioprotocols.org/uml#ForkNode
Generating http://bioprotocols.org/uml#InitialNode
Generating http://bioprotocols.org/uml#JoinNode
Generating http://bioprotocols.org/uml#LiteralNull
Generating http://bioprotocols.org/uml#MergeNode
Generating http://bioprotocols.org/uml#ActivityParameterNode
Generating http://bioprotocols.org/uml#CallAction
Generating http://bioprotocols.org/uml#CallBehaviorAction
Generating http://bioprotocols.org/uml#ExecutableNode
Generating http://bioprotocols.org/uml#FinalNode
Generating http://bioprotocols.org/uml#InvocationAction
Generating http://bioprotocols.org/uml#LiteralBoolean
Generating http://bioprotocols.org/uml#LiteralIdentified
Generating http://bioprotocols.org/uml#LiteralInteger
Generating http://bioprotocols.org/uml#LiteralReal
Generating http://bioprotocols.org/uml#LiteralReference
Generating http://bioprotocols.org/uml#LiteralString
Generating http://bioprotocols.org/uml#ValuePin
Generating http://bioprotocols.org/uml#Activity
Generating http://bioprotocols.org/uml#DecisionNode
Generating http://bioprotocols.org/uml#DurationConstraint
Generating http://bioprotocols.org/uml#DurationObservation
Generating http://bioprotocols.org/uml#Expression
Generating http://bioprotocols.org/uml#Interval
Generating http://bioprotocols.org/uml#IntervalConstraint
Generating http://bioprotocols.org/uml#ObjectFlow
Generating http://bioprotocols.org/uml#ObjectNode
Generating http://bioprotocols.org/uml#OutputPin
Generating http://bioprotocols.org/uml#Parameter
  Generating http://bioprotocols.org/uml#Parameter
Descending into http://bioprotocols.org/uml#Parameter
  Generating http://bioprotocols.org/uml#ValueSpecification
Descending into http://bioprotocols.org/uml#ValueSpecification
WARNING:rdflib.term:  Generating http://bioprotocols.org/uml#Expression does not look like a valid URI, trying to serialize this will break.
  Generating http://bioprotocols.org/uml#Expression
WARNING:rdflib.term:Descending into http://bioprotocols.org/uml#Expression does not look like a valid URI, trying to serialize this will break.
Descending into http://bioprotocols.org/uml#Expression
  Generating http://bioprotocols.org/uml#OrderedPropertyValue
Descending into http://bioprotocols.org/uml#OrderedPropertyValue
  Generating http://sbols.org/v3#Identified
list index out of range http://sbols.org/v3#TopLevel http://sbols.org/v3#hasNamespace
list index out of range http://sbols.org/v3#Interaction http://sbols.org/v3#type
list index out of range http://sbols.org/v3#Constraint http://sbols.org/v3#restriction
Traceback (most recent call last):
  File "/Users/danbryce/Documents/sift/xplan/external/labop/doc/generate_specification_content.py", line 51, in <module>
    generate_specs()
  File "/Users/danbryce/Documents/sift/xplan/external/labop/doc/generate_specification_content.py", line 46, in generate_specs
    generate_spec(UML_TTL, "uml", UML_NAMESPACE)
  File "/Users/danbryce/Documents/sift/xplan/external/labop/doc/generate_specification_content.py", line 32, in generate_spec
    module.generate(f'{spec_name}_classes')
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.10/site-packages/sbol_factory/uml_factory.py", line 50, in generate
    self._generate(class_uri, self.draw_abstraction_hierarchy, dot)
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.10/site-packages/sbol_factory/uml_factory.py", line 88, in _generate
    self._generate(uri, drawing_method_callback, *args)
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.10/site-packages/sbol_factory/uml_factory.py", line 88, in _generate
    self._generate(uri, drawing_method_callback, *args)
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.10/site-packages/sbol_factory/uml_factory.py", line 88, in _generate
    self._generate(uri, drawing_method_callback, *args)
  [Previous line repeated 1 more time]
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.10/site-packages/sbol_factory/uml_factory.py", line 83, in _generate
    args = drawing_method_callback(class_uri, superclass_uri, *args)
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.10/site-packages/sbol_factory/uml_factory.py", line 214, in draw_abstraction_hierarchy
    self.draw_class_definition(uri, class_uri, dot)
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.10/site-packages/sbol_factory/uml_factory.py", line 315, in draw_class_definition
    create_association(dot, class_uri, object_class_uri, arrow_label)
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.10/site-packages/sbol_factory/uml_factory.py", line 410, in create_association
    object_node = format_qname(object_uri).replace(':', '_')
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.10/site-packages/sbol_factory/uml_factory.py", line 380, in format_qname
    class_name = sbol.utils.parse_class_name(class_uri)
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.10/site-packages/sbol3/utils.py", line 14, in parse_class_name
    raise ValueError(f'Cannot parse class name from {uri}. URI must use either / '
ValueError: Cannot parse class name from N76bb70c4ba0840a999803c8f16a5c632. URI must use either / or # as a delimiter.
(.venv) Daniels-MBP-13:labop danbryce$ 
bbartley commented 1 year ago

Fixed by https://github.com/SynBioDex/sbol_factory/releases/tag/v1.1