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

Metadata Validator #57

Open
cpraschl opened this issue Jul 18, 2022 · 0 comments
Open

Metadata Validator #57

cpraschl opened this issue Jul 18, 2022 · 0 comments

Comments

@cpraschl
Copy link
Member

Implement a mechanism to define a schema for GeoOFF, GeoPLY and GeoOBJ metadata.
This mechanism should allow defining the structure of required and optional meta information on file and/or object level.
A schema should consist of a key that references the meta-information key within the geometric file and with one or multiple values. Each value should correspond to the associated data type, and should also allow to define range constraints for numeric as well as string values.

The attributed grammar of such a metadataschema would somehow look like:

File = "File:\n" + Metadefinitions + "Object:\n" + Metadefinitions
Metadefinitions =  Metadefinition | Metadefinitions + Metadefinition
Metadefinition = Key Required Typedefinition '\n'
Key = string
Required = 'r' | 'o'
Typedefinition = TypeChain | TypeChain Multitype
TypeChain = Type | Type TypeChain | LimitedMultiType | LimitedMultiType TypeChain
LimitedMultiType = Integer '*' Type
Multitype = Type + '*'
Type = TupleType | NumberType | StringType | 'datetime' | 'bool'
TupleType = '(' TypeChain ')'
NumberType = 'int' | 'int[' IntRange ']' | 'float' | 'float[' FloatRange ']'
IntRange = integer [IntRange] | [integer]:intger [IntRange]
FloatRange = float [IntRange] | [float]:float [IntRange]
StringType = 'str' | 'str[' StringRange ']'
StringRange = string [StringRange]

Leading to one example, meta information schema file like:

File:
tu r string
ru r string
axis_ordering o 3*string
Object:
special_type r string[building street bridge]
infos o string*
buildingyear o int[1990:2022]

Based on such a meta information schema implement:

  • a parser
  • a validator

Where the validator is used to validate a GeoObjectFile or can be injected to a GeoObjReader, GeoOffReader or GeoPlyReader.

Such a validator could have the following signature:

class SchemaValidator:
  def __init__(file_schema: Dict[str, Any], object_schema: Dict[str, Any]):
     # Todo
  
  def validate(file: GeoObjectFile):
     # Todo
  
  def validate_file(key: str, values: List[Any]):
     # Todo

  def validate_object(key: str, values: List[Any]):
     # Todo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant