• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java UriResourceNavigation类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.olingo.server.api.uri.UriResourceNavigation的典型用法代码示例。如果您正苦于以下问题:Java UriResourceNavigation类的具体用法?Java UriResourceNavigation怎么用?Java UriResourceNavigation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



UriResourceNavigation类属于org.apache.olingo.server.api.uri包,在下文中一共展示了UriResourceNavigation类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: deleteEntityReference

import org.apache.olingo.server.api.uri.UriResourceNavigation; //导入依赖的package包/类
public static void deleteEntityReference(RdfEdmProvider rdfEdmProvider, UriInfo uriInfo) throws OData2SparqlException {
	SparqlStatement sparqlStatement = null;
	// 1. Retrieve the entity set which belongs to the requested entity
	List<UriResource> resourcePaths = uriInfo.getUriResourceParts();
	// Note: only in our example we can assume that the first segment is the EntitySet
	UriResourceEntitySet uriResourceEntitySet = (UriResourceEntitySet) resourcePaths.get(0);
	EdmEntitySet edmEntitySet = uriResourceEntitySet.getEntitySet();

	RdfEntityType entityType = rdfEdmProvider.getRdfEntityTypefromEdmEntitySet(edmEntitySet);

	List<UriParameter> entityKeyPredicates = uriResourceEntitySet.getKeyPredicates();
	UriResourceNavigation uriResourceNavigation = (UriResourceNavigation) resourcePaths.get(1);
	RdfAssociation navigationProperty = entityType
			.findNavigationProperty(uriResourceNavigation.getProperty().getName());
	List<UriParameter> navigationKeyPredicates = uriResourceNavigation.getKeyPredicates();
	SparqlCreateUpdateDeleteBuilder sparqlCreateUpdateDeleteBuilder = new SparqlCreateUpdateDeleteBuilder(
			rdfEdmProvider);
	try {
		sparqlStatement = sparqlCreateUpdateDeleteBuilder.generateDeleteLinkQuery( entityType, entityKeyPredicates,navigationProperty,navigationKeyPredicates);
	} catch (Exception e) {
		log.error(e.getMessage());
		throw new OData2SparqlException(e.getMessage());
	}
	sparqlStatement.executeInsert(rdfEdmProvider);
}
 
开发者ID:peterjohnlawrence,项目名称:com.inova8.odata2sparql.v4,代码行数:26,代码来源:SparqlBaseCommand.java


示例2: getNavigationTargetEntitySet

import org.apache.olingo.server.api.uri.UriResourceNavigation; //导入依赖的package包/类
/**
 * Gets related binding target by resource navigation property name.
 * 
 * @param entitySet
 *            parent entity set
 * @param resourceNavigation
 *            resource navigation property
 * @return found binding target
 * @throws ODataApplicationException
 *             if any error occurred
 */
protected ElasticEdmEntitySet getNavigationTargetEntitySet(ElasticEdmEntitySet entitySet,
        UriResourceNavigation resourceNavigation) throws ODataApplicationException {
    ElasticEdmEntitySet navigationTargetEntitySet = null;
    EdmBindingTarget edmBindingTarget = entitySet
            .getRelatedBindingTarget(resourceNavigation.getProperty().getName());
    if (edmBindingTarget == null) {
        throwNotImplemented();
    }
    if (edmBindingTarget instanceof ElasticEdmEntitySet) {
        navigationTargetEntitySet = (ElasticEdmEntitySet) edmBindingTarget;
    } else {
        throwNotImplemented();
    }
    return navigationTargetEntitySet;
}
 
开发者ID:Hevelian,项目名称:hevelian-olastic,代码行数:27,代码来源:RequestCreator.java


示例3: blockTypeFilters

