SynBioDex / libSBOLj

Java Library for Synthetic Biology Open Language (SBOL)
Apache License 2.0
38 stars 24 forks source link

SBOLDocument. addNamespaceBinding(NamespaceBinding) #487

Closed eoberortner closed 7 years ago

eoberortner commented 7 years ago

I'm always running into the exception: sbol-10105: An SBOL document MUST be serialized as a well-formed RDF/XML file that adheres to the grammar defined by: “https://www.w3.org/TR/rdf-syntax-grammar/

Please, could anybody let me know how to set the namespace properly? Currently, I'm just using the default namespace

cjmyers commented 7 years ago

You should never call addNamespaceBinding. This is a package private method. You should be using addNamespace.

The && is correct. Namely, a namespace is required to end in a delimiter (#, :, or /).

On Aug 28, 2017, at 2:22 PM, eoberortner notifications@github.com wrote:

It appears that the conditions in the if statement should be connected using a logical OR ('||')

I'm always running into the exception: sbol-10105: An SBOL document MUST be serialized as a well-formed RDF/XML file that adheres to the grammar defined by: “https://www.w3.org/TR/rdf-syntax-grammar/https://www.w3.org/TR/rdf-syntax-grammar/%E2%80%9D — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/SynBioDex/libSBOLj/issues/487, or mute the thread https://github.com/notifications/unsubscribe-auth/ADWD94Ie8TT83mW81V3JDtCHkbK1tKTpks5scyGYgaJpZM4PFBFc.

eoberortner commented 7 years ago

I do not call the addNamespaceBinding method. I was wrong with the logical OR. it should be logical AND as it is. However, I'm still running into the exception: sbol-10105: An SBOL document MUST be serialized as a well-formed RDF/XML file that adheres to the grammar defined by: “https://www.w3.org/TR/rdf-syntax-grammar/” Reference: SBOL Version 2.1.0 Section 10 on page 58

cjmyers commented 7 years ago

Can you give me the sample code where you call addNamespace?

On Aug 28, 2017, at 2:28 PM, eoberortner notifications@github.com wrote:

I do not call the addNamespaceBinding method. I was wrong with the logical OR. it should be logical AND as it is. However, I'm still running into the exception: sbol-10105: An SBOL document MUST be serialized as a well-formed RDF/XML file that adheres to the grammar defined by: “https://www.w3.org/TR/rdf-syntax-grammar/https://www.w3.org/TR/rdf-syntax-grammar/%E2%80%9D Reference: SBOL Version 2.1.0 Section 10 on page 58

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/SynBioDex/libSBOLj/issues/487#issuecomment-325471490, or mute the thread https://github.com/notifications/unsubscribe-auth/ADWD91K4FMQVZ6MIWj4IZUOXDJ3rKNMnks5scyMAgaJpZM4PFBFc.

eoberortner commented 7 years ago

Attached the code. it's caused when calling the createAnnotation method (line 60)

sbol-issue.txt

eoberortner commented 7 years ago

also, here is my stacktrace: Exception in thread "main" org.sbolstandard.core2.SBOLValidationException: sbol-10105: An SBOL document MUST be serialized as a well-formed RDF/XML file that adheres to the grammar defined by: “https://www.w3.org/TR/rdf-syntax-grammar/” Reference: SBOL Version 2.1.0 Section 10 on page 58 at org.sbolstandard.core2.SBOLDocument.addNamespaceBinding(SBOLDocument.java:2170) at org.sbolstandard.core2.SBOLDocument.addNamespace(SBOLDocument.java:2151) at org.sbolstandard.core2.Identified.addNamespace(Identified.java:463) at org.sbolstandard.core2.Identified.addAnnotation(Identified.java:530) at org.sbolstandard.core2.Identified.createAnnotation(Identified.java:366) at org.sbolstandard.assembly.demo.SBOLTest.main(SBOLTest.java:60)

cjmyers commented 7 years ago

Try adding a delimiter (/, #, : ) at the end of string in URI_PREFIX

On Aug 28, 2017, at 2:33 PM, eoberortner notifications@github.com wrote:

Attached the code. it's caused when calling the createAnnotation method (line 60)

sbol-issue.txt https://github.com/SynBioDex/libSBOLj/files/1258291/sbol-issue.txt — You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/SynBioDex/libSBOLj/issues/487#issuecomment-325472988, or mute the thread https://github.com/notifications/unsubscribe-auth/ADWD9_nIGJIJHn6kF7gwixNWYz78gUxgks5scyQagaJpZM4PFBFc.

eoberortner commented 7 years ago

OK, the following command works: cd.createAnnotation(new QName(URI_PREFIX + "#", "derivation", "derivation"), "purchase");

thanks for your help! interesting behavior though.

eoberortner commented 7 years ago

I'll just add the '#' sign to the URI_PREFIX constants. that should solve the issue.

thanks again!

cjmyers commented 7 years ago

The reason we need to have the delimiter is namespaces without them cause all kinds of problems especially when serialized as anything other than XML.

On Aug 28, 2017, at 2:48 PM, eoberortner notifications@github.com wrote:

OK, the following command works: cd.createAnnotation(new QName(URI_PREFIX + "#", "derivation", "derivation"), "purchase");

thanks for your help! interesting behavior though.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/SynBioDex/libSBOLj/issues/487#issuecomment-325476985, or mute the thread https://github.com/notifications/unsubscribe-auth/ADWD93CJbRdbOB0XhEhvZ8-ph92tlFq2ks5scyetgaJpZM4PFBFc.

eoberortner commented 7 years ago

just out of curiosity, could the library add a delimiter if non is provided?

cjmyers commented 7 years ago

Perhaps, but it would not know the correct one. It is often #, but sometimes /.

On Aug 28, 2017, at 2:56 PM, eoberortner notifications@github.com wrote:

just out of curiosity, could the library add a delimiter if non is provided?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/SynBioDex/libSBOLj/issues/487#issuecomment-325478836, or mute the thread https://github.com/notifications/unsubscribe-auth/ADWD96eWqOCHyApZoL3rW3IO1lwDOn9dks5scylrgaJpZM4PFBFc.