Skip to content

Commit

Permalink
fix Identity projection fixture to impose only fetch explicitly named…
Browse files Browse the repository at this point in the history
… fields

temporary remove routing for EdgeRoutingSearchAppender (future will be configurable)
  • Loading branch information
[email protected] committed Jan 7, 2020
1 parent dd92835 commit 792a4bb
Show file tree
Hide file tree
Showing 13 changed files with 117 additions and 15 deletions.
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ WORKDIR /opt/engine

# this is a specific yang.db assembly used for knowledge based ontology - a general purpose RDF schema
COPY distrib/knowledge-knowledge /opt/engine
COPY distrib/knowledge-fuse-source.zip /opt/engine

RUN chmod 755 /opt/engine/start-fuse-service.sh
# clean
Expand Down
1 change: 0 additions & 1 deletion Dockerfile.custom
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ WORKDIR /opt/engine

# this is a specific yang.db assembly used for custom based ontology - a custom index schema
COPY distrib/dragon-dragon /opt/engine
COPY distrib/dragon-dragon.zip /opt/engine

RUN chmod 755 /opt/engine/start-fuse-service.sh
# clean
Expand Down
1 change: 0 additions & 1 deletion Dockerfile.knowledge
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ WORKDIR /opt/engine

# this is a specific yang.db assembly used for knowledge based ontology - a general purpose RDF schema
COPY distrib/knowledge-knowledge /opt/engine
COPY distrib/knowledge-fuse-source.zip /opt/engine

RUN chmod 755 /opt/engine/start-fuse-service.sh
# clean
Expand Down
4 changes: 2 additions & 2 deletions buildDocker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ cd $(dirname "$0")
echo "mvn clean install"
mvn clean install

echo "docker build . -t yangdb/yang.db:${tagname}"
docker build -t yangdb/yang.db:${tagname}
echo "docker build -t yangdb/yang.db:${tagname} ."
docker build -t yangdb/yang.db:${tagname} .

echo "docker push yangdb/yang.db:${tagname}"
docker push yangdb/yang.db:${tagname}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Knowledge.physical_schema_initiator = com.yangdb.fuse.assembly.knowledge.Knowled
Knowledge.physical_schema_data_loader = com.yangdb.fuse.assembly.knowledge.KnowledgeDataLoader
Knowledge.physical_schema_csv_data_loader = com.yangdb.fuse.assembly.knowledge.KnowledgeCSVDataLoader

Knowledge.search_order_provider = com.yangdb.fuse.assembly.knowledge.KnowledgeSearchOrderProvider
Knowledge.search_order_provider = com.yangdb.fuse.assembly.knowledge.KnowledgeLightSearchOrderProvider
Knowledge.physical_schema_provider_factory_class = com.yangdb.fuse.assembly.knowledge.KnowledgeRoutedSchemaProviderFactory
Knowledge.stats_provider_class = com.yangdb.fuse.assembly.knowledge.KnowledgeStaticRuleBasedStatisticalProvider
Knowledge.plan_extension_strategy_class = com.yangdb.fuse.assembly.knowledge.KnowledgeM2DfsRedundantPlanExtensionStrategy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand All @@ -22,27 +22,30 @@

import com.yangdb.fuse.asg.strategy.AsgStrategy;
import com.yangdb.fuse.dispatcher.ontology.OntologyProvider;
import com.yangdb.fuse.model.asgQuery.AsgQueryUtil;
import com.yangdb.fuse.executor.ontology.GraphElementSchemaProviderFactory;
import com.yangdb.fuse.model.asgQuery.AsgEBase;
import com.yangdb.fuse.model.asgQuery.AsgQuery;
import com.yangdb.fuse.model.asgQuery.AsgQueryUtil;
import com.yangdb.fuse.model.asgQuery.AsgStrategyContext;
import com.yangdb.fuse.model.ontology.Ontology;
import com.yangdb.fuse.model.ontology.Property;
import com.yangdb.fuse.model.query.properties.*;
import com.yangdb.fuse.model.query.properties.constraint.ConstraintOp;
import com.yangdb.fuse.model.query.entity.EEntityBase;
import com.yangdb.fuse.model.query.entity.ETyped;
import com.yangdb.fuse.model.query.properties.*;
import com.yangdb.fuse.model.query.properties.constraint.ConstraintOp;
import com.yangdb.fuse.model.query.properties.projection.IdentityProjection;
import com.yangdb.fuse.unipop.schemaProviders.GraphElementPropertySchema;
import com.yangdb.fuse.unipop.schemaProviders.GraphElementSchemaProvider;
import com.yangdb.fuse.unipop.schemaProviders.GraphVertexSchema;
import javaslang.collection.Stream;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Optional;
import java.util.Set;

