-
Notifications
You must be signed in to change notification settings - Fork 26
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
Prolog initialisation failed #54
Comments
Could you please link to the used |
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:annotation>
<xsd:documentation xml:lang="en">
Purchase order schema for Example.com.
Copyright 2000 Example.com. All rights reserved.
</xsd:documentation>
</xsd:annotation>
<xsd:element name="purchaseOrder" type="PurchaseOrderType"/>
<xsd:element name="comment" type="xsd:string"/>
<xsd:complexType name="PurchaseOrderType">
<xsd:sequence>
<xsd:element name="shipTo" type="USAddress"/>
<xsd:element name="billTo" type="USAddress"/>
<xsd:element ref="comment" minOccurs="0"/>
<xsd:element name="items" type="Items"/>
</xsd:sequence>
<xsd:attribute name="orderDate" type="xsd:date"/>
</xsd:complexType>
<xsd:complexType name="USAddress">
<xsd:sequence>
<xsd:element name="name" type="xsd:string"/>
<xsd:element name="street" type="xsd:string"/>
<xsd:element name="city" type="xsd:string"/>
<xsd:element name="state" type="xsd:string"/>
<xsd:element name="zip" type="xsd:decimal"/>
</xsd:sequence>
<xsd:attribute name="country" type="xsd:NMTOKEN"
fixed="US"/>
</xsd:complexType>
<xsd:complexType name="Items">
<xsd:sequence>
<xsd:element name="item" minOccurs="0" maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="productName" type="xsd:string"/>
<xsd:element name="quantity">
<xsd:simpleType>
<xsd:restriction base="xsd:positiveInteger">
<xsd:maxExclusive value="100"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="USPrice" type="xsd:decimal"/>
<xsd:element ref="comment" minOccurs="0"/>
<xsd:element name="shipDate" type="xsd:date" minOccurs="0"/>
</xsd:sequence>
<xsd:attribute name="partNum" type="SKU" use="required"/>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<!-- Stock Keeping Unit, a code for identifying products -->
<xsd:simpleType name="SKU">
<xsd:restriction base="xsd:string">
<xsd:pattern value="\d{3}-[A-Z]{2}"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:schema> |
The bug happened because of types starting with capital letters, in this case XSD's built-in |
This is... strange. Unfortunately SWI-Prolog is not good at versioning (semver would be too easy, right?), but according to my information
Does this work? What's the output? edit: Replaced |
Sorry, I ran a wrong swipl version (6.xx). The problem is that the installed xsd2json does not take into account the swivm predicat (use 7.2). That seems to work from the git clone: michel@obs-he-lm:~/gitRepositories/xsd2json$ which swipl
/home/michel/.swivm/versions/7.2.3/bin/swipl But that fails from the CLI. michel@obs-he-lm:~/gitRepositories/xsd2json$ which swipl
/home/michel/.swivm/versions/7.2.3/bin/swipl
michel@obs-he-lm:~/gitRepositories/xsd2json$ strace -f xsd2json -t purchaseorder.xsd 2>&1 | grep swipl
execve("/usr/lib/swi-prolog/bin/amd64/swipl", ["/usr/lib/swi-prolog/bin/amd64/sw"..., "-x", "/usr/bin/xsd2json", "--", "-t", "purch
aseorder.xsd"], [/* 70 vars */]) = 0
.... This is a shell issue. |
Nice catch! I am not sure why the wrong swipl executable is used. Nevertheless I checked the Prolog predicates specific for SWI-Prolog 7 and replaced them by predicates which work in both versions. So xsd2json is compatible to SWI-Prolog 6 again (v1.7.14@npm). |
Falco,
I confirm :
1) v1.7.14@npm works with swipl 6.xx.
2) Purchaseorder.xsd passes
3) VOTable.xsd fails on
ERROR: Prolog initialisation failed:
ERROR: Domain error: `chr_port' expected, found `none'
LM
Le 03/01/2017 à 17:21, Falco Nogatz a écrit :
… Nice catch! I am not sure why the wrong swipl executable is used. Nevertheless I checked the Prolog predicates specific for
SWI-Prolog 7 and replaced them by predicates which work in both versions. So xsd2json is compatible to SWI-Prolog 6 again
***@***.***).
But this does yet not solve the problem for your second test file :)
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <#54 (comment)>, or mute
the thread <https://github.com/notifications/unsubscribe-auth/AK7n-NuQ8yi1KygA8FKMkemlz1u_hAW4ks5rOnWKgaJpZM4LZf_U>.
--
jesuischarlie/Tunis/Paris/Bruxelles/Berlin
Laurent Michel
SSC XMM-Newton
Tél : +33 (0)3 68 85 24 37
Fax : +33 (0)3 )3 68 85 24 32
Université de Strasbourg <http://www.unistra.fr>
Observatoire Astronomique
11 Rue de l'Université
F - 67200 Strasbourg
|
Okay, had to rewrite quite some code but it is working now, even for your
I'm not sure this is the best way to specify an element that contains HTML in XML Schema. What would you expect to be a valid JSON Schema translation? |
The updated version is available as 1.8.0 on npm. |
Thanks,
Le 03/01/2017 à 21:58, Falco Nogatz a écrit :
Okay, had to rewrite quite some code but it is working now, even for your |VOTable.xsd| test file (just be patient - the
translation takes about 12 seconds on my machine).
Never mind, It could take hours since this operation is meant to be rarely operated.
The only thing that's missing is the conversion of the following type:
|<xs:complexType name="anyTEXT" mixed="true"> <xs:sequence> <xs:any minOccurs="0" maxOccurs="unbounded" processContents="skip"/>
</xs:sequence> </xs:complexType> |
I'm not sure this is the best way to specify an element that contains HTML in XML Schema. What would you expect to be a valid
JSON Schema translation?
This schema results from very long discussions to support an incredible number of use cases. So I couldn't say why this
statement is here, but it cannot be changed for sure. AS far I understand, the problem comes from sequence of <xs:any>. This
element is supposed to contain some elements from another schema e.g. or an anything else. In our case this fragment is not
processed. It must therefore be considered as a string.
In term of JSON, that would mean that the element can contain a JSON string which must not be interpreted as an structured type.
Something like:
{"element" : "{key:value, key: value.....}"}
Considering this, I would say that using a JSON String for the xs:any should work, at least for our use case.
The real test to me is now to check the schema against data files ... in progress
To do this, I'm using http://www.jsonschemavalidator.net/ (standalone version not free)
LM
…
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <#54 (comment)>, or mute
the thread <https://github.com/notifications/unsubscribe-auth/AK7n-J02dzIoFytL-xQNXTt5iITiDKkQks5rOrZtgaJpZM4LZf_U>.
--
jesuischarlie/Tunis/Paris/Bruxelles/Berlin
Laurent Michel
SSC XMM-Newton
Tél : +33 (0)3 68 85 24 37
Fax : +33 (0)3 )3 68 85 24 32
Université de Strasbourg <http://www.unistra.fr>
Observatoire Astronomique
11 Rue de l'Université
F - 67200 Strasbourg
|
In the generated JSON schema 2 complexTypes are actually missing:
1) #/definitions/anyTEXT as you said
2) #/definitions/Info : This definition is used within another definition (Data): might this cause trouble?
I replaces those types with Strings and started to create a basic and compliant data file: works fine right now.
LM
Le 03/01/2017 à 21:58, Falco Nogatz a écrit :
… Okay, had to rewrite quite some code but it is working now, even for your |VOTable.xsd| test file (just be patient - the
translation takes about 12 seconds on my machine). The only thing that's missing is the conversion of the following type:
|<xs:complexType name="anyTEXT" mixed="true"> <xs:sequence> <xs:any minOccurs="0" maxOccurs="unbounded" processContents="skip"/>
</xs:sequence> </xs:complexType> |
I'm not sure this is the best way to specify an element that contains HTML in XML Schema. What would you expect to be a valid
JSON Schema translation?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <#54 (comment)>, or mute
the thread <https://github.com/notifications/unsubscribe-auth/AK7n-J02dzIoFytL-xQNXTt5iITiDKkQks5rOrZtgaJpZM4LZf_U>.
--
jesuischarlie/Tunis/Paris/Bruxelles/Berlin
Laurent Michel
SSC XMM-Newton
Tél : +33 (0)3 68 85 24 37
Fax : +33 (0)3 )3 68 85 24 32
Université de Strasbourg <http://www.unistra.fr>
Observatoire Astronomique
11 Rue de l'Université
F - 67200 Strasbourg
|
I'm sorry to reopen an issue which is rather likely a user support request (I'm an absolute beginner with Prolog). I guess that some other users can have to face the same problem.
I properly setup my swipl with Aptitude and swivm as suggested in thread #53
When I try to process a schema, I get nothing on stdout; then I switch to the trace mode and I get the following output (truncated).
I've no idea at all (and Google either) about that chr_port.
Is there some missing parameter or resource?
LM
The text was updated successfully, but these errors were encountered: