Documentation ¶
Overview ¶
Package owl extracts classes and properties from an owl ontology and maps them to a Go model.
Index ¶
- func AddBoolPropertyToGraph(g *rdf.Graph, propIRI string, subjNode *rdf.Node, obj bool)
- func AddClassPropertyToGraph(g *rdf.Graph, propIRI string, subjNode *rdf.Node, obj Thing)
- func AddDatePropertyToGraph(g *rdf.Graph, propIRI string, subjNode *rdf.Node, obj time.Time)
- func AddDateTimePropertyToGraph(g *rdf.Graph, propIRI string, subjNode *rdf.Node, obj time.Time)
- func AddDateTimeStampPropertyToGraph(g *rdf.Graph, propIRI string, subjNode *rdf.Node, obj time.Time)
- func AddDurationPropertyToGraph(g *rdf.Graph, propIRI string, subjNode *rdf.Node, obj time.Duration)
- func AddFloatPropertyToGraph(g *rdf.Graph, propIRI string, subjNode *rdf.Node, obj float64)
- func AddGDayPropertyToGraph(g *rdf.Graph, propIRI string, subjNode *rdf.Node, obj time.Time)
- func AddGMonthPropertyToGraph(g *rdf.Graph, propIRI string, subjNode *rdf.Node, obj time.Time)
- func AddGYearMonthPropertyToGraph(g *rdf.Graph, propIRI string, subjNode *rdf.Node, obj time.Time)
- func AddGYearPropertyToGraph(g *rdf.Graph, propIRI string, subjNode *rdf.Node, obj time.Time)
- func AddIntPropertyToGraph(g *rdf.Graph, propIRI string, subjNode *rdf.Node, obj int)
- func AddInterfacePropertyToGraph(g *rdf.Graph, propIRI string, subjNode *rdf.Node, obj interface{})
- func AddObjectToGraph(g *rdf.Graph, typeIRI string, res Thing) (node *rdf.Node)
- func AddStringPropertyToGraph(g *rdf.Graph, propIRI string, subjNode *rdf.Node, obj string)
- func AddTimePropertyToGraph(g *rdf.Graph, propIRI string, subjNode *rdf.Node, obj time.Time)
- func ParseXsdDuration(in string) (out time.Duration, err error)
- type Class
- type GoClass
- type GoIndividual
- type GoModel
- type GoProperty
- type Individual
- type Ontology
- type Property
- type Restriction
- type Thing
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddBoolPropertyToGraph ¶ added in v1.1.0
AddBoolPropertyToGraph adds the specified property to the graph
func AddClassPropertyToGraph ¶ added in v1.1.0
AddClassPropertyToGraph adds the specified property to the graph
func AddDatePropertyToGraph ¶ added in v1.1.0
AddDatePropertyToGraph adds the specified property to the graph
func AddDateTimePropertyToGraph ¶ added in v1.1.0
AddDateTimePropertyToGraph adds the specified property to the graph
func AddDateTimeStampPropertyToGraph ¶ added in v1.1.0
func AddDateTimeStampPropertyToGraph(g *rdf.Graph, propIRI string, subjNode *rdf.Node, obj time.Time)
AddDateTimeStampPropertyToGraph adds the specified property to the graph
func AddDurationPropertyToGraph ¶ added in v1.1.0
func AddDurationPropertyToGraph(g *rdf.Graph, propIRI string, subjNode *rdf.Node, obj time.Duration)
AddDurationPropertyToGraph adds the specified property to the graph
func AddFloatPropertyToGraph ¶ added in v1.1.0
AddFloatPropertyToGraph adds the specified property to the graph
func AddGDayPropertyToGraph ¶ added in v1.1.0
AddGDayPropertyToGraph adds the specified property to the graph
func AddGMonthPropertyToGraph ¶ added in v1.1.0
AddGMonthPropertyToGraph adds the specified property to the graph
func AddGYearMonthPropertyToGraph ¶ added in v1.1.0
AddGYearMonthPropertyToGraph adds the specified property to the graph
func AddGYearPropertyToGraph ¶ added in v1.1.0
AddGYearPropertyToGraph adds the specified property to the graph
func AddIntPropertyToGraph ¶ added in v1.1.0
AddIntPropertyToGraph adds the specified property to the graph
func AddInterfacePropertyToGraph ¶ added in v1.1.0
AddInterfacePropertyToGraph adds the specified property to the graph
func AddObjectToGraph ¶ added in v1.1.0
AddObjectToGraph adds the specified object to the graph
func AddStringPropertyToGraph ¶ added in v1.1.0
AddStringPropertyToGraph adds the specified property to the graph
func AddTimePropertyToGraph ¶ added in v1.1.0
AddTimePropertyToGraph adds the specified property to the graph
Types ¶
type Class ¶
type Class struct { Node *rdf.Node // graph Node of class Parent []*Class // all direct parent classes of class Child []*Class // all direct children classes of class Enumeration []*Individual // enumerations in owl:OneOf Restriction []*Restriction // restrictions of class in owl:Restriction Intersection []*Class // intersections in owl:IntersectionOf Union []*Class // unions in owl:UnionOf Complement []*Class // complements in owl:Complement Name string // class name (IRI) Comment string // comment }
Class is one ontology class
func GetBaseClass ¶
GetBaseClass returns the base class of all values
func GetBaseType ¶
func GetBaseType(individual []string, individuals map[string]*Individual, classes map[string]*Class) (base *Class, err error)
GetBaseType returns the base type of specified individuals
func (*Class) GetAllParents ¶
GetAllParents returns all transitive parents
func (*Class) GetRestrictions ¶
func (class *Class) GetRestrictions() (ret []*Restriction)
GetRestrictions returns all restrictions of a class and its base classes
func (*Class) GetRestrictionsInverse ¶
func (class *Class) GetRestrictionsInverse() (ret []*Restriction)
GetRestrictionsInverse returns all restrictions of a class and its base classes prioritizing base class restrictions
type GoClass ¶
type GoClass struct { IRI string // iri of class Name string // class name Parent []string // parent classes (also transitive) DirectParent []string // direct parent classes Property []GoProperty // properties of class Comment string // comment for doc Model *GoModel // pointer to model }
GoClass holds properties of a class
type GoIndividual ¶
type GoIndividual struct { IRI string // Individual iri Name string // name of individual Typ string // type of individual (class) }
GoIndividual individuals
type GoModel ¶
type GoModel struct { Class map[string]GoClass // map className->Class Individual []GoIndividual // all individuals IRI string // ontology iri Description string // description extracted from ontology Name string // name (part of iri) Content []byte // ontology in ttl Module string // Go module name }
GoModel holds all classes
type GoProperty ¶
type GoProperty struct { IRI string // IRI Name string // name Capital string // name with capital first letter Typ [2]string // type in struct (child of BaseTyp, 0: typ; 1: IRI) BaseTyp [2]string // type in interface AllowedTyp [][2]string // allowed types (children of Typ) XSDTyp string // XSD type if any Individual []string // predefined Individuals Multi bool // multiple values possible? Multiplicity string // multiplicity (slice or single value) Comment string // comment for doc Inverse string // inverse property if any Symmetric bool // symmetric? }
GoProperty holds condiguration of a property
type Individual ¶
type Individual struct { Node *rdf.Node // graph node of individual Comment string // comment Name string // name Type *Class // value type SameAs *Individual // owl:sameAs DifferentFrom *Individual // owl:differentFrom AllDifferent []*Individual // owl:AllDifferent }
Individual is one ontology individual
type Ontology ¶
type Ontology struct { IRI string Class map[string]*Class // all classes (key = iri) Property map[string]*Property // all properties (key = iri) Individual map[string]*Individual // all individuals (key = iri) Imports map[string][]string // imported ontologies Description map[string]string // comment about Ontology Content map[string][]byte // Ontology specification in ttl format // contains filtered or unexported fields }
Ontology holds all information of one ontology
func ExtractOntology ¶
ExtractOntology extracts all classes, properties, individuals and imports
func ExtractOntologyLink ¶
ExtractOntologyLink extracts all classes, properties, individuals and imports
type Property ¶
type Property struct { Node *rdf.Node // graph node of property Name string // name of property (IRI) Comment string // comment Domain []*Class // rdfs:domain Range []string // rdfs:range Equivalent *Property // owl:equivalentProperty Inverse *Property // owl:inverseOf SubPropertyOf []*Property //owl:subPropertyOf Type string // object or datatype property IsFunctional bool // owl:functionalProperty IsInverseFunctional bool // owlInverseFunctionalProperty IsTransitive bool // owl:TransistiveProperty IsSymmetric bool // owl:SysmmetricProperty }
Property is one ontology property
type Restriction ¶
type Restriction struct { Node *rdf.Node // graph node of restriction Property *Property // property ValueConstraint string // owl:allValuesFrom, owl:someValuesFrom or owl:hasValue CardinalityConstraint string // owl:maxCardinality, owl:minCardinality or owl:cardinality Multiplicity int // if restriction has cardinality constraint this shows the multiplicity Value []string // value type }
Restriction is a restriction of a class property