Documentation ¶
Overview ¶
_ _
*__ _____ __ ___ ___ __ _| |_ ___ *\ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \ * \ V V / __/ (_| |\ V /| | (_| | || __/ * \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___| * * Copyright © 2016 - 2019 Weaviate. All rights reserved. * LICENSE: https://github.com/creativesoftwarefdn/weaviate/blob/develop/LICENSE.md * DESIGN & CONCEPT: Bob van Luijt (@bobvanluijt) * CONTACT: hello@creativesoftwarefdn.org
_ _
*__ _____ __ ___ ___ __ _| |_ ___ *\ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \ * \ V V / __/ (_| |\ V /| | (_| | || __/ * \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___| * * Copyright © 2016 - 2019 Weaviate. All rights reserved. * LICENSE: https://github.com/creativesoftwarefdn/weaviate/blob/develop/LICENSE.md * DESIGN & CONCEPT: Bob van Luijt (@bobvanluijt) * CONTACT: hello@creativesoftwarefdn.org
_ _
*__ _____ __ ___ ___ __ _| |_ ___ *\ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \ * \ V V / __/ (_| |\ V /| | (_| | || __/ * \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___| * * Copyright © 2016 - 2019 Weaviate. All rights reserved. * LICENSE: https://github.com/creativesoftwarefdn/weaviate/blob/develop/LICENSE.md * DESIGN & CONCEPT: Bob van Luijt (@bobvanluijt) * CONTACT: hello@creativesoftwarefdn.org
_ _
*__ _____ __ ___ ___ __ _| |_ ___ *\ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \ * \ V V / __/ (_| |\ V /| | (_| | || __/ * \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___| * * Copyright © 2016 - 2019 Weaviate. All rights reserved. * LICENSE: https://github.com/creativesoftwarefdn/weaviate/blob/develop/LICENSE.md * DESIGN & CONCEPT: Bob van Luijt (@bobvanluijt) * CONTACT: hello@creativesoftwarefdn.org
Index ¶
- Constants
- Variables
- func GetClassByName(s *models.SemanticSchema, className string) (*models.SemanticSchemaClass, error)
- func GetPropertyByName(c *models.SemanticSchemaClass, propName string) (*models.SemanticSchemaClassProperty, error)
- func IsValidValueDataType(dt string) bool
- type Cardinality
- type ClassName
- type DataType
- type PropertyDataType
- type PropertyKind
- type PropertyName
- type Schema
- func (s *Schema) FindClassByName(className ClassName) *models.SemanticSchemaClass
- func (s *Schema) FindPropertyDataType(dataType []string) (PropertyDataType, error)
- func (s *Schema) GetClass(k kind.Kind, className ClassName) *models.SemanticSchemaClass
- func (s *Schema) GetProperty(kind kind.Kind, className ClassName, propName PropertyName) (error, *models.SemanticSchemaClassProperty)
- func (s *Schema) SemanticSchemaFor(k kind.Kind) *models.SemanticSchema
- type WeaviateSchema
Constants ¶
const ( // ErrorNoSuchClass message ErrorNoSuchClass string = "no such class with name '%s' found in the schema. Check your schema files for which classes are available" // ErrorNoSuchProperty message ErrorNoSuchProperty string = "" /* 135-byte string literal not displayed */ // ErrorNoSuchDatatype message ErrorNoSuchDatatype string = "given value-DataType does not exist." // ErrorInvalidRefType message ErrorInvalidRefType string = "given ref type is not valid" )
Variables ¶
var PrimitiveDataTypes []DataType = []DataType{DataTypeString, DataTypeText, DataTypeInt, DataTypeNumber, DataTypeBoolean, DataTypeDate, DataTypeGeoCoordinates}
Functions ¶
func GetClassByName ¶
func GetClassByName(s *models.SemanticSchema, className string) (*models.SemanticSchemaClass, error)
GetClassByName returns the class by its name
func GetPropertyByName ¶
func GetPropertyByName(c *models.SemanticSchemaClass, propName string) (*models.SemanticSchemaClassProperty, error)
GetPropertyByName returns the class by its name
func IsValidValueDataType ¶
IsValidValueDataType checks whether the given string is a valid data type
Types ¶
type Cardinality ¶
type Cardinality int
const CardinalityAtMostOne Cardinality = 1
const CardinalityMany Cardinality = 2
func CardinalityOfProperty ¶
func CardinalityOfProperty(property *models.SemanticSchemaClassProperty) Cardinality
type ClassName ¶
type ClassName string
Newtype to denote that this string is used as a Class name
func AssertValidClassName ¶
Assert that this string is a valid class name
func ValidateClassName ¶
Validates that this string is a valid class name (formate wise)
type DataType ¶
type DataType string
const ( // DataTypeCRef The data type is a cross-reference, it is starting with a capital letter DataTypeCRef DataType = "cref" // DataTypeString The data type is a value of type string DataTypeString DataType = "string" // DataTypeText The data type is a value of type string DataTypeText DataType = "text" // DataTypeInt The data type is a value of type int DataTypeInt DataType = "int" // DataTypeNumber The data type is a value of type number/float DataTypeNumber DataType = "number" // DataTypeBoolean The data type is a value of type boolean DataTypeBoolean DataType = "boolean" // DataTypeDate The data type is a value of type date DataTypeDate DataType = "date" // DataTypeGeoCoordinates is used to represent geo coordintaes, i.e. latitude // and longitude pairs of locations on earth DataTypeGeoCoordinates DataType = "geoCoordinates" )
func GetPropertyDataType ¶
func GetPropertyDataType(class *models.SemanticSchemaClass, propertyName string) (*DataType, error)
GetPropertyDataType checks whether the given string is a valid data type
func GetValueDataTypeFromString ¶
GetValueDataTypeFromString checks whether the given string is a valid data type
type PropertyDataType ¶
type PropertyKind ¶
type PropertyKind int
const PropertyKindPrimitive PropertyKind = 1
const PropertyKindRef PropertyKind = 2
type PropertyName ¶
type PropertyName string
Newtype to denote that this string is used as a Property name
func AssertValidPropertyName ¶
func AssertValidPropertyName(name string) PropertyName
Assert that this string is a valid property name
func ValidatePropertyName ¶
func ValidatePropertyName(name string) (error, PropertyName)
Validates that this string is a valid property name
func (PropertyName) String ¶
func (p PropertyName) String() string
type Schema ¶
type Schema struct { Actions *models.SemanticSchema Things *models.SemanticSchema }
Describes the schema that is used in Weaviate.
func (*Schema) FindClassByName ¶
func (s *Schema) FindClassByName(className ClassName) *models.SemanticSchemaClass
FindClassByName will find either a Thing or Class by name.
func (*Schema) FindPropertyDataType ¶
func (s *Schema) FindPropertyDataType(dataType []string) (PropertyDataType, error)
Based on the schema, return a valid description of the defined datatype
func (*Schema) GetProperty ¶
func (s *Schema) GetProperty(kind kind.Kind, className ClassName, propName PropertyName) (error, *models.SemanticSchemaClassProperty)
func (*Schema) SemanticSchemaFor ¶
func (s *Schema) SemanticSchemaFor(k kind.Kind) *models.SemanticSchema
Return one of the semantic schema's
type WeaviateSchema ¶
type WeaviateSchema struct { ActionSchema schemaProperties ThingSchema schemaProperties }
WeaviateSchema represents the used schema's
func HackFromDatabaseSchema ¶
func HackFromDatabaseSchema(dbSchema Schema) WeaviateSchema
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
_ _ *__ _____ __ ___ ___ __ _| |_ ___ *\ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \ * \ V V / __/ (_| |\ V /| | (_| | || __/ * \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___| * * Copyright © 2016 - 2019 Weaviate.
|
_ _ *__ _____ __ ___ ___ __ _| |_ ___ *\ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \ * \ V V / __/ (_| |\ V /| | (_| | || __/ * \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___| * * Copyright © 2016 - 2019 Weaviate. |
_ _ *__ _____ __ ___ ___ __ _| |_ ___ *\ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \ * \ V V / __/ (_| |\ V /| | (_| | || __/ * \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___| * * Copyright © 2016 - 2019 Weaviate.
|
_ _ *__ _____ __ ___ ___ __ _| |_ ___ *\ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \ * \ V V / __/ (_| |\ V /| | (_| | || __/ * \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___| * * Copyright © 2016 - 2019 Weaviate. |