Package org.apache.stanbol.entityhub.servicesapi.model

Examples of org.apache.stanbol.entityhub.servicesapi.model.Entity


    @Override
    public final Entity delete(String id) throws EntityhubException, IllegalArgumentException {
        if(id == null || id.isEmpty()){
            throw new IllegalArgumentException("The parsed id MUST NOT be NULL nor emtpty!");
        }
        Entity entity = loadEntity(id);
        if(entity != null){
            log.debug("delete Entity {} as requested by the parsed id {}",entity.getId(),id);
            //we need to remove all mappings for this Entity
            deleteMappingsbyTarget(entity.getId());
            deleteEntity(entity);
        } else {
            log.debug("Unable to delete Entity for id {}, because no Entity for this id is" +
                "managed by the Entityhub",id);
        }
View Full Code Here


            throw new IllegalStateException("The parsed id MUST NOT be NULL nor empty!");
        }
        if(state == null){
            throw new IllegalStateException("The parsed state for the Entity MUST NOT ne NULL");
        }
        Entity entity = loadEntity(id);
        if(entity != null){
            ManagedEntity managed = new ManagedEntity(entity);
            if(managed.getState() != state){
                managed.setState(state);
                storeEntity(entity);
View Full Code Here

            return null;
        }
        ValueFactory valueFactory = entityhubYard.getValueFactory();
        //Create the locally managed Entity
        Representation localRep = entityhubYard.create(constructResourceId(DEFAULT_MANAGED_ENTITY_PREFIX));
        Entity localEntity = loadEntity(localRep);
        importEntity(remoteEntity, site, localEntity, valueFactory);

        //Second create and init the Mapping
        Representation entityMappingRepresentation = entityhubYard.create(
            constructResourceId(DEFAULT_MAPPING_PREFIX));
        Entity entityMappingEntity = loadEntity(entityMappingRepresentation);
        establishMapping(localEntity, remoteEntity, site, entityMappingEntity);
       
        //Store the entity and the mappedEntity in the entityhubYard
        storeEntity(localEntity);
        storeEntity(entityMappingEntity);
View Full Code Here

        FieldQuery fieldQuery = getQueryFactory().createFieldQuery();
        fieldQuery.setConstraint(RdfResourceEnum.mappingSource.getUri(), new ReferenceConstraint(reference));
        QueryResultList<Representation> resultList = entityhubYard.findRepresentation(fieldQuery);
        if(!resultList.isEmpty()){
            Iterator<Representation> resultIterator = resultList.iterator();
            Entity mapping = loadEntity(resultIterator.next());
           //print warnings in case of multiple mappings
            if(resultIterator.hasNext()){
                log.warn("Multiple Mappings found for Entity {}!",reference);
                log.warn("  > {} -> returned instance",mapping.getId());
                while(resultIterator.hasNext()){
                    log.warn("  > {} -> ignored",resultIterator.next());
                }
            }
            if(!EntityMapping.isValid(mapping)){
View Full Code Here

    @Override
    public final Entity getMappingById(String id) throws IllegalArgumentException, EntityhubException{
        if(id == null || id.isEmpty()){
            throw new IllegalArgumentException("The parsed id MUST NOT be NULL nor empty");
        }
        Entity mapping = loadEntity(id);
        if(mapping == null){
            return null;
        } else if(mapping != null && EntityMapping.isValid(mapping)){
            return mapping;
        } else {
View Full Code Here

    @Override
    public final QueryResultList<Entity> findEntities(FieldQuery query) throws YardException{
        QueryResultList<String> references = entityhubYard.findReferences(query);
        List<Entity> entities = new ArrayList<Entity>(references.size());
        for(String reference : references){
            Entity entity = lookupLocalEntity(reference);
            if(entity != null){
                entities.add(entity);
            } else {
                log.warn("Unable to create Entity for Reference {} in the Yard " +
                    "usd by the entity hub [id={}] -> ignore reference",
View Full Code Here

                    .header(HttpHeaders.ACCEPT, acceptedMediaType).build();
            }
        }
        SiteManager referencedSiteManager = ContextHelper.getServiceFromContext(
            SiteManager.class, servletContext);
        Entity sign = referencedSiteManager.getEntity(id);
        if (sign != null) {
            ResponseBuilder rb = Response.ok(sign);
            rb.header(HttpHeaders.CONTENT_TYPE, acceptedMediaType+"; charset=utf-8");
            addCORSOrigin(servletContext, rb, headers);
            return rb.build();
View Full Code Here

    protected FieldQuery createQuery() {
        return site.getQueryFactory().createFieldQuery();
    }
    @Override
    protected Representation getRepresentation(String id) throws EntityhubException {
        Entity entity = site.getEntity(id);
        return entity != null ? entity.getRepresentation():null;
    }
View Full Code Here

    protected FieldQuery createQuery() {
        return qf.createFieldQuery();
    }
    @Override
    protected Representation getRepresentation(String id) throws EntityhubException {
        Entity entity = siteManager.getEntity(id);
        return entity != null ? entity.getRepresentation() : null;
    }
View Full Code Here

        super(context,Entityhub.class,null,customizer, executorServiceProvider);
    }
   
    @Override
    protected Representation getRepresentation(Entityhub eh, String id, boolean offlineMode) throws EntityhubException {
        Entity e = eh.getEntity(id);
        return e == null ? null : e.getRepresentation();
    }
View Full Code Here

TOP

Related Classes of org.apache.stanbol.entityhub.servicesapi.model.Entity

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.