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

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


            log.warn("Unable to import Entity {} because the ReferencedSite {} is currently not active -> return null",
                remoteEntity.getId(),remoteEntity.getSite());
            return null;
        }
        Yard entityhubYard = lookupYard();
        ValueFactory valueFactory = entityhubYard.getValueFactory();
        //Create the locally managed Entity
        Representation localRep = entityhubYard.create(constructResourceId(DEFAULT_MANAGED_ENTITY_PREFIX));
        Entity localEntity = loadEntity(entityhubYard, localRep);
        importEntity(remoteEntity, site, localEntity, valueFactory);
View Full Code Here


     * @return the mapped representation
     */
    private Representation applyCacheMappings(Yard yard, Representation representation) {
        long start = System.currentTimeMillis();
        Representation mapped = null;
        ValueFactory valueFactory = getValueFactory();
        if (baseMapper != null) {
            mapped = yard.getValueFactory().createRepresentation(representation.getId());
            baseMapper.applyMappings(representation, mapped,valueFactory);
        }
        if (additionalMapper != null) {
View Full Code Here

     * @param headers the http headers of the request
     * @return the response
     */
    private Response executeLDPathQuery(Entityhub entityhub,FieldQuery query, String ldpathProgramString, MediaType mediaType, HttpHeaders headers) {
        QueryResultList<Representation> result;
        ValueFactory vf = new RdfValueFactory(new IndexedMGraph());
        EntityhubBackend backend = new EntityhubBackend(entityhub);
        EntityhubLDPath ldPath = new EntityhubLDPath(backend,vf);
        //copy the selected fields, because we might need to delete some during
        //the preparation phase
        Set<String> selectedFields = new HashSet<String>(query.getSelectedFields());
View Full Code Here

                "prohibited IDs: {} (case insensitive)",siteConfiguration.getId(),
                PROHIBITED_SITE_IDS));
        }
        log.info(" > initialise Referenced Site {}",siteConfiguration.getName());
        siteMetadata = new HashMap<String,Object>();
        ValueFactory vf = InMemoryValueFactory.getInstance();
        if(siteConfiguration.getAttribution() != null){
            siteMetadata.put(NamespaceEnum.cc.getNamespace()+"attributionName",
                vf.createText(siteConfiguration.getAttribution()));
        }
        if(siteConfiguration.getAttributionUrl() != null){
            siteMetadata.put(NamespaceEnum.cc.getNamespace()+"attributionURL",
                vf.createReference(siteConfiguration.getAttributionUrl()));
        }
        //add the licenses
        if(siteConfiguration.getLicenses() != null){
            for(License license : siteConfiguration.getLicenses()){
                if(license.getUrl() != null){
                    siteMetadata.put(NamespaceEnum.cc.getNamespace()+"license",
                        vf.createReference(license.getUrl()));
                } else if(license.getText() != null){
                    siteMetadata.put(NamespaceEnum.cc.getNamespace()+"license",
                        vf.createText(license.getText()));
                }
                //if defined add the name to dc:license
                if(license.getName() != null){
                    siteMetadata.put(NamespaceEnum.dcTerms.getNamespace()+"license",
                        vf.createText(license.getName()));
                }
                //link to the license via cc:license
            }
        }
       
View Full Code Here

     * @throws YardException
     */
    @Test
    public void testRemovalOfTypeRepresentationStatement() throws YardException {
        Yard yard = getYard();
        ValueFactory vf = yard.getValueFactory();
        Reference representationType = vf.createReference(RdfResourceEnum.Representation.getUri());
        Representation test = create();
        //the rdf:type Representation MUST NOT be within the Representation
        Assert.assertFalse(test.get(RDF.type.getUnicodeString()).hasNext());
        //now add the statement and see if an IllegalStateException is thrown
        /*
 
View Full Code Here

     * @param headers the http headers of the request
     * @return the response
     */
    private Response executeLDPathQuery(ReferencedSiteManager manager,FieldQuery query, String ldpathProgramString, MediaType mediaType, HttpHeaders headers) {
        QueryResultList<Representation> result;
        ValueFactory vf = new RdfValueFactory(new IndexedMGraph());
        SiteManagerBackend backend = new SiteManagerBackend(manager);
        EntityhubLDPath ldPath = new EntityhubLDPath(backend,vf);
        //copy the selected fields, because we might need to delete some during
        //the preparation phase
        Set<String> selectedFields = new HashSet<String>(query.getSelectedFields());
View Full Code Here

   
    @Override
    public Program<Object> getParsedProgramByName(String programName) {
        SiteManagerBackend backend = new SiteManagerBackend(referencedSiteManager);
        String ldPathProgram = getProgramByName(programName);
        ValueFactory vf = InMemoryValueFactory.getInstance();
        EntityhubLDPath ldPath = new EntityhubLDPath(backend, vf);
      Program<Object> program = null;
        try {
            program = ldPath.parseProgram(LDPathUtils.constructReader(ldPathProgram));
        } catch (LDPathParseException e) {
View Full Code Here

    @Override
    public Map<String,Collection<?>> executeProgram(String programName, Set<String> contexts) throws LDPathException {
        Map<String,Collection<?>> results = new HashMap<String,Collection<?>>();
        SiteManagerBackend backend = new SiteManagerBackend(referencedSiteManager);
        String ldPathProgram = getProgramByName(programName);
        ValueFactory vf = InMemoryValueFactory.getInstance();
        EntityhubLDPath ldPath = new EntityhubLDPath(backend, vf);
        Program<Object> program = null;
        try {
            program = ldPath.parseProgram(LDPathUtils.constructReader(ldPathProgram));
        } catch (LDPathParseException e) {
            logger.error("Should never happen!!!!!", e);
            return Collections.emptyMap();
        }

        Representation representation;
        for (String context : contexts) {
            representation = ldPath.execute(vf.createReference(context), program);
            Iterator<String> fieldNames = representation.getFieldNames();
            while (fieldNames.hasNext()) {
                String fieldName = fieldNames.next();
                Iterator<Object> valueIterator = representation.get(fieldName);
                Set<Object> values = new HashSet<Object>();
View Full Code Here

     * @param headers the http headers of the request
     * @return the response
     */
    private Response executeLDPathQuery(FieldQuery query, String ldpathProgramString, MediaType mediaType, HttpHeaders headers) {
        QueryResultList<Representation> result;
        ValueFactory vf = new RdfValueFactory(new IndexedMGraph());
        SiteBackend backend = new SiteBackend(site,vf);
        EntityhubLDPath ldPath = new EntityhubLDPath(backend,vf);
        //copy the selected fields, because we might need to delete some during
        //the preparation phase
        Set<String> selectedFields = new HashSet<String>(query.getSelectedFields());
View Full Code Here

TOP

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

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.