Package org.openrdf.repository

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


            public Boolean call() throws Exception {
                long start = System.currentTimeMillis();
                try {
                    RepositoryConnection connection = sesameService.getConnection();
                    try {
                        connection.begin();
                        Query sparqlQuery = connection.prepareQuery(queryLanguage, query);

                        if (sparqlQuery instanceof TupleQuery) {
                            query((TupleQuery) sparqlQuery, tupleWriter);
                        } else if (sparqlQuery instanceof BooleanQuery) {
View Full Code Here


            try {
                uri = URLDecoder.decode(uri, "utf-8");

                RepositoryConnection conn = sesameService.getConnection();
                try {
                    conn.begin();
                    URI resource = ResourceUtils.getUriResource(conn,uri);
                    conn.commit();

                    if(resource != null) return Response.ok()
                            .header("Allow","PUT, GET, DELETE")
View Full Code Here

            public Boolean call() throws Exception {
                long start = System.currentTimeMillis();
                try {
                    RepositoryConnection connection = sesameService.getConnection();
                    try {
                        connection.begin();
                        Query sparqlQuery = connection.prepareQuery(language, query);

                        if (sparqlQuery instanceof TupleQuery) {
                            query((TupleQuery)sparqlQuery, output, format);
                        } else if (sparqlQuery instanceof BooleanQuery) {
View Full Code Here

        else {
            try {
                uri = URLDecoder.decode(uri, "utf-8");
                RepositoryConnection conn = sesameService.getConnection();
                try {
                    conn.begin();
                    URI resource = ResourceUtils.getUriResource(conn,uri);
                    conn.commit();


                    if(resource != null) return Response.ok()
View Full Code Here

    // **************** POST (Generic)
    private Response post(String uri, boolean remote) throws UnsupportedEncodingException {
        try {
            RepositoryConnection conn = sesameService.getConnection();
            try {
                conn.begin();
                String location = remote ? configurationService.getServerUri() + ConfigurationService.RESOURCE_PATH + "?uri=" + uri : uri;
                Response.Status status;
                if (ResourceUtils.getUriResource(conn,uri) != null) {
                    status = Status.OK;
                } else {
View Full Code Here

        List<Map<String,Value>> result = new LinkedList<Map<String, Value>>();

        try {
            RepositoryConnection connection = sesameService.getConnection();
            try {
                connection.begin();
                TupleQuery tupleQuery = connection.prepareTupleQuery(queryLanguage, query);
                TupleQueryResult r = tupleQuery.evaluate();
                try {
                    while (r.hasNext()) {
                        BindingSet s = r.next();
View Full Code Here

    private Response get(String resource, String types) throws URISyntaxException, UnsupportedEncodingException {
        try {

            RepositoryConnection conn = sesameService.getConnection();
            try {
                conn.begin();
                Resource r = null;
              if (UriUtil.validate(resource)) {
                    try {
                      if(ResourceUtils.isSubject(conn, resource)) {  //tests if a resource is used as subject
                            r = ResourceUtils.getUriResource(conn, resource);
View Full Code Here

            if (bestType != null) {
                if (configurationService.getBooleanConfiguration("linkeddata.redirect.put", true)) {
                    final RepositoryConnection con = sesameService.getConnection();
                    try {
                        con.begin();
                        URI resource = ResourceUtils.getUriResource(con, uri);
                        con.commit();
                        return Response
                                .status(configurationService.getIntConfiguration("linkeddata.redirect.status", 303))
                                // .location(new URI(configurationService.getBaseUri() +
View Full Code Here

        log.debug("executing SPARQL update:\n{}", query);

        try {
            RepositoryConnection connection = sesameService.getConnection();
            try {
                connection.begin();
                Update update = connection.prepareUpdate(queryLanguage,query,configurationService.getBaseUri());
                update.execute();
                connection.commit();
            } catch (UpdateExecutionException e) {
                connection.rollback();
View Full Code Here

        if (uri != null) {
            try {
                RepositoryConnection conn = sesameService.getConnection();
                try {
                    conn.begin();
                    Resource resource = ResourceUtils.getUriResource(conn,URLDecoder.decode(uri, "utf-8"));
                    if (resource != null) {
                        ResourceUtils.removeResource(conn,resource);
                        return Response.ok().build();
                    } else
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.