Class JsonLDSchema
java.lang.Object
org.spdx.v3jsonldstore.JsonLDSchema
Represents the JSON Schema for SPDX 3.X includes a number of convenience methods
- Author:
- Gary O'Neall
-
Field Summary
FieldsModifier and TypeFieldDescription -
Constructor Summary
ConstructorsConstructorDescriptionJsonLDSchema(String schemaFileName, String contextFileName, String modelFileName) -
Method Summary
Modifier and TypeMethodDescriptionCollection<net.jimblackler.jsonschemafriend.Schema> Optional<net.jimblackler.jsonschemafriend.Schema> getClassSchema(String className) getPropertyDescriptor(String fieldName) getPropertyType(String propertyName) getType(net.jimblackler.jsonschemafriend.Schema classSchema) getTypeUri(net.jimblackler.jsonschemafriend.Schema classSchema) booleanhasProperty(String propertyName, net.jimblackler.jsonschemafriend.Schema schema) booleanbooleanisIndividual(String propertyName, String propertyValue) booleanisSpdxObject(String propertyName) booleanisSubclassOf(String superClassType, net.jimblackler.jsonschemafriend.Schema subClass) booleanvalidate(com.fasterxml.jackson.databind.JsonNode root) boolean
-
Field Details
-
RESERVED_JAVA_WORDS
-
REVERSE_JAVA_WORDS
-
BOOLEAN_TYPES
-
INTEGER_TYPES
-
DOUBLE_TYPES
-
STRING_TYPES
-
-
Constructor Details
-
JsonLDSchema
public JsonLDSchema(String schemaFileName, String contextFileName, String modelFileName) throws net.jimblackler.jsonschemafriend.GenerationException - Parameters:
schemaFileName- File name for the schema file in the resources directorycontextFileName- File name for the context file in the resources directorymodelFileName- File name for the model file in the resources directory- Throws:
net.jimblackler.jsonschemafriend.GenerationException- on schema loading error
-
-
Method Details
-
getAllClasses
- Returns:
- a list of schemas for all classes defined in the SPDX schema
-
isSubclassOf
public boolean isSubclassOf(String superClassType, net.jimblackler.jsonschemafriend.Schema subClass) throws URISyntaxException - Parameters:
superClassType- superclass typesubClass- schema for the subclass- Returns:
- true if the subClass schema contains the property restrictions for the superclass types
- Throws:
URISyntaxException- on a bad superClassType string
-
hasProperty
- Parameters:
propertyName- name of the property to checkschema- schema containing property restrictions- Returns:
- true if the schema requires a property named propertyName via properties, subSchemas, or allOf
-
getClassSchema
-
getTypeUri
-
getType
-
validate
public boolean validate(com.fasterxml.jackson.databind.JsonNode root) - Parameters:
root- Root JSON node of the JSON representation of an SPDX serialization- Returns:
- true if the JSON node is valid
-
validate
- Parameters:
spdxJsonFile- file containing SPDX JSON LD content- Returns:
- true if the JSON in file is valid according to the schema
- Throws:
IOException- on file IO errors
-
getElementTypes
-
getAnyLicenseInfoTypes
-
getPropertyType
-
getVocab
-
getPropertyDescriptor
- Parameters:
fieldName- name of a JSON field / property- Returns:
- the SPDX model property descriptor for the JSON property
-
isSpdxObject
- Parameters:
propertyName- Name of the property- Returns:
- true if the value associated with the property is an ID representing an SPDX Object
-
isIndividual
-
isEnum
- Parameters:
propertyName- Name of the property- Returns:
- true if the propertyValue represents an enumeration
-