enthusiastic2learn / onotoa

Automatically exported from code.google.com/p/onotoa
0 stars 0 forks source link

Import prefixes from CTM #197

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
When importing a TMCL file from CTM, the prefixes are not available in the 
resulting .ono file.

E.g. when importing http://isotopicmaps.org/tmcl/schema.ctm and creating a 
diagram, I expect these prefixes to be defined:
%prefix tmcl http://psi.topicmaps.org/tmcl/
%prefix tmdm http://psi.topicmaps.org/iso13250/model/
%prefix xsd http://www.w3.org/2001/XMLSchema#
%prefix iso http://psi.topicmaps.org/iso13250/

As the CTM importer does not preserve prefixes, these could be loaded from the 
CTM by just opening the file stream and applying some regular expressions.

Original issue reported on code.google.com by bnjmn...@gmail.com on 15 Nov 2010 at 12:16

GoogleCodeExporter commented 8 years ago
It would be nice if you add the regExp ;)

BTW A better solution would be a CTMParser which returns the prefixes as result 
of the parsing process.

Original comment by h.niederhausen@googlemail.com on 15 Nov 2010 at 12:23

GoogleCodeExporter commented 8 years ago
See http://isotopicmaps.org/ctm/ctm.html#prefix-directive:
[71]    prefix-directive    → '%prefix' identifier reference
[72]    reference   → iri

[5] iri → iri-undelimited | iri-delimited
[6] schema-name → [a-zA-Z]+  [a-zA-Z0-9+-.]*
[7] iri-undelimited → 
schema-name '://'  ([;.)]*  [^#x20#x9#xD#xA;].()]+ ) +  
[8] iri-delimited   → '<'  ([^<>"{}|^`\] '-' [#x00-#x20]) +  '>'

[16]    identifier  → name-start  ('.'* name-part)*
[15]    name-part   → name-start | [0-9] | '-' | '#x00B7' | [#x0300-#x036F] | 
[#x203F-#x2040]

...

Try something like as a start. It's neither clean nor formally correct but it's 
for a convenience method only...
/%prefix\s+(\w+)\s+(\S+)\r?\n

Original comment by bnjmn...@gmail.com on 15 Nov 2010 at 12:38

GoogleCodeExporter commented 8 years ago

Original comment by h.niederhausen@googlemail.com on 15 Nov 2010 at 12:42

GoogleCodeExporter commented 8 years ago
You may have a look at the semagia mio PrefixListener and/or 
http://code.google.com/p/mio/source/browse/mio/trunk/mio-ctm/src/main/java/com/s
emagia/mio/ctm/CTMDeserializer.java

Original comment by bnjmn...@gmail.com on 15 Nov 2010 at 12:44

GoogleCodeExporter commented 8 years ago
This issue was closed by revision 8ce42575be.

Original comment by h.niederhausen@googlemail.com on 18 Nov 2010 at 5:18