@Override public QueryResultList<Representation> findRepresentation(FieldQuery query) throws YardException, IllegalArgumentException { return yard.findRepresentation(query); }
@Override public QueryResultList<Representation> findRepresentation(FieldQuery query) throws YardException, IllegalArgumentException { return yard.findRepresentation(query); }
@Override public Collection<Entity> getMappingsByTarget(String targetId) throws YardException{ if(targetId == null){ log.warn("NULL parsed as Reference -> call to getMappingsBySymbol ignored (return null)"); return null; } FieldQuery fieldQuery = getQueryFactory().createFieldQuery(); fieldQuery.setConstraint(RdfResourceEnum.mappingTarget.getUri(), new ReferenceConstraint(targetId)); QueryResultList<Representation> resultList = entityhubYard.findRepresentation(fieldQuery); Collection<Entity> mappings = new HashSet<Entity>(); for(Representation rep : resultList){ mappings.add(loadEntity(rep)); } return mappings; }
@Override public Collection<Entity> getMappingsByTarget(String targetId) throws YardException{ if(targetId == null){ log.warn("NULL parsed as Reference -> call to getMappingsBySymbol ignored (return null)"); return null; } FieldQuery fieldQuery = getQueryFactory().createFieldQuery(); fieldQuery.setConstraint(RdfResourceEnum.mappingTarget.getUri(), new ReferenceConstraint(targetId)); QueryResultList<Representation> resultList = entityhubYard.findRepresentation(fieldQuery); Collection<Entity> mappings = new HashSet<Entity>(); for(Representation rep : resultList){ mappings.add(loadEntity(rep)); } return mappings; }
resultIt = entityhub.getYard().findRepresentation(query).iterator(); } catch (EntityhubException e) { String message = String.format("Exception while performing the " +
QueryResultList<Representation> resultList = entityhubYard.findRepresentation(fieldQuery); if(!resultList.isEmpty()){ Iterator<Representation> resultIterator = resultList.iterator();
QueryResultList<Representation> resultList = entityhubYard.findRepresentation(fieldQuery); if(!resultList.isEmpty()){ Iterator<Representation> resultIterator = resultList.iterator();
/** * Same as {@link #testFindText()} but using * {@link Yard#findRepresentation(FieldQuery)} to execute the queries */ @Test public void testFindRepresentationText(){ //init the test data FieldQueryTestData data = getFieldQueryTestData(); //query for all languages and value1 FieldQuery query = getYard().getQueryFactory().createFieldQuery(); query.setConstraint(data.textField, new TextConstraint(data.textValue1.getText())); validateQueryResults(query, getYard().findRepresentation(query), Arrays.asList( data.r1.getId(), data.r1en.getId(), data.r1de.getId()), Arrays.asList(data.textField, data.refField, data.intField)); //same for value2 query = getYard().getQueryFactory().createFieldQuery(); query.setConstraint(data.textField, new TextConstraint(data.textValue2.getText())); validateQueryResults(query, getYard().findRepresentation(query), Arrays.asList( data.r2.getId(), data.r2en.getId(), data.r2de.getId()), Arrays.asList(data.textField, data.refField, data.intField)); } /**
@Override public QueryResultList<Entity> findEntities(FieldQuery query) throws ManagedSiteException { QueryResultList<Representation> results; try { results = getYard().findRepresentation(query); } catch (YardException e) { throw new ManagedSiteException(e.getMessage(), e); } return new QueryResultListImpl<Entity>(results.getQuery(), new AdaptingIterator<Representation,Entity>( results.iterator(), new AdaptingIterator.Adapter<Representation,Entity>() { private final String siteId = config.getId(); @Override public Entity adapt(Representation value, Class<Entity> type) { Entity entity = new EntityImpl(siteId,value,null); SiteUtils.initEntityMetadata(entity, siteMetadata, null); return entity; } }, Entity.class),Entity.class); }