Package org.openrdf.repository

Examples of org.openrdf.repository.RepositoryConnection.begin()


    @Test
    public void testFoafWikier() throws Exception {
        ClientResponse response = ldclient.retrieveResource(WIKIER);

        RepositoryConnection conn = response.getTriples().getConnection();
        conn.begin();
        Assert.assertTrue(conn.size() > 0);

        // run a SPARQL test to see if the returned data is correct
        InputStream sparql = this.getClass().getResourceAsStream("foaf-wikier.sparql");
        BooleanQuery testLabel = conn.prepareBooleanQuery(QueryLanguage.SPARQL, IOUtils.toString(sparql, "UTF-8"));
View Full Code Here


    @Override
    public void deleteContent(Resource resource, String mimetype) throws IOException {
        try {
            RepositoryConnection conn = sesameService.getConnection();
            try {
                conn.begin();
                MediaContentItem mci = FacadingFactory.createFacading(conn).createFacade(resource, MediaContentItem.class);

                String path = mci.getContentPath();
                if(path != null) {
                    if(!path.startsWith(defaultDir)) {
View Full Code Here

    @Override
    public void setContentStream(Resource resource, InputStream in, String mimetype) throws IOException {
        try {
            RepositoryConnection conn = sesameService.getConnection();
            try {
                conn.begin();
                MediaContentItem mci = FacadingFactory.createFacading(conn).createFacade(resource, MediaContentItem.class);

                String path = mci.getContentPath();

                if(path == null) {
View Full Code Here

        Assert.assertEquals(2,asList(ldcache.listCacheEntries()).size());

        RepositoryConnection con2 = ldcache.getCacheConnection(uri2);
        try {
            con2.begin();
            Assert.assertEquals(2, asList(con2.getStatements(con2.getValueFactory().createURI(uri2), null, null, false)).size());
            con2.commit();
        } finally {
            con2.close();
        }
View Full Code Here

        Assert.assertEquals(3,asList(ldcache.listCacheEntries()).size());

        RepositoryConnection con3 = ldcache.getCacheConnection(uri3);
        try {
            con3.begin();
            Assert.assertEquals(2, asList(con3.getStatements(con3.getValueFactory().createURI(uri3), null, null, false)).size());
            con3.commit();
        } finally {
            con3.close();
        }
View Full Code Here

        String uri2 = "http://remote/resource2";
        String uri3 = "http://remote/resource3";

        RepositoryConnection con = repository.getConnection();
        try {
            con.begin();

            List<Statement> list1 = asList(con.getStatements(con.getValueFactory().createURI(uri1), null, null, true));

            Assert.assertEquals(3,list1.size());
            Assert.assertThat(list1, allOf(
View Full Code Here

            ));


            con.commit();

            con.begin();

            List<Statement> list2 = asList(con.getStatements(con.getValueFactory().createURI(uri2), null, null, true));

            Assert.assertEquals(2, list2.size());
            Assert.assertThat(list2, allOf(
View Full Code Here

            ));


            con.commit();

            con.begin();

            List<Statement> list3 = asList(con.getStatements(con.getValueFactory().createURI(uri3), null, null, true));

            Assert.assertEquals(2, list3.size());
            Assert.assertThat(list3, allOf(
View Full Code Here

                String webId_str = buildUserUri(login);

                try {
                    RepositoryConnection conn = sesameService.getConnection();
                    try {
                        conn.begin();
                        URI webId = conn.getValueFactory().createURI(webId_str);

                        log.info("creating user with webId: {} ", webId.stringValue());

                        if (!login.equals(ANONYMOUS_LOGIN) && !login.equals(ADMIN_LOGIN)) {
View Full Code Here

     */
    private URI getUserByLogin(String login) {
        try {
            RepositoryConnection conn = sesameService.getConnection();
            try {
                conn.begin();
                String userUri = buildUserUri(login);
                if (ResourceUtils.existsResource(conn, userUri))
                    return conn.getValueFactory().createURI(userUri);
                else
                    return null;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.