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

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


        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


     */
    @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

     */
    @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(NamespaceEnum.rdf+"type").hasNext());
        //now add the statement and see if an IllegalStateException is thrown
        /*
 
View Full Code Here

     * Entiries of the geonames ontology.
     * @param refString the string reference
     * @return the {@link Reference} for the parsed String
     */
    public static Reference getReference(String refString){
        Reference ref = indexDocRefs.get(refString);
        if(ref == null){
            ref = valueFactory.createReference(refString);
            indexDocRefs.put(refString, ref);
        }
        return ref;
View Full Code Here

        throw new UnsupportedOperationException("This implementation requries data to process the score");
    }

    @Override
    public Float process(Representation entity) throws UnsupportedOperationException {
        Reference ref = entity.getFirstReference(GeonamesPropertyEnum.gn_featureClass.toString());
        String fclass = ref == null ? null : ref.getReference();
        //ref = entity.getFirstReference(GeonamesPropertyEnum.gn_featureCode.toString());
        //String fCode = ref == null ? null : ref.getReference();
       
        if(FCLASS_A.equals(fclass)){
            ref = entity.getFirstReference(GeonamesPropertyEnum.gn_featureCode.toString());
            String fcode = ref == null ? null : ref.getReference();
            if(fcode == null){
                return DEFAULT_SCORE;
            } else {
                fcode = fcode.substring(GEONAMES_ONTOLOGY_NS.length()+2);
                if(fcode.length() > 2 && fcode.startsWith("PC")){
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

    }

    @Test
    public void testUriReference() throws URISyntaxException {
        URI refObject = new URI("http://www.test.org/uriTest");
        Reference ref = testRef(refObject);
        assertEquals(ref.getReference(), refObject.toString());
    }
View Full Code Here

    }

    @Test
    public void testURLReference() throws MalformedURLException {
        URL refObject = new URL("http://www.test.org/urlTest");
        Reference ref = testRef(refObject);
        assertEquals(ref.getReference(), refObject.toString());
    }
View Full Code Here

     *            the object representing the reference
     * @return the created {@link Reference} that can be used to perform further tests.
     */
    private Reference testRef(Object refObject) {
        ValueFactory vf = getValueFactory();
        Reference ref = vf.createReference(refObject);
        // check not null
        assertNotNull(ref);
        // check reference is not null
        assertNotNull(ref.getReference());
        return ref;
    }
View Full Code Here

        rep.addReference(field, strRef);
        assertTrue(asCollection(rep.getFieldNames()).contains(field));
        rep.removeReference(field, strRef);
        assertFalse(asCollection(rep.getFieldNames()).contains(field));

        Reference ref = vf.createReference("urn:testValue2");
        rep.add(field, ref);
        assertTrue(asCollection(rep.getFieldNames()).contains(field));
        rep.remove(field, ref);
        assertFalse(asCollection(rep.getFieldNames()).contains(field));
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.