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

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


    @Test
    public void testMultipleAddAndRemove() throws MalformedURLException, URISyntaxException {
        String field = "urn:the.field:used.for.this.Test";
        ValueFactory vf = getValueFactory();
        Representation rep = createRepresentation(null);
        Reference ref = vf.createReference("http://www.test.org/test");
        Text text = vf.createText("test", "en");
        Integer i = 42;
        Double d = Math.PI;
        URI uri = new URI("http://www.test.org/uriTest");
        URL url = new URL("http://www.test.org/urlTest");
View Full Code Here


            rep.addReference(field, ref);
        }
        Iterator<Reference> refIterator = rep.getReferences(field);
        assertNotNull(refIterator);
        while (refIterator.hasNext()) {
            Reference ref = refIterator.next();
            assertTrue(refs.remove(ref.getReference()));
        }
        assertTrue(refs.isEmpty());
    }
View Full Code Here

     */
    public static boolean canWrap(Entity entity) {
        //check the metadata for
        //if the entity is managed locally
        //if the entity has an state
        Reference stateUri = entity.getMetadata().getFirstReference(STATE);
        if(stateUri == null ||
                !ManagedEntityState.isState(stateUri.getReference())){
            return false;
        }
        //check the about
        String entityId = ModelUtils.getAboutRepresentation(entity.getMetadata());
        if(entityId == null || !entityId.equals(entity.getRepresentation().getId())){
View Full Code Here

     * @param defaultState the default state used if no one is yet defined for
     * this entity
     * @return the wrapped entity
     */
    public static ManagedEntity init(Entity entity, ManagedEntityState defaultState){
        Reference stateUri = entity.getMetadata().getFirstReference(STATE);
        if(stateUri == null ||
                !ManagedEntityState.isState(stateUri.getReference())){
            entity.getMetadata().setReference(STATE, defaultState.getUri());
        }
        String entityId = ModelUtils.getAboutRepresentation(entity.getMetadata());
        if(entityId == null){
            entity.getMetadata().setReference(
View Full Code Here

    /**
     * Getter for the state of this symbol
     * @return the state
     */
    public final ManagedEntityState getState() {
        Reference stateUri = metadata.getFirstReference(STATE);
        if(stateUri != null){
            if(ManagedEntityState.isState(stateUri.getReference())){
                return ManagedEntityState.getState(stateUri.getReference());
            } else {
                log.warn("Value {} for field {} is not a valied SymbolState! -> return null",
                    stateUri,STATE);
                return null;
            }
View Full Code Here

        for(Iterator<String> fields = rep.getFieldNames();fields.hasNext();){
            String field = fields.next();
            Iterator<Reference> values = rep.getReferences(field);
//            assertTrue(values.hasNext());
            while(values.hasNext()){
                Reference ref = values.next();
                assertNotNull(ref);
            }
        }
    }
View Full Code Here

     */
    public static boolean canWrap(Entity entity) {
        //check the metadata for
        //if the entity is managed locally
        //if the entity has an state
        Reference stateUri = entity.getMetadata().getFirstReference(STATE);
        if(stateUri == null ||
                !ManagedEntityState.isState(stateUri.getReference())){
            return false;
        }
        //check the about
        String entityId = ModelUtils.getAboutRepresentation(entity.getMetadata());
        if(entityId == null || !entityId.equals(entity.getRepresentation().getId())){
View Full Code Here

     * @param defaultState the default state used if no one is yet defined for
     * this entity
     * @return the wrapped entity
     */
    public static ManagedEntity init(Entity entity, ManagedEntityState defaultState){
        Reference stateUri = entity.getMetadata().getFirstReference(STATE);
        if(stateUri == null ||
                !ManagedEntityState.isState(stateUri.getReference())){
            entity.getMetadata().setReference(STATE, defaultState.getUri());
        }
        String entityId = ModelUtils.getAboutRepresentation(entity.getMetadata());
        if(entityId == null){
            entity.getMetadata().setReference(
View Full Code Here

    /**
     * Getter for the state of this symbol
     * @return the state
     */
    public final ManagedEntityState getState() {
        Reference stateUri = metadata.getFirstReference(STATE);
        if(stateUri != null){
            if(ManagedEntityState.isState(stateUri.getReference())){
                return ManagedEntityState.getState(stateUri.getReference());
            } else {
                log.warn("Value {} for field {} is not a valied SymbolState! -> return null",
                    stateUri,STATE);
                return null;
            }
View Full Code Here

    }

    @Test
    public void testStringReference() {
        Object refObject = "urn:test.1";
        Reference ref = testRef(refObject);
        assertEquals(ref.getReference(), refObject);
    }
View Full Code Here

TOP

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

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.