@Override protected Representation getRepresentation(Entityhub eh, String id, boolean offlineMode) throws EntityhubException { Entity e = eh.getEntity(id); return e == null ? null : e.getRepresentation(); }
@Override public Collection<? extends Representation> lookup(String field, Set<String> includeFields, List<String> search, String... languages) throws IllegalStateException { Entityhub entityhub = getSearchService(); if(entityhub == null){ throw new IllegalStateException("The Entityhub is currently not active"); } FieldQuery query = EntitySearcherUtils.createFieldQuery(entityhub.getQueryFactory(), field, includeFields, search, languages); QueryResultList<Representation> results; try { results = entityhub.find(query); } catch (EntityhubException e) { throw new IllegalStateException("Exception while searchign for "+ search+'@'+Arrays.toString(languages)+"in the Entityhub", e); } return results.results(); }
public EntityhubBackend(Entityhub entityhub,ValueConverterFactory valueConverter) { super(entityhub.getYard(),valueConverter); }
FieldQueryFactory queryFactory = site == null ? entityhub.getQueryFactory() : site.getQueryFactory(); entityhub.findEntities(query)
@Override protected FieldQuery createFieldQuery(String siteId) { return entityhub.getQueryFactory().createFieldQuery(); }
@Override protected QueryResultList<Representation> performQuery(String siteId, FieldQuery query) throws EntityhubException { return entityhub.find(query); }
/** * Gets an Entity from the configured {@link Site} based on the NER text and type. * * @param ner * @param language * @return * @throws EngineException */ private Entity lookupEntity(Span ner, String language) throws EngineException { Site site = getReferencedSite(); FieldQueryFactory queryFactory = site == null ? entityHub.getQueryFactory() : site.getQueryFactory(); FieldQuery query = queryFactory.createFieldQuery(); Constraint labelConstraint; String namedEntityLabel = ner.getSpan(); labelConstraint = new TextConstraint(namedEntityLabel, false, language, null); query.setConstraint(RDFS_LABEL.getUnicodeString(), labelConstraint); query.setConstraint(RDF_TYPE.getUnicodeString(), new ReferenceConstraint(ner.getAnnotation(NlpAnnotations.NER_ANNOTATION).value().getType() .getUnicodeString())); query.setLimit(1); QueryResultList<Entity> results = site == null ? // if site is NULL entityHub.findEntities(query) : // use the Entityhub site.findEntities(query); // else the referenced site if (results.isEmpty()) return null; // We set the limit to 1 so if it found anything it should contain just 1 entry return results.iterator().next(); }
QueryResultList<Representation> result; try { result = entityhub.find(query); } catch (EntityhubException e) { String message = String.format("Exception while performing the " +
@Override public Representation get(String id,Set<String> includeFields) { if(id == null || id.isEmpty()){ return null; } Entityhub entityhub = getSearchService(); if(entityhub == null){ throw new IllegalStateException("The Entityhub is currently not active"); } Entity entity; try { entity = entityhub.getEntity(id); } catch (EntityhubException e) { throw new IllegalStateException("Exception while getting "+id+ " from the Entityhub",e); } return entity == null ? null : entity.getRepresentation(); } @Override
throw new EntitySearcherException("The Entityhub is currently not active"); FieldQuery query = EntitySearcherUtils.createFieldQuery(entityhub.getQueryFactory(), field, includeFields, search, languages); if(limit != null && limit > 0){ results = entityhub.find(query); } catch (EntityhubException e) { throw new EntitySearcherException("Exception while searchign for "+
@POST @Path("/ldpath") public Response handleLDPathPost( @FormParam(value = "context")Set<String> contexts, @FormParam(value = "ldpath")String ldpath, @Context HttpHeaders headers){ //Entityhub entityhub = ContextHelper.getServiceFromContext(Entityhub.class, servletContext); return handleLDPathRequest(this,new YardBackend(entityhub.getYard()), ldpath, contexts, headers); }
entity = entityhub.getEntity(symbolId); } catch (EntityhubException e) { throw new WebApplicationException(e, INTERNAL_SERVER_ERROR);
resultIt = entityhub.getYard().findRepresentation(query).iterator(); } catch (EntityhubException e) { String message = String.format("Exception while performing the " +
@Override public Entity get(IRI id,Set<IRI> fields, String...languages) throws EntitySearcherException { if(id == null || id.getUnicodeString().isEmpty()){ return null; } Entityhub entityhub = getSearchService(); if(entityhub == null){ throw new EntitySearcherException("The Entityhub is currently not active"); } org.apache.stanbol.entityhub.servicesapi.model.Entity entity; try { entity = entityhub.getEntity(id.getUnicodeString()); } catch (EntityhubException e) { throw new EntitySearcherException("Exception while getting "+id+ " from the Entityhub",e); } if(entity != null){ Set<String> languageSet; if(languages == null || languages.length < 1){ languageSet = null; } else if (languages.length == 1){ languageSet = Collections.singleton(languages[0]); } else { languageSet = new HashSet<String>(Arrays.asList(languages)); } return new EntityhubEntity(entity.getRepresentation(), fields, languageSet); } else { return null; } }
Entity entityType = (site == null) ? this.entityHub.getEntity(typeUri) : site .getEntity(typeUri);
Entity entity = entityhub.getEntity(topic.conceptUri); if (entity == null) { entity = referencedSiteManager.getEntity(topic.conceptUri);
Entity entity = entityhub.getEntity(topic.conceptUri); if (entity == null) { entity = referencedSiteManager.getEntity(topic.conceptUri);