Package org.openrdf.repository

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


        boolean result = false;
        try {
            RepositoryConnection connection = sesameService.getConnection();
            try {
                connection.begin();
                BooleanQuery ask = connection.prepareBooleanQuery(queryLanguage, query);
                result = ask.evaluate();
                connection.commit();
            } catch (MalformedQueryException e) {
                throw new MarmottaException("malformed query, update failed",e);
View Full Code Here


    public List<URI> listContexts(boolean filter) {
        List<URI> contexts = new ArrayList<URI>();
        try {
            RepositoryConnection conn = sesameService.getConnection();
            try {
                conn.begin();
                RepositoryResult<Resource> result = conn.getContextIDs();
                while(result.hasNext()) {
                    Resource next = result.next();
                    if(next instanceof URI) {
                        URI uri = (URI)next;
View Full Code Here

    @Override
    public URI createContext(String uri, String label) {
        try {
            RepositoryConnection conn = sesameService.getConnection();
            try {
                conn.begin();
                checkConnectionNamespace(conn);
                ValueFactory valueFactory = conn.getValueFactory();
        URI ctx = valueFactory.createURI(uri);
                if (StringUtils.isNotBlank(label)) {
                    conn.add(ctx, RDFS.LABEL, Literals.createLiteral(valueFactory, label), ctx);
View Full Code Here

    @Override
    public URI getContext(String context_uri) {
        try {
            RepositoryConnection conn = sesameService.getConnection();
            try {
                conn.begin();
                checkConnectionNamespace(conn);
                if (ResourceUtils.isContext(conn, context_uri)) return conn.getValueFactory().createURI(context_uri);
            } finally {
                conn.commit();
                conn.close();
View Full Code Here

    @Override
    public String getContextLabel(URI context) {
        try {
            RepositoryConnection conn = sesameService.getConnection();
            try {
                conn.begin();
                return ResourceUtils.getLabel(conn, context);
            } finally {
                conn.commit();
                conn.close();
            }
View Full Code Here

    @Override
    public boolean importContent(String context, InputStream is, String format) {
        try {
            RepositoryConnection conn = sesameService.getConnection();
            try {
                conn.begin();
                checkConnectionNamespace(conn);
                URI ctx = conn.getValueFactory().createURI(context);
                int imported = importService.importData(is, format, userService.getCurrentUser(), ctx);
                return imported > 0;
            } catch (MarmottaImportException e) {
View Full Code Here

    private Response getMeta(String resource, String mimetype) throws UnsupportedEncodingException {
        try {
            RepositoryConnection conn = sesameService.getConnection();

            try {
                conn.begin();
               
                Resource r = null;
              if (UriUtil.validate(resource)) {
                    r = ResourceUtils.getUriResource(conn, resource);
              } else {
View Full Code Here

                            // FIXME: This method is executed AFTER the @Transactional!
                            RDFWriter writer = Rio.createWriter(serializer,output);
                            try {
                                RepositoryConnection connection = sesameService.getConnection();
                                try {
                                    connection.begin();
                                    connection.exportStatements(subject,null,null,true,writer);
                                } finally {
                                    connection.commit();
                                    connection.close();
                                }
View Full Code Here

    @Override
    public boolean removeContext(String context_uri) {
        try {
            RepositoryConnection conn = sesameService.getConnection();
            try {
                conn.begin();
                URI context = conn.getValueFactory().createURI(context_uri);
                conn.remove((Resource)null, null, null, context);
                return true;
            } finally {
                conn.commit();
View Full Code Here

    @Override
    public boolean removeContext(URI context) {
        try {
            RepositoryConnection conn = sesameService.getConnection();
            try {
                conn.begin();
                conn.remove((Resource)null, null, null, context);
                return true;
            } finally {
                conn.commit();
                conn.close();
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.