In an attempt to compile my program, I received the following error regarding the file String.purs from the Text.Smolder.Renderer module:
Error found:
at bower_components\purescript-smolder\src\Text\Smolder\Renderer\String.purs:76:
56 - 76:57 (line 76, column 56 - line 76, column 57)
Unable to parse module:
Illegal character escape code
I looked at the source file and found the following at line 76:
toStream s = foldr (\c t -> c :< (Just t)) (mkCofree '\0' Nothing) cs
How can this be corrected? (And how on earth could a compiler error be in a public library!!!)
Related
I'm trying to integrate JNC and Pyang. As the jnc steps describes I have copied jnc.py under PYANG_HOME/pyang/plugins. I try to generate the java classes for simple.yang under $JNC_HOME/examples/yang using the command
pyang -f jnc --jnc-output src/gen/simple yang/simple.yang
facing the following error,
Traceback (most recent call last):
File "D:/tools/pyang-master/bin/pyang", line 434, in <module>
run()
File "D:/tools/pyang-master/bin/pyang", line 408, in run
emit_obj.emit(ctx, modules, fd)
File "C:\Users\Siva\AppData\Local\Programs\Python\Python35-32\lib\site-packages\pyang-1.7-py3.5.egg\pyang/plugins\jnc.py", line 208, in emit
if module_stmt in (imported + included):
TypeError: unsupported operand type(s) for +: 'map' and 'map'
Anyone faced this kind of issue. please let me know how to fix this.
Problem is with map implementation:
map in Python-3 returns an iterator, while map in Python 2 returns a list:
Python 2:
>>> type(map(abs, [43, -12, 13, -14]))
<type 'list'>
Python 3:
>>> type(map(abs, [99, -52, 32, -34, 13]))
<class 'map'>
You can edit file jnc.py and change code as below:
for (module_stmt, rev) in self.ctx.modules:
if module_stmt in (imported + included):
module_set.add(self.ctx.modules[(module_stmt, rev)])
for (module_stmt, rev) in self.ctx.modules:
if module_stmt in (included):
module_set.add(self.ctx.modules[(module_stmt, rev)])
if module_stmt in (imported):
module_set.add(self.ctx.modules[(module_stmt, rev)])
For my project I want to read yml file in matlab using YAMLMatlab. My .yml files look like this. I am ust showing a part of .yml file. My file is around 29 MB.
%YAML:1.0
Block size: [ 16, 16 ]
Block stride: [ 8, 8 ]
Cell size: [ 8, 8 ]
block hist size: 36
block per img: [ 63, 63 ]
Total elements in array: 142884
nbins: 9
Scale: 1.
Level: 0
Width: 512
Height: 512
features:
- 1.5302167832851410e-01
- 1.0552208870649338e-01
- 1.6659785807132721e-01
- 2.3539969325065613e-01
- 2.0810306072235107e-01
- 1.2627227604389191e-01
- 8.0759152770042419e-02
- 6.4930714666843414e-02
- 6.1364557594060898e-02
- 2.1614919602870941e-01
- 1.4714729785919189e-01
While reading .yml file I got the following error.
Error using ReadYamlRaw>load_yaml (line 78)
Java exception occurred:
java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Unknown Source)
at java.lang.AbstractStringBuilder.expandCapacity(Unknown Source)
at java.lang.AbstractStringBuilder.ensureCapacityInternal(Unknown Source)
at java.lang.AbstractStringBuilder.append(Unknown Source)
at java.lang.StringBuilder.append(Unknown Source)
at org.yaml.snakeyaml.reader.StreamReader.<init>(StreamReader.java:51)
at org.yaml.snakeyaml.Yaml.load(Yaml.java:399)
Error in ReadYamlRaw (line 42)
result = load_yaml(filename, nosuchfileaction, treatasdata);
Error in ReadYaml (line 48)
ry = ReadYamlRaw(filename, 0, nosuchfileaction, treatasdata);
Error in untitled (line 2)
YamlStruct = ReadYaml(yaml_file);
I believe this error is due to large file size as I can read simple .yml file. Can someone help me to resolve this error. I have also read this post.
P.S: Here is .yml file
EDIT:
It works with below answer but I got the following error now. Once I remover %YAML:1.0. It works fine.
Error using ReadYamlRaw>load_yaml (line 78)
Java exception occurred:
while scanning a directive
in "<string>", line 1, column 1:
%YAML:1.0
^
expected alphabetic or numeric character, but found :(58)
in "<string>", line 1, column 6:
%YAML:1.0
^
at org.yaml.snakeyaml.scanner.ScannerImpl.scanDirectiveName(ScannerImpl.java:1028)
at org.yaml.snakeyaml.scanner.ScannerImpl.scanDirective(ScannerImpl.java:990)
at org.yaml.snakeyaml.scanner.ScannerImpl.fetchDirective(ScannerImpl.java:534)
at org.yaml.snakeyaml.scanner.ScannerImpl.fetchMoreTokens(ScannerImpl.java:251)
at org.yaml.snakeyaml.scanner.ScannerImpl.checkToken(ScannerImpl.java:179)
at org.yaml.snakeyaml.parser.ParserImpl$ParseImplicitDocumentStart.produce(ParserImpl.java:198)
at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:161)
at org.yaml.snakeyaml.parser.ParserImpl.checkEvent(ParserImpl.java:146)
at org.yaml.snakeyaml.composer.Composer.getSingleNode(Composer.java:105)
at org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData(BaseConstructor.java:121)
at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:480)
at org.yaml.snakeyaml.Yaml.load(Yaml.java:399)
Error in ReadYamlRaw (line 42)
result = load_yaml(filename, nosuchfileaction, treatasdata);
Error in ReadYaml (line 48)
ry = ReadYamlRaw(filename, 0, nosuchfileaction, treatasdata);
Error in untitled (line 2)
YamlStruct = ReadYaml(yaml_file);
In MATLAB, select Preferences from the menu/toolstrip. Find the section MATLAB>General>Java Heap Memory, and increase the Java heap size.
You'll need to restart MATLAB after changing this setting for it to take effect.
I know I can put annotations on a SubClassOf relation:
SubClassOf(
Annotation(rdfs:comment "This annotation is valid")
ObjectIntersectionOf(
ObjectHasValue(:prop1 :instance1)
ObjectHasValue(:prop2 :instance2)
)
ObjectHasValue(:prop3 :instance3)
)
However, what I really wanted to do is this:
SubClassOf(
ObjectIntersectionOf(
Annotation(rdfs:comment "This annotation is invalid")
ObjectHasValue(:prop1 :instance1)
ObjectHasValue(:prop2 :instance2)
)
ObjectHasValue(:prop3 :instance3)
)
What I want is to create an annotation meaningful to all objects with the relations :prop1 :instance1 and :prop2 :instance, and not to the subclass relation.
I don't want to create a class for the ObjectIntersectionOf, as I will have thousands of such classes on my real example.
Running pellet 2.3.1 on the file below yields the following error:
$ pellet.sh explain draft2.owl
There are 1 input files:
./draft2.owl
Start loading
org.semanticweb.owlapi.io.UnparsableOntologyException: Problem parsing file:/home/users/djogo/Desktop/ontologia%20tnm/draft2.owl
Could not parse ontology. Either a suitable parser could not be found, or parsing failed. See parser logs below for explanation.
The following parsers were tried:
1) RDFXMLParser
2) OWLXMLParser
3) OWLFunctionalSyntaxOWLParser
4) TurtleOntologyParser
5) OWLOBOParser
6) KRSS2OWLParser
7) ManchesterOWLSyntaxOntologyParser
Detailed logs:
--------------------------------------------------------------------------------
Parser: RDFXMLParser
org.xml.sax.SAXParseException; systemId: file:/home/users/djogo/Desktop/ontologia%20tnm/draft2.owl; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.
--------------------------------------------------------------------------------
Parser: OWLXMLParser
org.xml.sax.SAXParseException; systemId: file:/home/users/djogo/Desktop/ontologia%20tnm/draft2.owl; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.
--------------------------------------------------------------------------------
Parser: OWLFunctionalSyntaxOWLParser
Encountered "" at line 8, column 9.
Was expecting one of:
(Line 7)
--------------------------------------------------------------------------------
Parser: TurtleOntologyParser
uk.ac.manchester.cs.owl.owlapi.turtle.parser.ParseException: Encountered "" at line 1, column 1.
Was expecting one of:
--------------------------------------------------------------------------------
Parser: OWLOBOParser
org.coode.owlapi.obo.parser.TokenMgrError: Lexical error at line 6, column 12. Encountered: "\n" (10), after : ""
--------------------------------------------------------------------------------
Parser: KRSS2OWLParser
de.uulm.ecs.ai.owlapi.krssparser.ParseException: Encountered " <NAME> "Prefix "" at line 1, column 1.
Was expecting:
<EOF>
--------------------------------------------------------------------------------
Parser: ManchesterOWLSyntaxOntologyParser
Encountered Prefix at line 1 column 1. Expected one of:
DifferentIndividuals:
Individual:
Class:
AnnotationProperty:
Import:
DisjointClasses:
ObjectProperty:
Datatype:
EquivalentClasses:
SameIndividual:
Prefix:
DataProperty:
DisjointProperties:
ValuePartition:
(Line 1)
at uk.ac.manchester.cs.owl.owlapi.ParsableOWLOntologyFactory.loadOWLOntology(ParsableOWLOntologyFactory.java:236)
at uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.loadOntology(OWLOntologyManagerImpl.java:880)
at uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.loadOntologyFromOntologyDocument(OWLOntologyManagerImpl.java:818)
at com.clarkparsia.pellet.owlapiv3.OWLAPILoader.parseFile(OWLAPILoader.java:142)
at org.mindswap.pellet.KBLoader.parse(KBLoader.java:99)
at com.clarkparsia.pellet.owlapiv3.OWLAPILoader.parse(OWLAPILoader.java:128)
at org.mindswap.pellet.KBLoader.createKB(KBLoader.java:65)
at pellet.PelletCmdApp.getKB(PelletCmdApp.java:210)
at pellet.PelletCmdApp.getKB(PelletCmdApp.java:198)
at pellet.PelletExplain.parseArgs(PelletExplain.java:204)
at pellet.Pellet.run(Pellet.java:104)
at pellet.Pellet.main(Pellet.java:59)
draft2.owl
Prefix(rdfs:=<http://www.w3.org/2000/01/rdf-schema#>)
Prefix(:=<http://cipe.accamargo.org.br/ontologias/tnm.owl#>)
Ontology(<http://cipe.accamargo.org.br/ontologias/tnm.owl>
SubClassOf(
ObjectIntersectionOf(
Annotation(rdfs:comment "This annotation is invalid")
ObjectHasValue(:prop1 :instance1)
ObjectHasValue(:prop2 :instance2)
)
ObjectHasValue(:prop3 :instance3)
)
No, I don't think you can do this. The OWL 2 spec allows for annotations of ontologies, axioms, and entities, and complex class expressions are neither of those (see ยง10 Annotations).
Pellet has nothing to do with this, you get the error from the OWL API FSS parser since your ontology is syntactically invalid.
I am trying to complie a .cc file to mex, and I am using mex filename command in Matlab. My complier is [1] Lcc-win32 C 2.4.1 in C:\PROGRA~1\MATLAB\R2012b\sys\lcc .
However, there are some errors:
lcc preprocessor error: learn.cc:5 Could not find include file <sys/time.h>
Error learn.cc: 70 illegal statement termination
Error learn.cc: 70 skipping `int'
Error learn.cc: 70 undeclared identifier `alen'
Error learn.cc: 71 illegal statement termination
Error learn.cc: 71 skipping `int'
Error learn.cc: 71 undeclared identifier `blen'
Error learn.cc: 87 invalid struct field declarations
Error learn.cc: 87 syntax error; found `collapsed' expecting `}'
Error learn.cc: 87 skipping `collapsed' `*' `x'
Error learn.cc: 93 unrecognized declaration
Warning learn.cc: 93 empty declaration
Error learn.cc: 97 undefined size for `incomplete struct timeval defined at learn.cc 97 tp'
Error learn.cc: 99 unknown field `tv_usec' of `incomplete struct timeval defined at learn.cc 97'
Error learn.cc: 102 syntax error; found `double' expecting `;'
Error learn.cc: 103 syntax error; found `double' expecting `;'
Error learn.cc: 106 missing parameter type
Error learn.cc: 106 syntax error; found `X' expecting `)'
Error learn.cc: 106 skipping `X' `,'
Error learn.cc: 106 syntax error; found `double' expecting `{'
Error learn.cc: 106 missing identifier
Error learn.cc: 106 too many errors
I guess the reason for the first error is that there is no time.h file in the sys folder. Instead there is timeb.h file. But I don't know the reason to the following errors.
Here are some relative codes:
line 70 int alen = **((int **)a);
line 71 int blen = **((int **)b);
line 86-93 struct data {
collapsed *x;
int num;
int numblocks;
int *blocksizes;
float *regmult;
float *learnmult;
};
line 96-100 void seed_time() {
struct timeval tp;
check(gettimeofday(&tp, NULL) == 0);
srand48((long)tp.tv_usec);
}
line 102 static inline double min(double x, double y) { return (x <= y ? x : y); }
line 103 static inline double max(double x, double y) { return (x <= y ? y : x); }
Can anyone give me a hint?
As far as i can tell, there is nothing wrong with lines 70,71. Are a,b integer double arrays declared and allocated with something like:
int ** a = malloc(4 * sizeof(int*) );
for (int var = 0; var < 4; ++var) {
a[var] = malloc(3*sizeof(int));
}
?
Are you sure that the sys/time.h file can be replaced by sys/timeb.h file? Have you tried?
sys/time.h looks like a pretty linux/unix specific file. Are you sure that the sys/ folder refers to your matlab sys directory (C:\PROGRA~1\MATLAB\R2012b\sys\lcc)?
In general, it looks like you are trying to compile a linux .mex file on a windows machine. For example gettimeofday is a linux pure call (according to this answer):
Equivalent of gettimeday() for Windows
I would like to read .yml files in Matlab. These files contain coordinates x and y of key points on a face image. I looked for different tools but I don't seem to find any answers.
My .yml files look like this
YAML:1.0
Image file: "00032009.jpg"
Contours count: 8
Contours:
-
Name: FO
Count: 41
Closed: 0
Points:
-
x: 682.5947265625000000
y: 743.1998901367187500
-
x: 685.9638061523437500
y: 771.3800659179687500
......
and so on
Note 00032009.jpg is an image of a face
x and y are coordinates of a point on a face Eg: the right corner of an eye etc
Could you please point out a way to read the file and then display the points on the face image?
Edit 1: Here is the error I get
Error: File: ReadYamlRaw.m Line: 14 Column: 11
Expression or statement is incorrect--possibly unbalanced (, {, or [.
Error in ==> ReadYaml at 38
ry = ReadYamlRaw(filename, 0, nosuchfileaction);
What is weird is line 14 in ReadYamlRaw.m
[pth,~,~]= fileparts(mfilename('fullpath'));
Parse error at ','(second one) and ']' usage appears to be invalid matlab syntax.
So what is the use of ~ in there and why is there an error?
Edit2: I replaced the ~ in the line above with dummy variables then I get this errors O_O
Error using ==> ReadYamlRaw>scan at 81
Unknown data type: logical
Error in ==> ReadYamlRaw>scan_map at 138
result.(ich) = scan(r.get(java.lang.String(ich)));
Error in ==> ReadYamlRaw>scan at 79
result = scan_map(r);
Error in ==> ReadYamlRaw>scan_list at 116
result{ii} = scan(i);
Error in ==> ReadYamlRaw>scan at 77
result = scan_list(r);
Error in ==> ReadYamlRaw>scan_map at 138
result.(ich) = scan(r.get(java.lang.String(ich)));
Error in ==> ReadYamlRaw>scan at 79
result = scan_map(r);
Error in ==> ReadYamlRaw>load_yaml at 48
result = scan(yaml.load(fileread([filename, fileext])));
Error in ==> ReadYamlRaw at 19
result = load_yaml(filename, nosuchfileaction);
Error in ==> ReadYaml at 38
ry = ReadYamlRaw(filename, 0, nosuchfileaction);
I also tried with a different yml file that looks like this
%YAML:1.0
RE-C:
x: 919
y: 580
LE-C:
x: 1209
y: 597
N-C:
x: 1063
y: 698
FO-B:
x: 1045
y: 1114
REL-O:
x: 852
y: 597
REL-I:
x: 986
y: 600
REL-T:
x: 918
y: 564
And I get the following errors
Java exception occurred:
while scanning a directive
in "<string>", line 1, column 1:
%YAML:1.0
^
expected alphabetic or numeric character, but found :(58)
in "<string>", line 1, column 6:
%YAML:1.0
^
at org.yaml.snakeyaml.scanner.ScannerImpl.scanDirectiveName(ScannerImpl.java:1028)
at org.yaml.snakeyaml.scanner.ScannerImpl.scanDirective(ScannerImpl.java:990)
at org.yaml.snakeyaml.scanner.ScannerImpl.fetchDirective(ScannerImpl.java:534)
at org.yaml.snakeyaml.scanner.ScannerImpl.fetchMoreTokens(ScannerImpl.java:251)
at org.yaml.snakeyaml.scanner.ScannerImpl.checkToken(ScannerImpl.java:179)
at
org.yaml.snakeyaml.parser.ParserImpl$ParseImplicitDocumentStart.produce(ParserImpl.java:198)
at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:161)
at org.yaml.snakeyaml.parser.ParserImpl.checkEvent(ParserImpl.java:146)
at org.yaml.snakeyaml.composer.Composer.getSingleNode(Composer.java:105)
at org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData(BaseConstructor.java:121)
at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:480)
at org.yaml.snakeyaml.Yaml.load(Yaml.java:399)
Error in ==> ReadYamlRaw>load_yaml at 48
result = scan(yaml.load(fileread([filename, fileext])));
Error in ==> ReadYamlRaw at 19
result = load_yaml(filename, nosuchfileaction);
Error in ==> ReadYaml at 38
ry = ReadYamlRaw(filename, 0, nosuchfileaction);
Maybe someone can make something out of these or you could point out another set of functions that would work? I searched but didn't find any except this one.
It's YAML file indeed (as #DavidBrown mentioned in his comment, the extension does not matter). But it has some problems. Don't know if it's due to wrong YAML format or MATLAB implementation.
I've installed YAMLMATLAB and played a little with your file.
YamlStruct = ReadYaml(yaml_file);
YAMLMATLAB returns error if the files is feed as is. It works only if I comment the first line and remove spaces from field names. So the beginning of the file looks like this:
#YAML:1.0
Imagefile: 00032009.jpg
Contourscount: 8
...skipped the rest...
Then I get the correct structure. For example you can access the 1st point's x coordinate as
YamlStruct.Contours{1}.Points{1}.x
ans =
682.5947
UPDATE
Space in filed names is actually a known problem in YAMLMATLAB. See the report and possible solution here.
UPDATE 2
According to comment from #Jirka_cigler (YAMLMATLAB developers group):
In the program release 0.4.3 we added support for whitespaces in field
names, so the problem should not appear again.
Great!
I've also removed previous developers comment on the problem in the first UPDATE since it's not true any more.
ZozaniDB Database Toolbox comes with a Matlab-native YAML implementation that handles the .yml file here. To parse a string or a file, use:
>> yaml_parse ( str )
>> yaml_read ( filename )