import static com.yangdb.fuse.unipop.schemaProviders.GraphElementPropertySchema.IndexingSchema.Type.exact;
import static java.util.Collections.unmodifiableList;

/**
* Created by roman.margolis on 08/02/2018.
Expand Down Expand Up @@ -128,11 +131,17 @@ private void transformEPropGroup(Ontology.Accessor ont, GraphElementSchemaProvid
eProp.getpType(),
exactIndexingSchema.get().getName(),
eProp.getCon()));
}else if(eProp.isProjection()) {
ePropGroup.getProps().add(new EProp(
0,
eProp.getpType(),
new IdentityProjection()));
}
}

ePropGroup.getGroups().forEach(group -> transformEPropGroup(ont, schemaProvider, group, eTypedAsgEBase));
}

//endregion

//region Fields
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ static ByteArrayOutputStream extractFile(InflaterInputStream zipIn) throws IOExc

static Object parseValue(String explicitType, Object value, DateFormat sdf) {
switch (explicitType) {
case "text":
case "string":
case "stringValue":
return value.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,8 @@ private void buildEdgeQuery(ReduceEdgeQuery reduceQuery, SearchBuilder searchBui
wrap(new FilterSourceRoutingSearchAppender()),
wrap(new ElementRoutingSearchAppender()),
wrap(new EdgeSourceSearchAppender()),
wrap(new EdgeRoutingSearchAppender()),
//todo: add configuration to enable/disable routing
// wrap(new EdgeRoutingSearchAppender()),
wrap(new EdgeSourceRoutingSearchAppender()),
wrap(new EdgeIndexSearchAppender()),
wrap(new DualEdgeDirectionSearchAppender()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ protected Iterator<Edge> search(SearchVertexQuery searchVertexQuery, Iterable<St
searchVertexQuery.getDirection(),
searchVertexQuery.getVertices()));

//skip vertex query since needed properties exist on already fetched vertices
if (canDoWithoutQuery(searchVertexQuery, context)) {
ElementConverter<DataItem, Edge> elementConverter = new CompositeElementConverter<>(
new DiscreteEdgeConverter<>(context, profiler));
Expand All @@ -133,7 +134,8 @@ protected Iterator<Edge> search(SearchVertexQuery searchVertexQuery, Iterable<St
wrap(new ElementRoutingSearchAppender()),
wrap(new EdgeBulkSearchAppender()),
wrap(new EdgeSourceSearchAppender()),
wrap(new EdgeRoutingSearchAppender()),
//todo: add configuration to enable/disable routing
// wrap(new EdgeRoutingSearchAppender()),
wrap(new EdgeSourceRoutingSearchAppender()),
wrap(new EdgeIndexSearchAppender()),
wrap(new DualEdgeDirectionSearchAppender()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,19 @@
@JsonIgnoreProperties(ignoreUnknown = true)
public class LogicalEdge implements Edge {
public static final String EDGE = "Edge";
@JsonProperty("id")
private String id;
@JsonProperty("label")
private String label = EDGE;
@JsonProperty("source")
private String source;
@JsonProperty("target")
private String target;
@JsonProperty("direction")
private boolean direction;
@JsonProperty("metadata")
private EdgeMetadata metadata = new EdgeMetadata();
@JsonProperty("properties")
private EdgeProperties properties = new EdgeProperties();

public LogicalEdge() {}
Expand All @@ -78,35 +85,76 @@ public LogicalEdge withProperty(String property, Object value) {
return this;
}

@JsonProperty("label")
public String getLabel() {
return label;
}


@JsonProperty("id")
public String getId() {
return id;
}

@JsonProperty("source")
public String getSource() {
return source;
}

@JsonProperty("target")
public String getTarget() {
return target;
}

@JsonProperty("direction")
public boolean isDirection() {
return direction;
}

@JsonProperty("metadata")
public EdgeMetadata getMetadata() {
return metadata;
}

@JsonProperty("properties")
public EdgeProperties getProperties() {
return properties;
}

@JsonProperty("id")
public void setId(String id) {
this.id = id;
}

@JsonProperty("label")
public void setLabel(String label) {
this.label = label;
}

@JsonProperty("source")
public void setSource(String source) {
this.source = source;
}

@JsonProperty("target")
public void setTarget(String target) {
this.target = target;
}

@JsonProperty("direction")
public void setDirection(boolean direction) {
this.direction = direction;
}

@JsonProperty("metadata")
public void setMetadata(EdgeMetadata metadata) {
this.metadata = metadata;
}

@JsonProperty("properties")
public void setProperties(EdgeProperties properties) {
this.properties = properties;
}

@Override
public String toString() {
return getClass().getSimpleName()+"{" +
Expand All @@ -121,31 +169,37 @@ public String toString() {
}

@Override
@JsonProperty("id")
public String id() {
return getId()!=null ? id : String.format("%s.%s",source,target);
}

@Override
@JsonProperty("label")
public String label() {
return getLabel();
}

@Override
@JsonProperty("metadata")
public Map<String, Object> metadata() {
return getMetadata().getProperties();
}

@Override
@JsonIgnore
public Map<String, Object> fields() {
return getProperties().getProperties();
}

@Override
@JsonProperty("source")
public String source() {
return getSource();
}

@Override
@JsonProperty("target")
public String target() {
return getTarget();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,14 @@
public class LogicalNode implements Vertex {
public static final String NODE = "Node";

private String id;
@JsonProperty("label")
private String label = NODE;
@JsonProperty("id")
private String id;

@JsonProperty("metadata")
private NodeMetadata metadata = new NodeMetadata();
@JsonProperty("properties")
private NodeProperties properties = new NodeProperties(); ;

public LogicalNode() {}
Expand All @@ -70,38 +75,66 @@ public LogicalNode(String id,String label) {
this.label = label;
}

@JsonProperty("label")
public String getLabel() {
return label;
}

@JsonProperty("id")
public String getId() {
return id;
}

@JsonProperty("metadata")
public NodeMetadata getMetadata() {
return metadata;
}

@JsonProperty("properties")
public NodeProperties getProperties() {
return properties;
}

@Override
@JsonProperty("id")
public String id() {
return getId();
}

@Override
@JsonProperty("label")
public String label() {
return getLabel();
}

@JsonProperty("label")
public void setLabel(String label) {
this.label = label;
}

@JsonProperty("id")
public void setId(String id) {
this.id = id;
}

@JsonProperty("metadata")
public void setMetadata(NodeMetadata metadata) {
this.metadata = metadata;
}

@JsonProperty("properties")
public void setProperties(NodeProperties properties) {
this.properties = properties;
}

@Override
@JsonProperty("metadata")
public Map<String, Object> metadata() {
return getMetadata().getProperties();
}

@Override
@JsonProperty("properties")
public Map<String, Object> fields() {
return getProperties().getProperties();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@
*
*/

import com.fasterxml.jackson.annotation.JsonInclude;
import com.yangdb.fuse.model.query.aggregation.AggLOp;

@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class CalculatedFieldProjection extends Projection {
private AggLOp expression;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,11 @@
*
*/

import com.fasterxml.jackson.annotation.JsonInclude;

/**
* Created by roman.margolis on 27/02/2018.
*/
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class IdentityProjection extends Projection {
}

0 comments on commit 792a4bb

Please sign in to comment.