Class GraphQlSchemaGenerator
java.lang.Object
org.aksw.jenax.graphql.schema.generator.GraphQlSchemaGenerator
Limitations:
- Splitting a type does not preserve its property order. (As properties are moved to a base class)
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordstatic final recordstatic final recordstatic final record -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Map<org.apache.jena.graph.Node,GraphQlSchemaGenerator.ClassInfo> static final org.apache.jena.graph.Nodeprotected Map<GraphQlSchemaGenerator.ExclusionType,org.apache.jena.graph.Node> protected Map<Set<GraphQlSchemaGenerator.PropertyInfo>,org.apache.jena.graph.Node> Artificial classes referred to by their properties.protected org.aksw.jenax.arq.util.prefix.ShortNameMgrstatic final graphql.language.Typestatic final org.apache.jena.graph.NodeNode for the pseudo-class of untyped instances - i.e. -
Constructor Summary
ConstructorsConstructorDescriptionGraphQlSchemaGenerator(Function<String, String> iriToLabel) Constructor that accepts a function that maps iris to labels. -
Method Summary
Modifier and TypeMethodDescriptionprotected org.apache.jena.graph.Nodeprotected org.apache.jena.graph.NodeallocateExclusionClassName(org.apache.jena.graph.Node baseName, Set<org.apache.jena.graph.Node> exclusionProperties) protected org.apache.jena.graph.NodeallocateExclusionClassNameFromStructure(org.apache.jena.graph.Node baseName, Set<org.apache.jena.graph.Node> exclusionProperties) protected org.apache.jena.graph.NodeallocateExclusionClassNameFromStructureOld(org.apache.jena.graph.Node baseName, Set<org.apache.jena.graph.Node> exclusionProperties) Allocate a name based on the base class name and the set of excluded properties.protected org.apache.jena.graph.NodeallocateExclusionClassNameFromType(org.apache.jena.graph.Node baseName, Set<org.apache.jena.graph.Node> exclusionProperties) Allocate a name based on the remaining properties.protected voidcollectPropertyMap(Set<org.apache.jena.graph.Node> types, Map<org.apache.jena.graph.Node, GraphQlSchemaGenerator.PropertyInfo> result) protected voidcollectPropertyMap(org.apache.jena.graph.Node type, Map<org.apache.jena.graph.Node, GraphQlSchemaGenerator.PropertyInfo> result) protected graphql.language.Documentconvert()protected graphql.language.FieldDefinitionconvertProperty(GraphQlSchemaGenerator.PropertyInfo propertyInfo) protected graphql.language.DefinitionconvertType(GraphQlSchemaGenerator.ClassInfo classInfo) protected Map<org.apache.jena.graph.Node,GraphQlSchemaGenerator.PropertyInfo> createPropertyMap(Set<org.apache.jena.graph.Node> types) Compute the set of properties and the union of all mentioned types for the given classes.protected Map<org.apache.jena.graph.Node,GraphQlSchemaGenerator.PropertyInfo> createPropertyMap(org.apache.jena.graph.Node type) Collect all properties of the given type and all its super types.protected org.apache.jena.graph.NodecreateUnionType(Set<org.apache.jena.graph.Node> types) Creates a union type for the given types.protected org.apache.jena.graph.Nodeprotected org.apache.jena.graph.NodegetOrCreateStructuralType(Map<org.apache.jena.graph.Node, GraphQlSchemaGenerator.PropertyInfo> propertyMap) protected org.apache.jena.graph.NodegetOrCreateUnionType(Set<org.apache.jena.graph.Node> superTypes) Stream<org.apache.jena.graph.Node>getTypes(org.apache.jena.graph.Node node) protected voidprotected voidprotected GraphQlSchemaGenerator.ClassInfomaterialize(GraphQlSchemaGenerator.ClassInfo classInfo) Move all properties of super types directly to this class.protected voidnormalize(Map<org.apache.jena.graph.Node, GraphQlSchemaGenerator.PropertyInfo> propertyMap) Set<org.apache.jena.graph.Node>create a new node set that is free of subsumed types.protected voidgraphql.language.Documentprotected voidregisterClass(GraphQlSchemaGenerator.ClassInfo classInfo) protected org.apache.jena.graph.NodeseverProperty(org.apache.jena.graph.Node cls, Set<org.apache.jena.graph.Node> exclusions) Given a class with property p, create a new class b without p.booleansubsumes(org.apache.jena.graph.Node parent, org.apache.jena.graph.Node child) static List<GraphQlSchemaGenerator.TypeInfo>summarize(org.aksw.jenax.dataaccess.sparql.datasource.RDFDataSource dataSource) toName(org.apache.jena.graph.Node node) static StringtoURI(org.apache.jena.graph.Node node)
-
Field Details
-
UNTYPED
public static final org.apache.jena.graph.Node UNTYPEDNode for the pseudo-class of untyped instances - i.e. all instances that have to rdf:type property. -
EMPTY
public static final org.apache.jena.graph.Node EMPTY -
TYPE_SCALAR
public static final graphql.language.Type TYPE_SCALAR -
shortNameMgr
protected org.aksw.jenax.arq.util.prefix.ShortNameMgr shortNameMgr -
iriToLabel
-
classMap
-
unionClassToName
-
exclusionTypeMap
-
propertiesToStructuralClass
protected Map<Set<GraphQlSchemaGenerator.PropertyInfo>,org.apache.jena.graph.Node> propertiesToStructuralClassArtificial classes referred to by their properties.
-
-
Constructor Details
-
GraphQlSchemaGenerator
public GraphQlSchemaGenerator() -
GraphQlSchemaGenerator
Constructor that accepts a function that maps iris to labels.
-
-
Method Details
-
summarize
public static List<GraphQlSchemaGenerator.TypeInfo> summarize(org.aksw.jenax.dataaccess.sparql.datasource.RDFDataSource dataSource) -
process
-
makeUnionTypeProperty
-
init
-
registerClass
-
toName
-
convert
protected graphql.language.Document convert() -
subsumes
public boolean subsumes(org.apache.jena.graph.Node parent, org.apache.jena.graph.Node child) -
normalize
create a new node set that is free of subsumed types. -
materialize
Move all properties of super types directly to this class. -
convertType
-
toURI
-
convertProperty
protected graphql.language.FieldDefinition convertProperty(GraphQlSchemaGenerator.PropertyInfo propertyInfo) -
createUnionType
Creates a union type for the given types. Thereby conflicting properties are resolved by possibly splitting the involved type definitions into common non-conflicting types. originalType := commonNonConflictingType UNION originalRemainingType resolvedType := commonNonConflictingType UNION newlyIntroducedType -
getEmptyType
protected org.apache.jena.graph.Node getEmptyType() -
getOrCreateUnionType
protected org.apache.jena.graph.Node getOrCreateUnionType(Set<org.apache.jena.graph.Node> superTypes) -
getOrCreateStructuralType
protected org.apache.jena.graph.Node getOrCreateStructuralType(Map<org.apache.jena.graph.Node, GraphQlSchemaGenerator.PropertyInfo> propertyMap) -
getTypes
-
severProperty
protected org.apache.jena.graph.Node severProperty(org.apache.jena.graph.Node cls, Set<org.apache.jena.graph.Node> exclusions) Given a class with property p, create a new class b without p. A then becomes b union p. Returns the new class without the property. This is a transitive operation that traverses all super classes and severs the properties from them. Returns the severed class name. -
allocateClassName
protected org.apache.jena.graph.Node allocateClassName() -
allocateExclusionClassNameFromType
protected org.apache.jena.graph.Node allocateExclusionClassNameFromType(org.apache.jena.graph.Node baseName, Set<org.apache.jena.graph.Node> exclusionProperties) Allocate a name based on the remaining properties. -
allocateExclusionClassName
protected org.apache.jena.graph.Node allocateExclusionClassName(org.apache.jena.graph.Node baseName, Set<org.apache.jena.graph.Node> exclusionProperties) -
allocateExclusionClassNameFromStructure
protected org.apache.jena.graph.Node allocateExclusionClassNameFromStructure(org.apache.jena.graph.Node baseName, Set<org.apache.jena.graph.Node> exclusionProperties) -
allocateExclusionClassNameFromStructureOld
protected org.apache.jena.graph.Node allocateExclusionClassNameFromStructureOld(org.apache.jena.graph.Node baseName, Set<org.apache.jena.graph.Node> exclusionProperties) Allocate a name based on the base class name and the set of excluded properties. -
createPropertyMap
protected Map<org.apache.jena.graph.Node,GraphQlSchemaGenerator.PropertyInfo> createPropertyMap(org.apache.jena.graph.Node type) Collect all properties of the given type and all its super types. -
normalize
protected void normalize(Map<org.apache.jena.graph.Node, GraphQlSchemaGenerator.PropertyInfo> propertyMap) -
normalize
-
createPropertyMap
protected Map<org.apache.jena.graph.Node,GraphQlSchemaGenerator.PropertyInfo> createPropertyMap(Set<org.apache.jena.graph.Node> types) Compute the set of properties and the union of all mentioned types for the given classes. -
collectPropertyMap
protected void collectPropertyMap(Set<org.apache.jena.graph.Node> types, Map<org.apache.jena.graph.Node, GraphQlSchemaGenerator.PropertyInfo> result) -
collectPropertyMap
protected void collectPropertyMap(org.apache.jena.graph.Node type, Map<org.apache.jena.graph.Node, GraphQlSchemaGenerator.PropertyInfo> result)
-