Skip to content

Commit

Permalink
Backport changes to new schema procedures from 3.5 to 3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
SaschaPeukert committed Nov 5, 2018
1 parent 8bb7fb7 commit 9640c13
Show file tree
Hide file tree
Showing 7 changed files with 346 additions and 215 deletions.
Expand Up @@ -204,11 +204,17 @@ public void resampleOutdatedIndexes()
} }
} }


@Procedure( name = "okapi.schema", mode = READ ) @Procedure( name = "db.schema.nodeTypeProperties", mode = READ )
@Description( "Show the derived property schema of the data in tabular form." ) @Description( "Show the derived property schema of the nodes in tabular form." )
public Stream<SchemaInfoResult> propertySchema() public Stream<NodePropertySchemaInfoResult> nodePropertySchema()
{ {
return new SchemaCalculator( tx ).calculateTabularResultStream(); return new SchemaCalculator( tx ).calculateTabularResultStreamForNodes();
}
@Procedure( name = "db.schema.relTypeProperties", mode = READ )
@Description( "Show the derived property schema of the relationships in tabular form." )
public Stream<RelationshipPropertySchemaInfoResult> relationshipPropertySchema()
{
return new SchemaCalculator( tx ).calculateTabularResultStreamForRels();
} }


@Description( "Show the schema of the data." ) @Description( "Show the schema of the data." )
Expand Down
Expand Up @@ -21,39 +21,38 @@


import java.util.List; import java.util.List;


public class SchemaInfoResult public class NodePropertySchemaInfoResult
{ {
/** /**
* Indicates whether the entry is a node or a relationship * A combination of escaped label names interleaved by ":"
*/ */
public final String type; public final String nodeType;


/** /**
* A combination of labels or a relationship * A list of label names
*/ */
public final List<String> nodeLabelsOrRelType; public final List<String> nodeLabels;

/** /**
* A property that occurs on the given label combination / relationship type or null * A property name that occurs on the given label combination or null
*/ */
public final String property; public final String propertyName;


/** /**
* A List containing all CypherTypes of the given property on the given label combination / relationship type or null * A List containing all types of the given property on the given label combination or null
*/ */
public final List<String> cypherTypes; public final List<String> propertyTypes;


/** /**
* Indicates whether the property is present on all similar nodes / relationships (= false) or not (= true) * Indicates whether the property is present on all similar nodes (= true) or not (= false)
*/ */
public final boolean nullable; public final boolean mandatory;


public SchemaInfoResult( String type, List<String> nodeLabelsOrRelType, String property, List<String> cypherTypes, boolean nullable ) public NodePropertySchemaInfoResult( String nodeType, List<String> nodeLabelsList, String propertyName, List<String> cypherTypes, boolean mandatory )
{ {
this.type = type; this.nodeType = nodeType;
this.nodeLabelsOrRelType = nodeLabelsOrRelType; this.nodeLabels = nodeLabelsList;
this.property = property; this.propertyName = propertyName;
this.cypherTypes = cypherTypes; this.propertyTypes = cypherTypes;
this.nullable = nullable; this.mandatory = mandatory;
} }
} }
@@ -0,0 +1,53 @@
/*
* Copyright (c) 2002-2018 "Neo4j,"
* Neo4j Sweden AB [http://neo4j.com]
*
* This file is part of Neo4j.
*
* Neo4j is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.neo4j.kernel.builtinprocs;

import java.util.List;

public class RelationshipPropertySchemaInfoResult
{
/**
* A relationship type
*/
public final String relType;

/**
* A property name that occurs on the given relationship type or null
*/
public final String propertyName;

/**
* A List containing all types of the given property on the given relationship type or null
*/
public final List<String> propertyTypes;

/**
* Indicates whether the property is present on all similar relationships (= true) or not (= false)
*/
public final boolean mandatory;

public RelationshipPropertySchemaInfoResult( String relType, String propertyName, List<String> cypherTypes, boolean mandatory )
{
this.relType = relType;
this.propertyName = propertyName;
this.propertyTypes = cypherTypes;
this.mandatory = mandatory;
}
}

0 comments on commit 9640c13

Please sign in to comment.