import org.apache.olingo.server.api.uri.UriResourceNavigation; //导入依赖的package包/类
private void blockTypeFilters(final UriResource uriResource)
        throws ODataApplicationException
{
    if (((uriResource instanceof UriResourceEntitySet)
            && (((UriResourceEntitySet) uriResource).getTypeFilterOnCollection() != null
            || ((UriResourceEntitySet) uriResource).getTypeFilterOnEntry()
            != null)) || ((uriResource instanceof UriResourceFunction)
            && (((UriResourceFunction) uriResource).getTypeFilterOnCollection() != null
            || ((UriResourceFunction) uriResource).getTypeFilterOnEntry()
            != null)) || ((uriResource instanceof UriResourceNavigation)
            && (((UriResourceNavigation) uriResource).getTypeFilterOnCollection() != null
            || ((UriResourceNavigation) uriResource).getTypeFilterOnEntry() != null)))
    {
        throw new ODataApplicationException("Type filters are not supported.",
                                            HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(),
                                            Locale.ROOT);
    }
}
 
开发者ID:RedHelixOrg,项目名称:RedHelix-1,代码行数:19,代码来源:RedHxDiscoveryProcessor.java


示例4: createReference

import org.apache.olingo.server.api.uri.UriResourceNavigation; //导入依赖的package包/类
@Override
public void createReference(final ODataRequest request, final ODataResponse response, final UriInfo uriInfo,
    final ContentType requestFormat) throws ODataApplicationException, ODataLibraryException {

  final ODataDeserializer deserializer = odata.createDeserializer(requestFormat);
  final DeserializerResult references = deserializer.entityReferences(request.getBody());

  if (references.getEntityReferences().size() != 1) {
    throw new ODataApplicationException("A post request to a collection navigation property must "
        + "contain a single entity reference", HttpStatusCode.BAD_REQUEST.getStatusCode(), Locale.ROOT);
  }

  final Entity entity = readEntity(uriInfo, true);
  final UriResourceNavigation navigationProperty = getLastNavigation(uriInfo);
  ensureNavigationPropertyNotNull(navigationProperty);
  dataProvider.createReference(entity, navigationProperty.getProperty(), references.getEntityReferences().get(0),
      request.getRawBaseUri());

  response.setStatusCode(HttpStatusCode.NO_CONTENT.getStatusCode());
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:21,代码来源:TechnicalEntityProcessor.java


示例5: updateReference

import org.apache.olingo.server.api.uri.UriResourceNavigation; //导入依赖的package包/类
@Override
public void updateReference(final ODataRequest request, ODataResponse response, final UriInfo uriInfo,
    final ContentType requestFormat) throws ODataApplicationException, ODataLibraryException {

  final ODataDeserializer deserializer = odata.createDeserializer(requestFormat);
  final DeserializerResult references = deserializer.entityReferences(request.getBody());

  if (references.getEntityReferences().size() != 1) {
    throw new ODataApplicationException("A post request to a collection navigation property must "
        + "contain a single entity reference", HttpStatusCode.BAD_REQUEST.getStatusCode(), Locale.ROOT);
  }

  final Entity entity = readEntity(uriInfo, true);
  final UriResourceNavigation navigationProperty = getLastNavigation(uriInfo);
  ensureNavigationPropertyNotNull(navigationProperty);
  dataProvider.createReference(entity, navigationProperty.getProperty(), references.getEntityReferences().get(0),
      request.getRawBaseUri());

  response.setStatusCode(HttpStatusCode.NO_CONTENT.getStatusCode());
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:21,代码来源:TechnicalEntityProcessor.java


示例6: deleteReference

import org.apache.olingo.server.api.uri.UriResourceNavigation; //导入依赖的package包/类
@Override
public void deleteReference(final ODataRequest request, ODataResponse response, final UriInfo uriInfo)
    throws ODataApplicationException {

  final UriResourceNavigation lastNavigation = getLastNavigation(uriInfo);
  final IdOption idOption = uriInfo.getIdOption();

  ensureNavigationPropertyNotNull(lastNavigation);
  if (lastNavigation.isCollection() && idOption == null) {
    throw new ODataApplicationException("Id system query option must be provided",
        HttpStatusCode.BAD_REQUEST.getStatusCode(),
        Locale.ROOT);
  } else if (!lastNavigation.isCollection() && idOption != null) {
    throw new ODataApplicationException("Id system query option must not be provided",
        HttpStatusCode.BAD_REQUEST.getStatusCode(),
        Locale.ROOT);
  }

  final Entity entity = readEntity(uriInfo, true);
  dataProvider.deleteReference(entity,
      lastNavigation.getProperty(),
      (uriInfo.getIdOption() != null) ? uriInfo.getIdOption().getValue() : null,
      request.getRawBaseUri());

  response.setStatusCode(HttpStatusCode.NO_CONTENT.getStatusCode());
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:27,代码来源:TechnicalEntityProcessor.java


示例7: getEdmTypeForContNavProperty

import org.apache.olingo.server.api.uri.UriResourceNavigation; //导入依赖的package包/类
private EdmEntityType getEdmTypeForContNavProperty(UriInfo uriInfo) {
  List<UriResource> pathSegments = uriInfo.getUriResourceParts();
  EdmEntityType type = null;
  for(UriResource resource : pathSegments) {
    if (resource instanceof UriResourceNavigation) {
      UriResourceNavigation navResource = (UriResourceNavigation) resource;
      if (navResource.getProperty().containsTarget()) {
        if (navResource.getTypeFilterOnCollection() != null) {
          type = ((EdmEntityType) navResource.getTypeFilterOnCollection());
        } else if (navResource.getTypeFilterOnEntry() != null) {
          type = ((EdmEntityType) navResource.getTypeFilterOnEntry());
        } else {
          type = ((EdmEntityType) navResource.getType());
        }
      }
    }
  }
  return type;
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:20,代码来源:TechnicalEntityProcessor.java


示例8: handleCountDispatching

import org.apache.olingo.server.api.uri.UriResourceNavigation; //导入依赖的package包/类
private void handleCountDispatching(final ODataRequest request, final ODataResponse response,
    final int lastPathSegmentIndex) throws ODataApplicationException, ODataLibraryException {
  final UriResource resource = uriInfo.getUriResourceParts().get(lastPathSegmentIndex - 1);
  if (resource instanceof UriResourceEntitySet
      || resource instanceof UriResourceNavigation
      || resource instanceof UriResourceFunction
          && ((UriResourceFunction) resource).getType().getKind() == EdmTypeKind.ENTITY) {
    handler.selectProcessor(CountEntityCollectionProcessor.class)
        .countEntityCollection(request, response, uriInfo);
  } else if (resource instanceof UriResourcePrimitiveProperty
      || resource instanceof UriResourceFunction
          && ((UriResourceFunction) resource).getType().getKind() == EdmTypeKind.PRIMITIVE) {
    handler.selectProcessor(CountPrimitiveCollectionProcessor.class)
        .countPrimitiveCollection(request, response, uriInfo);
  } else {
    handler.selectProcessor(CountComplexCollectionProcessor.class)
        .countComplexCollection(request, response, uriInfo);
  }
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:20,代码来源:ODataDispatcher.java


示例9: requireMediaResourceInCaseOfEntity

import org.apache.olingo.server.api.uri.UriResourceNavigation; //导入依赖的package包/类
private void requireMediaResourceInCaseOfEntity(UriResource resource) throws UriParserSemanticException {
  // If the resource is an entity or navigatio
  if (resource instanceof UriResourceEntitySet && !((UriResourceEntitySet) resource).getEntityType().hasStream()
      || resource instanceof UriResourceNavigation
      && !((EdmEntityType) ((UriResourceNavigation) resource).getType()).hasStream()) {
    throw new UriParserSemanticException("$value on entity is only allowed on media resources.",
        UriParserSemanticException.MessageKeys.NOT_A_MEDIA_RESOURCE, resource.getSegmentValue());
  }

  // Functions can also deliver an entity. In this case we have to check if the returned entity is a media resource
  if (resource instanceof UriResourceFunction) {
    EdmType returnType = ((UriResourceFunction) resource).getFunction().getReturnType().getType();
    //Collection check is above so not needed here
    if (returnType instanceof EdmEntityType && !((EdmEntityType) returnType).hasStream()) {
      throw new UriParserSemanticException("$value on returned entity is only allowed on media resources.",
          UriParserSemanticException.MessageKeys.NOT_A_MEDIA_RESOURCE, resource.getSegmentValue());
    }
  }
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:20,代码来源:ResourcePathParser.java


示例10: getTargetEntitySet

import org.apache.olingo.server.api.uri.UriResourceNavigation; //导入依赖的package包/类
static String getTargetEntitySet(EdmBindingTarget root, LinkedList<UriResourceNavigation> navigations) {
  EdmEntityType type = root.getEntityType();
  EdmBindingTarget targetEntitySet = root;
  String targetEntitySetName = root.getName();
  String name = null;
  for (UriResourceNavigation nav:navigations) {
    name = nav.getProperty().getName();
    EdmNavigationProperty property = type.getNavigationProperty(name);
    if (property.containsTarget()) {
      return root.getName();
    }
    type = nav.getProperty().getType();
    
    for(EdmNavigationPropertyBinding enb:targetEntitySet.getNavigationPropertyBindings()) {
      if (enb.getPath().equals(name)) {
        targetEntitySetName = enb.getTarget();
      } else if (enb.getPath().endsWith("/"+name)) {
        targetEntitySetName = enb.getTarget();
      }
    }
  }
  return targetEntitySetName;
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:24,代码来源:DataRequest.java


示例11: getNavigableEntity

import org.apache.olingo.server.api.uri.UriResourceNavigation; //导入依赖的package包/类
public Entity getNavigableEntity(Entity parentEntity, UriResourceNavigation navigation)
    throws ODataApplicationException {
  EdmEntityType type = this.metadata.getEdm().getEntityType(
      new FullQualifiedName(parentEntity.getType()));

  String key = type.getKeyPredicateNames().get(0);
  String linkName = navigation.getProperty().getName();

  EntityCollection results = null;
  if (navigation.getProperty().isCollection()) {
    results = getNavigableEntitySet(parentEntity, navigation);
    return this.getEntity(results, navigation.getKeyPredicates());
  }
  if (type.getName().equals("Person") && linkName.equals("Photo")) {
    return getPhoto((String) parentEntity.getProperty(key).getValue());
  } else if (type.getName().equals("Flight") && linkName.equals("From")) {
    return getFlightFrom((Integer) parentEntity.getProperty(key).getValue());
  } else if (type.getName().equals("Flight") && linkName.equals("To")) {
    return getFlightTo((Integer) parentEntity.getProperty(key).getValue());
  } else if (type.getName().equals("Flight") && linkName.equals("Airline")) {
    return getFlightAirline((Integer) parentEntity.getProperty(key).getValue());
  } else {
    throw new RuntimeException("unknown relation");
  }
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:26,代码来源:TripPinDataModel.java


示例12: getNavigableEntitySet

import org.apache.olingo.server.api.uri.UriResourceNavigation; //导入依赖的package包/类
/**
 * This method return the entity collection which are able to navigate from the parent entity (source) using uri navigation properties.
 * <p/>
 * In this method we check the parent entities primary keys and return the entity according to the values.
 * we use ODataDataHandler, navigation properties to get particular foreign keys.
 *
 * @param metadata     Service Metadata
 * @param parentEntity parentEntity
 * @param navigation   UriResourceNavigation
 * @return EntityCollection
 * @throws ODataServiceFault
 */
private EntityCollection getNavigableEntitySet(ServiceMetadata metadata, Entity parentEntity,
                                               UriResourceNavigation navigation, String url)
        throws ODataServiceFault, ODataApplicationException {
    EdmEntityType type = metadata.getEdm().getEntityType(new FullQualifiedName(parentEntity.getType()));
    String linkName = navigation.getProperty().getName();
    EntityCollection results;
    List<Property> properties = new ArrayList<>();
    Map<String, EdmProperty> propertyMap = new HashMap<>();
    for (NavigationKeys keys : this.dataHandler.getNavigationProperties().get(type.getName())
                                               .getNavigationKeys(linkName)) {
        if (parentEntity.getProperty(keys.getPrimaryKey()) != null) {
            Property property = parentEntity.getProperty(keys.getPrimaryKey());
            propertyMap.put(keys.getForeignKey(), (EdmProperty) type.getProperty(property.getName()));
            property.setName(keys.getForeignKey());
            properties.add(property);
        }
    }
    results = createEntityCollectionFromDataEntryList(linkName, dataHandler
            .readTableWithKeys(linkName, wrapPropertiesToDataEntry(type, properties, propertyMap)), url);
    return results;

}
 
开发者ID:wso2,项目名称:carbon-data,代码行数:35,代码来源:ODataAdapter.java


示例13: processUriResource

import org.apache.olingo.server.api.uri.UriResourceNavigation; //导入依赖的package包/类
private void processUriResource(SQLSession connection) throws ODataApplicationException, EdmPrimitiveTypeException {

		for(UriResource segment : uriInfo.getUriResourceParts() ){
			index++;
			if(segment instanceof UriResourceNavigation){				
				UriResourceNavigation uriResourceNavigation = (UriResourceNavigation) segment;
				EdmNavigationProperty edmNavigationProperty = uriResourceNavigation.getProperty();
				Join join = appendFrom(edmNavigationProperty.getType());
				appendOn(connection,join,edmNavigationProperty.getName(),entityType,edmNavigationProperty.getType());
				appendWhere(uriResourceNavigation.getKeyPredicates());
				entityType = edmNavigationProperty.getType();
			}else if (segment instanceof UriResourceEntitySet){				
				UriResourceEntitySet uriResourceEntitySet = (UriResourceEntitySet) segment;
				entityType = uriResourceEntitySet.getEntitySet().getEntityType();			
				appendFrom(entityType);
				appendWhere(uriResourceEntitySet.getKeyPredicates());			
			}else {
				throw new ODataApplicationException(segment.toString(), HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), 
						Locale.ROOT);
			}			
		}
	}
 
开发者ID:jbaliuka,项目名称:sql-analytic,代码行数:23,代码来源:ReadEntityCollectionCommand.java


示例14: writeEntityReference

import org.apache.olingo.server.api.uri.UriResourceNavigation; //导入依赖的package包/类
public static void writeEntityReference(RdfEdmProvider rdfEdmProvider, UriInfo uriInfo,
		List<URI> requestEntityReferences) throws  OData2SparqlException {
	SparqlStatement sparqlStatement = null;
	// 1. Retrieve the entity set which belongs to the requested entity
	List<UriResource> resourcePaths = uriInfo.getUriResourceParts();
	// Note: only in our example we can assume that the first segment is the EntitySet
	UriResourceEntitySet uriResourceEntitySet = (UriResourceEntitySet) resourcePaths.get(0);
	EdmEntitySet edmEntitySet = uriResourceEntitySet.getEntitySet();

	RdfEntityType entityType = rdfEdmProvider.getRdfEntityTypefromEdmEntitySet(edmEntitySet);

	List<UriParameter> keyPredicates = uriResourceEntitySet.getKeyPredicates();
	UriResourceNavigation uriResourceNavigation = (UriResourceNavigation) resourcePaths.get(1);
	RdfAssociation navigationProperty = entityType
			.findNavigationProperty(uriResourceNavigation.getProperty().getName());

	SparqlCreateUpdateDeleteBuilder sparqlCreateUpdateDeleteBuilder = new SparqlCreateUpdateDeleteBuilder(
			rdfEdmProvider);
	try {
		sparqlStatement = sparqlCreateUpdateDeleteBuilder.generateInsertLinkQuery( entityType, keyPredicates,navigationProperty,
				requestEntityReferences);
	} catch (Exception e) {
		log.error(e.getMessage());
		throw new OData2SparqlException(e.getMessage());
	}
	sparqlStatement.executeInsert(rdfEdmProvider);

}
 
开发者ID:peterjohnlawrence,项目名称:com.inova8.odata2sparql.v4,代码行数:29,代码来源:SparqlBaseCommand.java


示例15: updateEntityReference

import org.apache.olingo.server.api.uri.UriResourceNavigation; //导入依赖的package包/类
public static void updateEntityReference(RdfEdmProvider rdfEdmProvider, UriInfo uriInfo,
		List<URI> requestEntityReferences) throws OData2SparqlException {
	SparqlStatement sparqlStatement = null;
	// 1. Retrieve the entity set which belongs to the requested entity
	List<UriResource> resourcePaths = uriInfo.getUriResourceParts();
	// Note: only in our example we can assume that the first segment is the EntitySet
	UriResourceEntitySet uriResourceEntitySet = (UriResourceEntitySet) resourcePaths.get(0);
	EdmEntitySet edmEntitySet = uriResourceEntitySet.getEntitySet();

	RdfEntityType entityType = rdfEdmProvider.getRdfEntityTypefromEdmEntitySet(edmEntitySet);

	List<UriParameter> keyPredicates = uriResourceEntitySet.getKeyPredicates();
	UriResourceNavigation uriResourceNavigation = (UriResourceNavigation) resourcePaths.get(1);
	RdfAssociation navigationProperty = entityType
			.findNavigationProperty(uriResourceNavigation.getProperty().getName());
	List<UriParameter> navigationKeyPredicates = uriResourceNavigation.getKeyPredicates();
	SparqlCreateUpdateDeleteBuilder sparqlCreateUpdateDeleteBuilder = new SparqlCreateUpdateDeleteBuilder(
			rdfEdmProvider);
	try {
		sparqlStatement = sparqlCreateUpdateDeleteBuilder.generateUpdateLinkQuery( entityType, keyPredicates,navigationProperty,navigationKeyPredicates,
				requestEntityReferences);
	} catch (Exception e) {
		log.error(e.getMessage());
		throw new OData2SparqlException(e.getMessage());
	}
	sparqlStatement.executeInsert(rdfEdmProvider);	
}
 
开发者ID:peterjohnlawrence,项目名称:com.inova8.odata2sparql.v4,代码行数:28,代码来源:SparqlBaseCommand.java


示例16: prepareEntityLinksSparql

import org.apache.olingo.server.api.uri.UriResourceNavigation; //导入依赖的package包/类
public SparqlStatement prepareEntityLinksSparql(	) throws EdmException, ODataApplicationException, OData2SparqlException {

		List<UriResource> resourceParts = uriInfo.getUriResourceParts();
		UriResource lastResourcePart = resourceParts.get(resourceParts.size() - 1);
		int minSize = 1;
		if (lastResourcePart.getSegmentValue().equals("$ref")) { // which it should do
			minSize++;
		}
		UriResourceNavigation uriNavigation = (UriResourceNavigation) resourceParts.get(resourceParts.size() - minSize);
		EdmNavigationProperty edmNavigationProperty = uriNavigation.getProperty();

		UrlValidator urlValidator = new UrlValidator();
		String expandedKey =  rdfModel.getRdfPrefixes().expandPredicateKey( ((UriResourceEntitySet) resourceParts.get(0)).getKeyPredicates().get(0).getText());
		
		String key = rdfEntityType.entityTypeName;

		if (urlValidator.isValid(expandedKey)) {
		} else {
			throw new EdmException("Invalid key: " + ((UriResourceEntitySet) resourceParts.get(0)).getKeyPredicates().get(0).getText(), null);
		}
		RdfAssociation rdfProperty = rdfEntityType.findNavigationProperty(edmNavigationProperty.getName());
		String expandedProperty = rdfProperty.getAssociationIRI();
		StringBuilder sparql = new StringBuilder(
				//			"CONSTRUCT {?" + key + "_s <" + expandedProperty + "> ?" + key + "_o . ?"+ key +"_o <http://targetEntity> true . }\n");
				"CONSTRUCT { ?" + key + "_o <http://targetEntity> true . }\n");
		if (rdfProperty.IsInverse()) {
			String expandedInverseProperty = rdfProperty.getInversePropertyOfURI().toString();
			sparql.append(
					"WHERE {?" + key + "_o ?" + key + "_p ?" + key + "_s . \nVALUES(?" + key + "_s ?" + key + "_p){(");
			sparql.append("<" + expandedKey + "> ");
			sparql.append("<" + expandedInverseProperty + ">)}\n}");
		} else {
			sparql.append(
					"WHERE {?" + key + "_s ?" + key + "_p ?" + key + "_o .\n VALUES(?" + key + "_s ?" + key + "_p){(");
			sparql.append("<" + expandedKey + "> ");
			sparql.append("<" + expandedProperty + ">)}\n}");
		}

		return new SparqlStatement(sparql.toString());
	}
 
开发者ID:peterjohnlawrence,项目名称:com.inova8.odata2sparql.v4,代码行数:41,代码来源:SparqlQueryBuilder.java


示例17: handleLambdaAny

import org.apache.olingo.server.api.uri.UriResourceNavigation; //导入依赖的package包/类
/**
 * Analyzes uri parts and creates a member. Lambda has expression that
 * should be executed to get the inner query.
 *
 * @return nested or child expression member
 */
private ExpressionMember handleLambdaAny()
        throws ODataApplicationException, ExpressionVisitException {
    UriResourceLambdaAny lambda = (UriResourceLambdaAny) lastPart;
    Expression expression = lambda.getExpression();

    boolean isNavigationLambdaVar = firstPart instanceof UriResourcePartTyped
            && ((UriResourcePartTyped) firstPart).getType() instanceof EdmEntityType;
    if (firstPart instanceof UriResourceNavigation || isNavigationLambdaVar) {
        boolean isParentNestedLambdaVar = resourceParts.stream()
                .anyMatch(part -> part instanceof UriResourceComplexProperty);
        List<String> navigationTypes = collectNavigationTypes();
        if (isParentNestedLambdaVar) {
            // navigation parent nested collection
            // book?$filter=author/_dimension/any(d:d/name eq 'Validity')
            ExpressionResult lambdaResult = handleLambdaAny(expression);
            return new ParentWrapperMember(navigationTypes, lambdaResult.getQueryBuilder())
                    .any();
        } else {
            if (resourceParts.size() > 2) {
                // navigation parent to another child
                // book?$filter=author/address/any(a:a/city eq 'New York'))
                List<String> parentTypes = navigationTypes.subList(0,
                        navigationTypes.size() - 1);
                return new ParentWrapperMember(parentTypes,
                        handleChildLambda(lambda).getQueryBuilder()).any();
            } else {
                // navigation child property collection
                // author?$filter=book/any(b:b/character/any(c:c/name eq
                // 'Oliver'))
                return handleChildLambda(lambda);
            }
        }
    } else {
        // complex or primitive type collection
        return handleLambdaAny(expression);
    }
}
 
开发者ID:Hevelian,项目名称:hevelian-olastic,代码行数:44,代码来源:MemberHandler.java


示例18: handleChildLambda

import org.apache.olingo.server.api.uri.UriResourceNavigation; //导入依赖的package包/类
private ExpressionResult handleChildLambda(UriResourceLambdaAny lambda)
        throws ExpressionVisitException, ODataApplicationException {
    ExpressionResult lambdaResult = (ExpressionResult) lambda.getExpression().accept(visitor);
    // pre-last resource - before lambda; it's always a collection type
    UriResourceNavigation preLastNavResource = (UriResourceNavigation) resourceParts
            .get(resourceParts.size() - 2);
    ElasticEdmEntityType entityType = (ElasticEdmEntityType) preLastNavResource.getProperty()
            .getType();
    return new ChildMember(entityType.getESType(), lambdaResult.getQueryBuilder()).any();
}
 
开发者ID:Hevelian,项目名称:hevelian-olastic,代码行数:11,代码来源:MemberHandler.java


示例19: getAnnotations

import org.apache.olingo.server.api.uri.UriResourceNavigation; //导入依赖的package包/类
private List<EdmAnnotation> getAnnotations(UriResource uriResource) {
    if (uriResource instanceof UriResourceNavigation) {
        return ((UriResourceNavigation) uriResource).getProperty().getAnnotations();
    } else if (uriResource instanceof UriResourceProperty) {
        return ((UriResourceProperty) uriResource).getProperty().getAnnotations();
    } else {
        return Collections.emptyList();
    }
}
 
开发者ID:Hevelian,项目名称:hevelian-olastic,代码行数:10,代码来源:MemberHandler.java


示例20: getBaseRequestInfo

import org.apache.olingo.server.api.uri.UriResourceNavigation; //导入依赖的package包/类
/**
 * Gets base request info that is need for all requests. It goes through all
 * URI resource parts and build query for each segment, the last entity set
 * from resource segment is metadata entity of type to search. It returns
 * {@link Query} with index, type, and query builder for search, and last
 * entity set from resource parts.
 * 
 * @param uriInfo
 *            URI info
 * @return base request
 * @throws ODataApplicationException
 *             OData app exception
 */
public BaseRequest getBaseRequestInfo(UriInfo uriInfo) throws ODataApplicationException {
    List<UriResource> resourceParts = uriInfo.getUriResourceParts();
    ElasticEdmEntitySet responseEntitySet = (ElasticEdmEntitySet) getFirstResourceEntitySet(
            uriInfo);
    Iterator<UriResource> iterator = resourceParts.iterator();
    while (iterator.hasNext()) {
        UriResource segment = iterator.next();
        if (segment.getKind() == UriResourceKind.primitiveProperty) {
            break;
        }
        if (segment.getKind() == UriResourceKind.navigationProperty) {
            responseEntitySet = getNavigationTargetEntitySet(responseEntitySet,
                    (UriResourceNavigation) segment);
        } else if (segment.getKind() != UriResourceKind.entitySet) {
            throwNotImplemented();
        }
        if (iterator.hasNext()) {
            int nextIndex = resourceParts.indexOf(segment) + 1;
            queryBuilder.addSegmentQuery(segment, resourceParts.get(nextIndex));
        } else {
            queryBuilder.addSegmentQuery(segment, null);
        }
    }
    queryBuilder.addFilter(getFilterQuery(uriInfo)).addFilter(getSearchQuery(uriInfo));
    return new BaseRequest(
            new Query(responseEntitySet.getESIndex(),
                    new String[] { responseEntitySet.getESType() }, queryBuilder.build(), null),
            responseEntitySet, null);
    // TODO: pass pagination info here, and reuse in child (in request
    // creators)
}
 
开发者ID:Hevelian,项目名称:hevelian-olastic,代码行数:45,代码来源:RequestCreator.java



注:本文中的org.apache.olingo.server.api.uri.UriResourceNavigation类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java TimeoutProcessorResponse类代码示例发布时间:2022-05-23
下一篇:
Java RestClientErrorHandling类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap