Code example for URI

Methods: getFragment, toString

0
        projectURI = createObject(baseUrl, adminUser, client, newProjectOntology);
        // Project - Genotype 
        final URI genotypeURI = addObjectToParent("new-genotype.rdf", "new-genotype", projectURI,
            PODD_MODEL.HAS_GENOTYPE.getURI()); 
        // edit the project  
        File editProjectOntology = loadAndModifyRDF(loadRdf("edit-project.rdf"), "OBJECT_URI", projectURI);
        fileCleaner.addFile(editProjectOntology);
        login(baseUrl, adminUser, client);
        PostMethod post = new PostMethod(baseUrl + "/services/editObject");
        Part[] parts = {
            new StringPart("URI", projectURI.toString()),
            new FilePart("ontology", editProjectOntology)
        }; 
        post.setRequestEntity(new MultipartRequestEntity(parts, post.getParams()));
         
        // Check to see that the genotype object still exists as a child in the project ontology 
        PoddObject projectObject = OBJECT_DAO.load(projectURI.getFragment());
        OWLOntology ontology = projectObject.getCurrentRelations();
        OWLIndividual genotypeIndividual = ontologyHelper.getFirstObjectAssertionValue(ontology, projectURI, PoddModelNamespace.PODD_MODEL.HAS_GENOTYPE.getURI());
        assertEquals(genotypeURI, genotypeIndividual.getURI());
         
    }     
     
     
    private URI addObjectToParent(String filename, String objectId, URI parentURI, URI relationship)
        throws IOException, JSONException { 
        File file = loadAndModifyRDF(loadRdf(filename), "PARENT_URI", parentURI);
         
        if (null != file) {
        	fileCleaner.addFile(file);
            return createChildObject(baseUrl, adminUser, client, file, objectId, relationship);
        }