schema

package
v0.0.0-...-8832f83 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 7, 2019 License: BSD-3-Clause Imports: 8 Imported by: 0

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

View Source
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

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

func IsValidValueDataType(dt string) bool

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

func AssertValidClassName(name string) ClassName

Assert that this string is a valid class name

func ValidateClassName

func ValidateClassName(name string) (error, ClassName)

Validates that this string is a valid class name (formate wise)

func (ClassName) String

func (c ClassName) String() string

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

func GetValueDataTypeFromString(dt string) (*DataType, error)

GetValueDataTypeFromString checks whether the given string is a valid data type

type PropertyDataType

type PropertyDataType interface {
	Kind() PropertyKind

	IsPrimitive() bool
	AsPrimitive() DataType

	IsReference() bool
	Classes() []ClassName

	ContainsClass(name ClassName) bool
}

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 Empty

func Empty() Schema

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) GetClass

func (s *Schema) GetClass(k kind.Kind, className ClassName) *models.SemanticSchemaClass

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

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL