Skip to content
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

[BUG] <Length constraint does not work if one of the min or max values are mentioned and not both of them> #533

Closed
kreuz1995 opened this issue Feb 23, 2024 · 0 comments · Fixed by #548
Assignees
Labels
bug Something isn't working

Comments

@kreuz1995
Copy link

Steps to reproduce

pipeline SemiconductorBandGapsPipeline {

block SemiconductorBandGapsExtractor oftype HttpExtractor {
	url: "https://figshare.com/ndownloader/files/31781996";
}

block ZipArchiveInterpreter oftype ArchiveInterpreter {
	archiveType: "zip";
}

block SemiconductorBandGapsCSVPicker oftype FilePicker {
	path: "/Bandpgap_database_v2/Bandgap.csv";
}

block SemiconductorBandGapsTextFileInterpreter oftype TextFileInterpreter {
}

block SemiconductorBandGapsCSVInterpreter oftype CSVInterpreter {
	delimiter: ",";
}

// Removed white spaces from the Composition formula and kept only those rows in the format of {'element_scientific_name': units}
valuetype Composition oftype text {
constraints: [NonEmptyText];
}

constraint NonEmptyText oftype LengthConstraint {
	minLength: 1;
	// maxLength:9007199254740991;
}

// DOI Format has been constrained by a standard pattern, eg: 10.1007/xxxx

valuetype DOIReference oftype text {
	constraints: [DOIFormat];
}

constraint DOIFormat oftype RegexConstraint{
	regex: /\b10\.\d{4}\/[^\s]+\b/;

}

block SemiconductorBandGapsTableInterpreter oftype TableInterpreter {
	header: true;
	columns: [
		"Name" oftype text,
		"Composition" oftype Composition,
		"Value" oftype text,
		"Unit" oftype text,
		"Raw_value" oftype decimal,
		"Raw_unit" oftype text,
		"Snowball" oftype boolean,
		"Confidence" oftype decimal,
        "AutoSentenceParser" oftype boolean,
        "BandgapDB" oftype boolean,
        "Text" oftype text,
        "Publisher" oftype text,
        "DOI" oftype DOIReference,
        "Temperature_value" oftype text,
        "Temperature_unit" oftype text,
        "Temperature_raw_value" oftype decimal,
        "Temperature_raw_unit" oftype text,
        "Notes" oftype text,
	];
}

block SemiconductorBandGapsDatabaseLoader oftype SQLiteLoader {
	table: "SemiConductorBandGaps";
	file: "./SemiConductorBandGaps.sqlite";
}

SemiconductorBandGapsExtractor
	-> ZipArchiveInterpreter
	-> SemiconductorBandGapsCSVPicker
	-> SemiconductorBandGapsTextFileInterpreter
	-> SemiconductorBandGapsCSVInterpreter
	-> SemiconductorBandGapsTableInterpreter
	-> SemiconductorBandGapsDatabaseLoader;

}

Description

  • Expected: SQLite Database named SemiConductorBandGaps.sqlite to be created. No error to be encountered in the execution of the code.
  • Actual:

Error encountered.

            error: An unknown error occurred: AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value:

(0, assert_1.strict)(valuetype.isInternalValueRepresentation(defaultValue))

at ExecutionContext.getDefaultPropertyValue (C:\Users\conne\AppData\Roaming\npm\node_modules\@jvalue\jayvee-interpreter\main.js:974:29)
at ExecutionContext.getPropertyValue (C:\Users\conne\AppData\Roaming\npm\node_modules\@jvalue\jayvee-interpreter\main.js:945:25)
at LengthConstraintExecutor.isValid (C:\Users\conne\AppData\Roaming\npm\node_modules\@jvalue\jayvee-interpreter\main.js:607:35)
at ValueRepresentationValidityVisitor.visitAtomicValuetype (C:\Users\conne\AppData\Roaming\npm\node_modules\@jvalue\jayvee-interpreter\main.js:2065:65)
at AtomicValuetype.acceptVisitor (C:\Users\conne\AppData\Roaming\npm\node_modules\@jvalue\jayvee-interpreter\main.js:12713:24)
at isValidValueRepresentation (C:\Users\conne\AppData\Roaming\npm\node_modules\@jvalue\jayvee-interpreter\main.js:2046:22)
at TableInterpreterExecutor.parseAndValidateValue (C:\Users\conne\AppData\Roaming\npm\node_modules\@jvalue\jayvee-interpreter\main.js:4546:64)
at C:\Users\conne\AppData\Roaming\npm\node_modules\@jvalue\jayvee-interpreter\main.js:4525:38
at Array.forEach (<anonymous>)
at TableInterpreterExecutor.constructAndValidateTableRow (C:\Users\conne\AppData\Roaming\npm\node_modules\@jvalue\jayvee-interpreter\main.js:4520:23)
at C:\Users\conne\AppData\Roaming\npm\node_modules\@jvalue\jayvee-interpreter\main.js:4508:35
at Array.forEach (<anonymous>)
at Sheet.iterateRows (C:\Users\conne\AppData\Roaming\npm\node_modules\@jvalue\jayvee-interpreter\main.js:1673:19)
at TableInterpreterExecutor.constructAndValidateTable (C:\Users\conne\AppData\Roaming\npm\node_modules\@jvalue\jayvee-interpreter\main.js:4504:15)
at TableInterpreterExecutor.<anonymous> (C:\Users\conne\AppData\Roaming\npm\node_modules\@jvalue\jayvee-interpreter\main.js:4489:41)
at Generator.next (<anonymous>)
            $In /D:/Project 2/4th last/SemiconductorBandGapsModel.jv:42:8
            42 |     block SemiconductorBandGapsTableInterpreter oftype TableInterpreter {
@kreuz1995 kreuz1995 added the bug Something isn't working label Feb 23, 2024
@TungstnBallon TungstnBallon self-assigned this Apr 12, 2024
TungstnBallon added a commit that referenced this issue May 3, 2024
…ne bound (#548)

* test(constraints): add tests

* fix(constraints): add language server hint for boundless constraint

* test(constraints): add tests for language server hint

closes #533
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants