Repository: incubator-rya Updated Branches: refs/heads/develop 6cd8aeb71 -> 19e2e438c
RYA-4 Adding Vagrant Example and Documentation Project: http://git-wip-us.apache.org/repos/asf/incubator-rya/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-rya/commit/22f82c7a Tree: http://git-wip-us.apache.org/repos/asf/incubator-rya/tree/22f82c7a Diff: http://git-wip-us.apache.org/repos/asf/incubator-rya/diff/22f82c7a Branch: refs/heads/develop Commit: 22f82c7abdb53cd16a6c6f77cf605cc8fae5de7e Parents: 4b7bd4f Author: Aaron Mihalik <[email protected]> Authored: Sun Nov 22 17:50:19 2015 -0500 Committer: Aaron Mihalik <[email protected]> Committed: Thu Jan 28 11:29:05 2016 -0500 ---------------------------------------------------------------------- .gitignore | 2 + README.md | 4 + .../java/mvm/rya/indexing/RyaSailFactory.java | 84 ------ .../rya/sail/config/RyaAccumuloSailConfig.java | 161 +++++++++++ .../rya/sail/config/RyaAccumuloSailFactory.java | 92 +++++++ .../mvm/rya/sail/config/RyaSailFactory.java | 84 ++++++ .../org.openrdf.sail.config.SailFactory | 1 + .../repository/config/RyaAccumuloSail.ttl | 20 ++ .../external/AccumuloIndexSetTest2.java | 2 +- .../PrecompJoinOptimizerIntegrationTest.java | 10 +- .../sail/config/RyaAccumuloSailFactoryTest.java | 196 ++++++++++++++ extras/indexingExample/pom.xml | 10 - .../src/main/java/EntityDirectExample.java | 10 +- .../src/main/java/MongoRyaDirectExample.java | 2 +- .../src/main/java/RyaDirectExample.java | 14 +- extras/pom.xml | 1 + .../blueprints/impls/sail/log4j.properties | 33 +++ .../src/test/resources/log4j.properties | 29 -- extras/vagrantExample/pom.xml | 46 ++++ .../main/resources/create-RyaAccumuloSail.xsl | 138 ++++++++++ .../src/main/resources/create.xsl | 128 +++++++++ .../vagrantExample/src/main/vagrant/Vagrantfile | 268 +++++++++++++++++++ .../vagrantExample/src/main/vagrant/readme.md | 183 +++++++++++++ .../RdfCloudTripleStoreFactory.java | 56 ---- .../RdfCloudTripleStoreSailConfig.java | 133 --------- .../META-INF/org.openrdf.store.schemas | 1 - .../META-INF/schemas/cloudbasestore-schema.ttl | 20 -- .../org.openrdf.sail.config.SailFactory | 1 - 28 files changed, 1372 insertions(+), 357 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/22f82c7a/.gitignore ---------------------------------------------------------------------- diff --git a/.gitignore b/.gitignore index 03bf991..2d84f25 100644 --- a/.gitignore +++ b/.gitignore @@ -57,3 +57,5 @@ shiftone-jrat.jar blueprints.log MANIFEST.MF delme* + +**/.vagrant/ http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/22f82c7a/README.md ---------------------------------------------------------------------- diff --git a/README.md b/README.md index 7869bef..476eba5 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,10 @@ Since the data encodings changed in the 3.2.2 release, you will need to run the hadoop jar accumulo.rya-mr.jar mvm.rya.accumulo.mr.upgrade.Upgrade322Tool -Dac.instance={} -Dac.username={} -Dac.pwd={} ``` +## Quick Start VM + +A quickstart Vagrant VM is availible [here](extras/vagrantExample/src/main/vagrant) + ## Quick Start This tutorial will outline the steps needed to get quickly started with the Rya store using the web based endpoint. http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/22f82c7a/extras/indexing/src/main/java/mvm/rya/indexing/RyaSailFactory.java ---------------------------------------------------------------------- diff --git a/extras/indexing/src/main/java/mvm/rya/indexing/RyaSailFactory.java b/extras/indexing/src/main/java/mvm/rya/indexing/RyaSailFactory.java deleted file mode 100644 index 646aab0..0000000 --- a/extras/indexing/src/main/java/mvm/rya/indexing/RyaSailFactory.java +++ /dev/null @@ -1,84 +0,0 @@ -package mvm.rya.indexing; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - - -import mvm.rya.accumulo.AccumuloRdfConfiguration; -import mvm.rya.accumulo.AccumuloRyaDAO; -import mvm.rya.api.RdfCloudTripleStoreConfiguration; -import mvm.rya.api.persist.RyaDAOException; -import mvm.rya.indexing.accumulo.ConfigUtils; -import mvm.rya.mongodb.MongoDBRdfConfiguration; -import mvm.rya.mongodb.MongoDBRyaDAO; -import mvm.rya.rdftriplestore.RdfCloudTripleStore; - -import org.apache.accumulo.core.client.AccumuloException; -import org.apache.accumulo.core.client.AccumuloSecurityException; -import org.apache.accumulo.core.client.Connector; -import org.apache.hadoop.conf.Configuration; -import org.openrdf.sail.Sail; - -public class RyaSailFactory { - - - - public static Sail getInstance(Configuration conf) throws AccumuloException, - AccumuloSecurityException, RyaDAOException { - - return getRyaSail(conf); - } - - - - private static Sail getRyaSail(Configuration config) throws AccumuloException, AccumuloSecurityException, RyaDAOException { - - RdfCloudTripleStore store = new RdfCloudTripleStore(); - if (ConfigUtils.getUseMongo(config)) { - MongoDBRdfConfiguration conf = new MongoDBRdfConfiguration(config); - conf.setTablePrefix(config.get(RdfCloudTripleStoreConfiguration.CONF_TBL_PREFIX)); - ConfigUtils.setIndexers(conf); - - MongoDBRyaDAO crdfdao = new MongoDBRyaDAO(conf); - crdfdao.init(); - - conf.setDisplayQueryPlan(true); - store.setRyaDAO(crdfdao); - } else { - Connector connector = ConfigUtils.getConnector(config); - AccumuloRyaDAO crdfdao = new AccumuloRyaDAO(); - crdfdao.setConnector(connector); - - AccumuloRdfConfiguration conf = new AccumuloRdfConfiguration(config); - conf.setTablePrefix(config.get(RdfCloudTripleStoreConfiguration.CONF_TBL_PREFIX)); // sets - // TablePrefixLayoutStrategy - ConfigUtils.setIndexers(conf); - conf.setDisplayQueryPlan(true); - - crdfdao.setConf(conf); - crdfdao.init(); - store.setRyaDAO(crdfdao); - } - - return store; - } - - - -} http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/22f82c7a/extras/indexing/src/main/java/mvm/rya/sail/config/RyaAccumuloSailConfig.java ---------------------------------------------------------------------- diff --git a/extras/indexing/src/main/java/mvm/rya/sail/config/RyaAccumuloSailConfig.java b/extras/indexing/src/main/java/mvm/rya/sail/config/RyaAccumuloSailConfig.java new file mode 100644 index 0000000..e7872a0 --- /dev/null +++ b/extras/indexing/src/main/java/mvm/rya/sail/config/RyaAccumuloSailConfig.java @@ -0,0 +1,161 @@ +package mvm.rya.sail.config; + +/* + * #%L + * mvm.rya.rya.sail.impl + * %% + * Copyright (C) 2014 Rya + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ + +import mvm.rya.accumulo.AccumuloRdfConfiguration; + +import org.openrdf.model.Graph; +import org.openrdf.model.Literal; +import org.openrdf.model.Resource; +import org.openrdf.model.URI; +import org.openrdf.model.ValueFactory; +import org.openrdf.model.impl.ValueFactoryImpl; +import org.openrdf.model.util.GraphUtil; +import org.openrdf.model.util.GraphUtilException; +import org.openrdf.sail.config.SailConfigException; +import org.openrdf.sail.config.SailImplConfigBase; + +public class RyaAccumuloSailConfig extends SailImplConfigBase { + + public static final String NAMESPACE = "http://rya.apache.org/RyaAccumuloSail/Config#"; + + public static final URI INSTANCE; + public static final URI USER; + public static final URI PASSWORD; + public static final URI ZOOKEEPERS; + public static final URI IS_MOCK; + + static { + ValueFactory factory = ValueFactoryImpl.getInstance(); + USER = factory.createURI(NAMESPACE, "user"); + PASSWORD = factory.createURI(NAMESPACE, "password"); + INSTANCE = factory.createURI(NAMESPACE, "instance"); + ZOOKEEPERS = factory.createURI(NAMESPACE, "zookeepers"); + IS_MOCK = factory.createURI(NAMESPACE, "isMock"); + } + + private String user = "root"; + private String password = "root"; + private String instance = "dev"; + private String zookeepers = "zoo1,zoo2,zoo3"; + private boolean isMock = false; + + public RyaAccumuloSailConfig() { + super(RyaAccumuloSailFactory.SAIL_TYPE); + } + + public String getUser() { + return user; + } + + public void setUser(String user) { + this.user = user; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getInstance() { + return instance; + } + + public void setInstance(String instance) { + this.instance = instance; + } + + public String getZookeepers() { + return zookeepers; + } + + public void setZookeepers(String zookeepers) { + this.zookeepers = zookeepers; + } + + public boolean isMock() { + return isMock; + } + + public void setMock(boolean isMock) { + this.isMock = isMock; + } + + public AccumuloRdfConfiguration toRdfConfiguation() { + AccumuloRdfConfiguration conf = new AccumuloRdfConfiguration(); + return conf; + } + + @Override + public void validate() throws SailConfigException { + super.validate(); + } + + @Override + public Resource export(Graph graph) { + Resource implNode = super.export(graph); + + @SuppressWarnings("deprecation") + ValueFactory v = graph.getValueFactory(); + + graph.add(implNode, USER, v.createLiteral(user)); + graph.add(implNode, PASSWORD, v.createLiteral(password)); + graph.add(implNode, INSTANCE, v.createLiteral(instance)); + graph.add(implNode, ZOOKEEPERS, v.createLiteral(zookeepers)); + graph.add(implNode, IS_MOCK, v.createLiteral(isMock)); + + return implNode; + } + + @Override + public void parse(Graph graph, Resource implNode) throws SailConfigException { + super.parse(graph, implNode); + System.out.println("parsing"); + + try { + Literal userLit = GraphUtil.getOptionalObjectLiteral(graph, implNode, USER); + if (userLit != null) { + setUser(userLit.getLabel()); + } + Literal pwdLit = GraphUtil.getOptionalObjectLiteral(graph, implNode, PASSWORD); + if (pwdLit != null) { + setPassword(pwdLit.getLabel()); + } + Literal instLit = GraphUtil.getOptionalObjectLiteral(graph, implNode, INSTANCE); + if (instLit != null) { + setInstance(instLit.getLabel()); + } + Literal zooLit = GraphUtil.getOptionalObjectLiteral(graph, implNode, ZOOKEEPERS); + if (zooLit != null) { + setZookeepers(zooLit.getLabel()); + } + Literal mockLit = GraphUtil.getOptionalObjectLiteral(graph, implNode, IS_MOCK); + if (mockLit != null) { + setMock(Boolean.parseBoolean(mockLit.getLabel())); + } + } catch (GraphUtilException e) { + throw new SailConfigException(e.getMessage(), e); + } + } +} http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/22f82c7a/extras/indexing/src/main/java/mvm/rya/sail/config/RyaAccumuloSailFactory.java ---------------------------------------------------------------------- diff --git a/extras/indexing/src/main/java/mvm/rya/sail/config/RyaAccumuloSailFactory.java b/extras/indexing/src/main/java/mvm/rya/sail/config/RyaAccumuloSailFactory.java new file mode 100644 index 0000000..91f27ab --- /dev/null +++ b/extras/indexing/src/main/java/mvm/rya/sail/config/RyaAccumuloSailFactory.java @@ -0,0 +1,92 @@ +package mvm.rya.sail.config; + +/* + * #%L + * mvm.rya.rya.sail.impl + * %% + * Copyright (C) 2014 Rya + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ + +import mvm.rya.accumulo.AccumuloRdfConfiguration; +import mvm.rya.accumulo.AccumuloRyaDAO; +import mvm.rya.api.persist.RyaDAOException; +import mvm.rya.indexing.accumulo.ConfigUtils; +import mvm.rya.rdftriplestore.RdfCloudTripleStore; + +import org.apache.accumulo.core.client.AccumuloException; +import org.apache.accumulo.core.client.AccumuloSecurityException; +import org.apache.accumulo.core.client.Connector; +import org.apache.accumulo.core.client.Instance; +import org.apache.accumulo.core.client.ZooKeeperInstance; +import org.apache.accumulo.core.client.mock.MockInstance; +import org.apache.accumulo.core.client.security.tokens.PasswordToken; +import org.openrdf.sail.Sail; +import org.openrdf.sail.config.SailConfigException; +import org.openrdf.sail.config.SailFactory; +import org.openrdf.sail.config.SailImplConfig; + +public class RyaAccumuloSailFactory implements SailFactory { + + public static final String SAIL_TYPE = "rya:RyaAccumuloSail"; + + @Override + public SailImplConfig getConfig() { + return new RyaAccumuloSailConfig(); + } + + @Override + public Sail getSail(SailImplConfig config) throws SailConfigException { + try { + RdfCloudTripleStore store = new RdfCloudTripleStore(); + RyaAccumuloSailConfig cbconfig = (RyaAccumuloSailConfig) config; + + String instanceName = cbconfig.getInstance(); + String zooKeepers = cbconfig.getZookeepers(); + + Instance i; + if (cbconfig.isMock()) { + i = new MockInstance(instanceName); + } else { + i = new ZooKeeperInstance(instanceName, zooKeepers); + } + + String user = cbconfig.getUser(); + String pass = cbconfig.getPassword(); + + Connector connector = i.getConnector(user, new PasswordToken(pass)); + AccumuloRyaDAO crdfdao = new AccumuloRyaDAO(); + crdfdao.setConnector(connector); + + AccumuloRdfConfiguration conf = cbconfig.toRdfConfiguation(); + ConfigUtils.setIndexers(conf); + conf.setDisplayQueryPlan(true); + + crdfdao.setConf(conf); + crdfdao.init(); + store.setRyaDAO(crdfdao); + + return store; + } catch (RyaDAOException | AccumuloException | AccumuloSecurityException e) { + throw new SailConfigException(e); + } + } + + @Override + public String getSailType() { + return SAIL_TYPE; + } + +} http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/22f82c7a/extras/indexing/src/main/java/mvm/rya/sail/config/RyaSailFactory.java ---------------------------------------------------------------------- diff --git a/extras/indexing/src/main/java/mvm/rya/sail/config/RyaSailFactory.java b/extras/indexing/src/main/java/mvm/rya/sail/config/RyaSailFactory.java new file mode 100644 index 0000000..f4f770a --- /dev/null +++ b/extras/indexing/src/main/java/mvm/rya/sail/config/RyaSailFactory.java @@ -0,0 +1,84 @@ +package mvm.rya.sail.config; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + + +import mvm.rya.accumulo.AccumuloRdfConfiguration; +import mvm.rya.accumulo.AccumuloRyaDAO; +import mvm.rya.api.RdfCloudTripleStoreConfiguration; +import mvm.rya.api.persist.RyaDAOException; +import mvm.rya.indexing.accumulo.ConfigUtils; +import mvm.rya.mongodb.MongoDBRdfConfiguration; +import mvm.rya.mongodb.MongoDBRyaDAO; +import mvm.rya.rdftriplestore.RdfCloudTripleStore; + +import org.apache.accumulo.core.client.AccumuloException; +import org.apache.accumulo.core.client.AccumuloSecurityException; +import org.apache.accumulo.core.client.Connector; +import org.apache.hadoop.conf.Configuration; +import org.openrdf.sail.Sail; + +public class RyaSailFactory { + + + + public static Sail getInstance(Configuration conf) throws AccumuloException, + AccumuloSecurityException, RyaDAOException { + + return getRyaSail(conf); + } + + + + private static Sail getRyaSail(Configuration config) throws AccumuloException, AccumuloSecurityException, RyaDAOException { + + RdfCloudTripleStore store = new RdfCloudTripleStore(); + if (ConfigUtils.getUseMongo(config)) { + MongoDBRdfConfiguration conf = new MongoDBRdfConfiguration(config); + conf.setTablePrefix(config.get(RdfCloudTripleStoreConfiguration.CONF_TBL_PREFIX)); + ConfigUtils.setIndexers(conf); + + MongoDBRyaDAO crdfdao = new MongoDBRyaDAO(conf); + crdfdao.init(); + + conf.setDisplayQueryPlan(true); + store.setRyaDAO(crdfdao); + } else { + Connector connector = ConfigUtils.getConnector(config); + AccumuloRyaDAO crdfdao = new AccumuloRyaDAO(); + crdfdao.setConnector(connector); + + AccumuloRdfConfiguration conf = new AccumuloRdfConfiguration(config); + conf.setTablePrefix(config.get(RdfCloudTripleStoreConfiguration.CONF_TBL_PREFIX)); // sets + // TablePrefixLayoutStrategy + ConfigUtils.setIndexers(conf); + conf.setDisplayQueryPlan(true); + + crdfdao.setConf(conf); + crdfdao.init(); + store.setRyaDAO(crdfdao); + } + + return store; + } + + + +} http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/22f82c7a/extras/indexing/src/main/resources/META-INF/services/org.openrdf.sail.config.SailFactory ---------------------------------------------------------------------- diff --git a/extras/indexing/src/main/resources/META-INF/services/org.openrdf.sail.config.SailFactory b/extras/indexing/src/main/resources/META-INF/services/org.openrdf.sail.config.SailFactory new file mode 100644 index 0000000..43f32d1 --- /dev/null +++ b/extras/indexing/src/main/resources/META-INF/services/org.openrdf.sail.config.SailFactory @@ -0,0 +1 @@ +mvm.rya.sail.config.RyaAccumuloSailFactory http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/22f82c7a/extras/indexing/src/main/resources/org/openrdf/repository/config/RyaAccumuloSail.ttl ---------------------------------------------------------------------- diff --git a/extras/indexing/src/main/resources/org/openrdf/repository/config/RyaAccumuloSail.ttl b/extras/indexing/src/main/resources/org/openrdf/repository/config/RyaAccumuloSail.ttl new file mode 100644 index 0000000..0e9a6f8 --- /dev/null +++ b/extras/indexing/src/main/resources/org/openrdf/repository/config/RyaAccumuloSail.ttl @@ -0,0 +1,20 @@ +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>. +@prefix rep: <http://www.openrdf.org/config/repository#>. +@prefix sr: <http://www.openrdf.org/config/repository/sail#>. +@prefix sail: <http://www.openrdf.org/config/sail#>. +@prefix rac: <http://rya.apache.org/RyaAccumuloSail/Config#>. + +[] a rep:Repository ; + rep:repositoryID "{%Repository ID|RyaAccumuloSail%}" ; + rdfs:label "{%Repository title|RyaAccumuloSail Store%}" ; + rep:repositoryImpl [ + rep:repositoryType "openrdf:SailRepository" ; + sr:sailImpl [ + sail:sailType "rya:RyaAccumuloSail" ; + rac:user "{%Rya Accumulo user|root%}" ; + rac:password "{%Rya Accumulo password|root%}" ; + rac:instance "{%Rya Accumulo instance|dev%}" ; + rac:zookeepers "{%Rya Accumulo zookeepers|zoo1,zoo2,zoo3%}" ; + rac:isMock "{%Rya Accumulo is mock|false|true%}" ; + ] + ]. http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/22f82c7a/extras/indexing/src/test/java/mvm/rya/indexing/external/AccumuloIndexSetTest2.java ---------------------------------------------------------------------- diff --git a/extras/indexing/src/test/java/mvm/rya/indexing/external/AccumuloIndexSetTest2.java b/extras/indexing/src/test/java/mvm/rya/indexing/external/AccumuloIndexSetTest2.java index f93f58a..f3a4ddf 100644 --- a/extras/indexing/src/test/java/mvm/rya/indexing/external/AccumuloIndexSetTest2.java +++ b/extras/indexing/src/test/java/mvm/rya/indexing/external/AccumuloIndexSetTest2.java @@ -26,9 +26,9 @@ import java.util.List; import junit.framework.Assert; import mvm.rya.accumulo.AccumuloRdfConfiguration; import mvm.rya.api.persist.RyaDAOException; -import mvm.rya.indexing.RyaSailFactory; import mvm.rya.indexing.accumulo.ConfigUtils; import mvm.rya.indexing.external.tupleSet.AccumuloIndexSet; +import mvm.rya.sail.config.RyaSailFactory; import org.apache.accumulo.core.client.AccumuloException; import org.apache.accumulo.core.client.AccumuloSecurityException; http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/22f82c7a/extras/indexing/src/test/java/mvm/rya/indexing/external/PrecompJoinOptimizerIntegrationTest.java ---------------------------------------------------------------------- diff --git a/extras/indexing/src/test/java/mvm/rya/indexing/external/PrecompJoinOptimizerIntegrationTest.java b/extras/indexing/src/test/java/mvm/rya/indexing/external/PrecompJoinOptimizerIntegrationTest.java index f7f3cbf..9f18f07 100644 --- a/extras/indexing/src/test/java/mvm/rya/indexing/external/PrecompJoinOptimizerIntegrationTest.java +++ b/extras/indexing/src/test/java/mvm/rya/indexing/external/PrecompJoinOptimizerIntegrationTest.java @@ -21,28 +21,21 @@ package mvm.rya.indexing.external; import java.util.List; -import java.util.Map; -import java.util.Map.Entry; import junit.framework.Assert; import mvm.rya.accumulo.AccumuloRdfConfiguration; import mvm.rya.api.persist.RyaDAOException; -import mvm.rya.indexing.RyaSailFactory; import mvm.rya.indexing.accumulo.ConfigUtils; import mvm.rya.indexing.external.tupleSet.AccumuloIndexSet; +import mvm.rya.sail.config.RyaSailFactory; import org.apache.accumulo.core.client.AccumuloException; import org.apache.accumulo.core.client.AccumuloSecurityException; import org.apache.accumulo.core.client.Connector; -import org.apache.accumulo.core.client.Scanner; import org.apache.accumulo.core.client.TableExistsException; import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.core.client.mock.MockInstance; import org.apache.accumulo.core.client.security.tokens.PasswordToken; -import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.Value; -import org.apache.accumulo.core.security.Authorizations; -import org.apache.hadoop.conf.Configuration; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -63,7 +56,6 @@ import org.openrdf.repository.sail.SailRepository; import org.openrdf.repository.sail.SailRepositoryConnection; import org.openrdf.sail.Sail; import org.openrdf.sail.SailException; -import org.openrdf.sail.memory.MemoryStore; public class PrecompJoinOptimizerIntegrationTest { http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/22f82c7a/extras/indexing/src/test/java/mvm/rya/sail/config/RyaAccumuloSailFactoryTest.java ---------------------------------------------------------------------- diff --git a/extras/indexing/src/test/java/mvm/rya/sail/config/RyaAccumuloSailFactoryTest.java b/extras/indexing/src/test/java/mvm/rya/sail/config/RyaAccumuloSailFactoryTest.java new file mode 100644 index 0000000..b50e40a --- /dev/null +++ b/extras/indexing/src/test/java/mvm/rya/sail/config/RyaAccumuloSailFactoryTest.java @@ -0,0 +1,196 @@ +package mvm.rya.sail.config; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.io.InputStream; +import java.io.StringReader; +import java.util.HashMap; +import java.util.Map; + +import mvm.rya.sail.config.RyaAccumuloSailConfig; +import mvm.rya.sail.config.RyaAccumuloSailFactory; + +import org.apache.commons.io.IOUtils; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; +import org.openrdf.model.Graph; +import org.openrdf.model.Resource; +import org.openrdf.model.Statement; +import org.openrdf.model.ValueFactory; +import org.openrdf.model.impl.LinkedHashModel; +import org.openrdf.model.util.GraphUtil; +import org.openrdf.model.vocabulary.RDF; +import org.openrdf.repository.Repository; +import org.openrdf.repository.RepositoryConnection; +import org.openrdf.repository.config.ConfigTemplate; +import org.openrdf.repository.config.RepositoryConfig; +import org.openrdf.repository.config.RepositoryConfigSchema; +import org.openrdf.repository.config.RepositoryConfigUtil; +import org.openrdf.repository.config.RepositoryImplConfig; +import org.openrdf.repository.config.RepositoryRegistry; +import org.openrdf.repository.manager.LocalRepositoryManager; +import org.openrdf.repository.sail.config.SailRepositoryConfig; +import org.openrdf.repository.sail.config.SailRepositoryFactory; +import org.openrdf.rio.RDFFormat; +import org.openrdf.rio.RDFParser; +import org.openrdf.rio.Rio; +import org.openrdf.rio.helpers.StatementCollector; +import org.openrdf.sail.config.SailFactory; +import org.openrdf.sail.config.SailRegistry; + +import com.google.common.collect.ImmutableMap; +import com.google.common.io.Files; + +public class RyaAccumuloSailFactoryTest { + + private static RepositoryImplConfig getConfig() { + RyaAccumuloSailConfig c = new RyaAccumuloSailConfig(); + c.setUser("root"); + c.setPassword(""); + c.setInstance("mock-instance"); + c.setMock(true); + return new SailRepositoryConfig(c); + } + + @Ignore + @Test + public void testCreateAccumuloSail() throws Exception { + SailRepositoryFactory f = new SailRepositoryFactory(); + Repository r = f.getRepository(getConfig()); + r.initialize(); + RepositoryConnection rc = r.getConnection(); + rc.close(); + } + + @Ignore + @Test + public void testAddStatement() throws Exception { + SailRepositoryFactory f = new SailRepositoryFactory(); + Repository r = f.getRepository(getConfig()); + r.initialize(); + RepositoryConnection rc = r.getConnection(); + + ValueFactory vf = rc.getValueFactory(); + Statement s = vf.createStatement(vf.createURI("u:a"), vf.createURI("u:b"), vf.createURI("u:c")); + + assertFalse(rc.hasStatement(s, false)); + + rc.add(s); + + Assert.assertTrue(rc.hasStatement(s, false)); + rc.close(); + } + + @Test + public void testCreateFromTemplateName() throws Exception { + LocalRepositoryManager repoman = new LocalRepositoryManager(Files.createTempDir()); + repoman.initialize(); + + + + try(InputStream templateStream = RepositoryConfig.class.getResourceAsStream("RyaAccumuloSail.ttl")) { + String template = IOUtils.toString(templateStream); + + final ConfigTemplate configTemplate = new ConfigTemplate(template); + final Map<String, String> valueMap = ImmutableMap.<String, String> builder() + .put("Repository ID", "RyaAccumuloSail") + .put("Repository title", "RyaAccumuloSail Store") + .put("Rya Accumulo user", "root") + .put("Rya Accumulo password", "") + .put("Rya Accumulo instance", "dev") + .put("Rya Accumulo zookeepers", "zoo1,zoo2,zoo3") + .put("Rya Accumulo is mock", "true") + .build(); + + final String configString = configTemplate.render(valueMap); + +// final Repository systemRepo = this.state.getManager().getSystemRepository(); + final Graph graph = new LinkedHashModel(); + final RDFParser rdfParser = Rio.createParser(RDFFormat.TURTLE); + rdfParser.setRDFHandler(new StatementCollector(graph)); + rdfParser.parse(new StringReader(configString), RepositoryConfigSchema.NAMESPACE); + final Resource repositoryNode = GraphUtil.getUniqueSubject(graph, RDF.TYPE, + RepositoryConfigSchema.REPOSITORY); + final RepositoryConfig repConfig = RepositoryConfig.create(graph, repositoryNode); + repConfig.validate(); + + + repoman.addRepositoryConfig(repConfig); + + Repository r = repoman.getRepository("RyaAccumuloSail"); + r.initialize(); + + } + + } + + @Test + public void testRyaAccumuloSailInManager() throws Exception { +// Class<SailFactory> clazz = SailFactory.class; +// ServiceLoader<SailFactory> loader = java.util.ServiceLoader.load(clazz, clazz.getClassLoader()); +// +// Iterator<SailFactory> services = loader.iterator(); +// +// while (services.hasNext()) +// System.out.println(services.next()); + + + + String ryaSailKey = RyaAccumuloSailFactory.SAIL_TYPE; + + assertTrue("Connot find RyaAccumuloSailFactory in Registry", SailRegistry.getInstance().has(ryaSailKey)); + + SailFactory factory = SailRegistry.getInstance().get(ryaSailKey); + Assert.assertNotNull("Cannot create RyaAccumuloSailFactory", factory); + + +// for (String s : SailRegistry.getInstance().getKeys()) { +// System.out.println("SailRegistry :: " + s); +// } +// System.out.println("Factory :: " + factory.getClass().getName()); + for (String s : RepositoryRegistry.getInstance().getKeys()) { + System.out.println("RepositoryRegistry :: " + s); + } +// RepositoryManager m = new LocalRepositoryManager(Files.createTempDir()); +// m.initialize(); +// for (String s : RepositoryConfigUtil.getRepositoryIDs(m.getSystemRepository())) { +// System.out.println("System :: " + s); +// } +// RepositoryConnection rc = m.getSystemRepository().getConnection(); +// RepositoryResult<Statement> results = rc.getStatements(null, null, null, false); +// while(results.hasNext()) { +// System.out.println("System :: " + results.next().toString()); +// } +// RepositoryProvider.getRepository("SYSTEM"); +// RepositoryConfigSchema + // RepositoryProvider.getRepository("RyaAccumuloSail"); + } + + @Test + public void testParseTemplate() throws Exception{ + String template = IOUtils.toString(ClassLoader.getSystemResourceAsStream("org/openrdf/repository/config/RyaAccumuloSail.ttl")); + ConfigTemplate ct = new ConfigTemplate(template); + System.out.println(ct.getVariableMap()); + } +} http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/22f82c7a/extras/indexingExample/pom.xml ---------------------------------------------------------------------- diff --git a/extras/indexingExample/pom.xml b/extras/indexingExample/pom.xml index 2ca3417..1150a80 100644 --- a/extras/indexingExample/pom.xml +++ b/extras/indexingExample/pom.xml @@ -69,16 +69,6 @@ under the License. <build> <plugins> <plugin> - <groupId>org.apache.rat</groupId> - <artifactId>apache-rat-plugin</artifactId> - <configuration> - <excludes combine.children="append"> - <!-- Vagrant may leave around some files. These are not checked in --> - <exclude>**/src/main/vagrant/.vagrant/**</exclude> - </excludes> - </configuration> - </plugin> - <plugin> <artifactId>maven-assembly-plugin</artifactId> <configuration> <descriptors> http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/22f82c7a/extras/indexingExample/src/main/java/EntityDirectExample.java ---------------------------------------------------------------------- diff --git a/extras/indexingExample/src/main/java/EntityDirectExample.java b/extras/indexingExample/src/main/java/EntityDirectExample.java index 04b4f74..d8e74e1 100644 --- a/extras/indexingExample/src/main/java/EntityDirectExample.java +++ b/extras/indexingExample/src/main/java/EntityDirectExample.java @@ -21,6 +21,11 @@ import java.util.List; +import mvm.rya.accumulo.AccumuloRdfConfiguration; +import mvm.rya.api.RdfCloudTripleStoreConfiguration; +import mvm.rya.indexing.accumulo.ConfigUtils; +import mvm.rya.sail.config.RyaSailFactory; + import org.apache.accumulo.core.client.AccumuloException; import org.apache.accumulo.core.client.AccumuloSecurityException; import org.apache.accumulo.core.client.TableNotFoundException; @@ -42,11 +47,6 @@ import org.openrdf.repository.sail.SailRepository; import org.openrdf.repository.sail.SailRepositoryConnection; import org.openrdf.sail.Sail; -import mvm.rya.accumulo.AccumuloRdfConfiguration; -import mvm.rya.api.RdfCloudTripleStoreConfiguration; -import mvm.rya.indexing.RyaSailFactory; -import mvm.rya.indexing.accumulo.ConfigUtils; - public class EntityDirectExample { private static final Logger log = Logger.getLogger(EntityDirectExample.class); http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/22f82c7a/extras/indexingExample/src/main/java/MongoRyaDirectExample.java ---------------------------------------------------------------------- diff --git a/extras/indexingExample/src/main/java/MongoRyaDirectExample.java b/extras/indexingExample/src/main/java/MongoRyaDirectExample.java index 860df06..4cdb504 100644 --- a/extras/indexingExample/src/main/java/MongoRyaDirectExample.java +++ b/extras/indexingExample/src/main/java/MongoRyaDirectExample.java @@ -20,9 +20,9 @@ import java.util.List; import mvm.rya.api.RdfCloudTripleStoreConfiguration; -import mvm.rya.indexing.RyaSailFactory; import mvm.rya.indexing.accumulo.ConfigUtils; import mvm.rya.mongodb.MongoDBRdfConfiguration; +import mvm.rya.sail.config.RyaSailFactory; import org.apache.commons.lang.Validate; import org.apache.hadoop.conf.Configuration; http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/22f82c7a/extras/indexingExample/src/main/java/RyaDirectExample.java ---------------------------------------------------------------------- diff --git a/extras/indexingExample/src/main/java/RyaDirectExample.java b/extras/indexingExample/src/main/java/RyaDirectExample.java index 0d2df3f..122a904 100644 --- a/extras/indexingExample/src/main/java/RyaDirectExample.java +++ b/extras/indexingExample/src/main/java/RyaDirectExample.java @@ -20,6 +20,13 @@ import java.util.List; +import mvm.rya.accumulo.AccumuloRdfConfiguration; +import mvm.rya.api.RdfCloudTripleStoreConfiguration; +import mvm.rya.indexing.accumulo.ConfigUtils; +import mvm.rya.indexing.accumulo.geo.GeoConstants; +import mvm.rya.indexing.external.tupleSet.AccumuloIndexSet; +import mvm.rya.sail.config.RyaSailFactory; + import org.apache.accumulo.core.client.AccumuloException; import org.apache.accumulo.core.client.AccumuloSecurityException; import org.apache.accumulo.core.client.Connector; @@ -53,13 +60,6 @@ import org.openrdf.repository.sail.SailRepositoryConnection; import org.openrdf.sail.Sail; import org.openrdf.sail.SailException; -import mvm.rya.accumulo.AccumuloRdfConfiguration; -import mvm.rya.api.RdfCloudTripleStoreConfiguration; -import mvm.rya.indexing.RyaSailFactory; -import mvm.rya.indexing.accumulo.ConfigUtils; -import mvm.rya.indexing.accumulo.geo.GeoConstants; -import mvm.rya.indexing.external.tupleSet.AccumuloIndexSet; - public class RyaDirectExample { private static final Logger log = Logger.getLogger(RyaDirectExample.class); http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/22f82c7a/extras/pom.xml ---------------------------------------------------------------------- diff --git a/extras/pom.xml b/extras/pom.xml index f3a88d3..a3199bf 100644 --- a/extras/pom.xml +++ b/extras/pom.xml @@ -39,5 +39,6 @@ under the License. <module>rya.console</module> <module>indexing</module> <module>indexingExample</module> + <module>vagrantExample</module> </modules> </project> http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/22f82c7a/extras/tinkerpop.rya/src/test/java/com/tinkerpop/blueprints/impls/sail/log4j.properties ---------------------------------------------------------------------- diff --git a/extras/tinkerpop.rya/src/test/java/com/tinkerpop/blueprints/impls/sail/log4j.properties b/extras/tinkerpop.rya/src/test/java/com/tinkerpop/blueprints/impls/sail/log4j.properties new file mode 100644 index 0000000..a976141 --- /dev/null +++ b/extras/tinkerpop.rya/src/test/java/com/tinkerpop/blueprints/impls/sail/log4j.properties @@ -0,0 +1,33 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + + +# Tinker Pop's "blueprints-sail-graph" actually loads it's own log4j properties +# from the classpath. Unfortunately, it creates a file (blueprints.log) and +# this can be messy. + +# This log4j.properties file overwrites Tinker Pop's "blueprints-sail-graph" +# log4j properties in order to write to the console. + +log4j.debug=true + +log4j.rootLogger=INFO, console + +log4j.appender.console=org.apache.log4j.ConsoleAppender +log4j.appender.console.layout=org.apache.log4j.PatternLayout +log4j.appender.console.layout.ConversionPattern=%d [%t] %p %C{1} - %m%n + http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/22f82c7a/extras/tinkerpop.rya/src/test/resources/log4j.properties ---------------------------------------------------------------------- diff --git a/extras/tinkerpop.rya/src/test/resources/log4j.properties b/extras/tinkerpop.rya/src/test/resources/log4j.properties deleted file mode 100644 index 7142ee3..0000000 --- a/extras/tinkerpop.rya/src/test/resources/log4j.properties +++ /dev/null @@ -1,29 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - - -log4j.debug=false - -#log4j.rootLogger=INFO, console -log4j.category.org.openrdf=INFO, mob -log4j.category.org.xml=INFO, mob - -log4j.appender.mob=org.apache.log4j.FileAppender -log4j.appender.mob.file=target/blueprints.log -log4j.appender.mob.append=true -log4j.appender.mob.layout=org.apache.log4j.PatternLayout -log4j.appender.mob.layout.ConversionPattern=%d [%t] %p %C{1} - %m%n http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/22f82c7a/extras/vagrantExample/pom.xml ---------------------------------------------------------------------- diff --git a/extras/vagrantExample/pom.xml b/extras/vagrantExample/pom.xml new file mode 100644 index 0000000..47441a3 --- /dev/null +++ b/extras/vagrantExample/pom.xml @@ -0,0 +1,46 @@ +<?xml version='1.0'?> +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.rya</groupId> + <artifactId>rya.extras</artifactId> + <version>3.2.10-SNAPSHOT</version> + </parent> + + <artifactId>rya.vagrant.example</artifactId> + <name>Apache Rya Vagrant VM</name> + + <build> + <plugins> + <plugin> + <groupId>org.apache.rat</groupId> + <artifactId>apache-rat-plugin</artifactId> + <configuration> + <excludes combine.children="append"> + <!-- Vagrant may leave around some files. These are not checked in --> + <exclude>**/src/main/vagrant/.vagrant/**</exclude> + </excludes> + </configuration> + </plugin> + </plugins> + </build> +</project> http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/22f82c7a/extras/vagrantExample/src/main/resources/create-RyaAccumuloSail.xsl ---------------------------------------------------------------------- diff --git a/extras/vagrantExample/src/main/resources/create-RyaAccumuloSail.xsl b/extras/vagrantExample/src/main/resources/create-RyaAccumuloSail.xsl new file mode 100644 index 0000000..05aab89 --- /dev/null +++ b/extras/vagrantExample/src/main/resources/create-RyaAccumuloSail.xsl @@ -0,0 +1,138 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE rdf:RDF [ + <!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" > + ]> + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +<xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:sparql="http://www.w3.org/2005/sparql-results#" xmlns="http://www.w3.org/1999/xhtml"> + + <xsl:include href="../locale/messages.xsl" /> + + <xsl:variable name="title"> + <xsl:value-of select="$repository-create.title" /> + </xsl:variable> + + <xsl:include href="template.xsl" /> + + <xsl:template match="sparql:sparql"> + <script src="../../scripts/create.js" type="text/javascript"> + </script> + <form action="create" method="post"> + <table class="dataentry"> + <tbody> + <tr> + <th> + <xsl:value-of select="$repository-type.label" /> + </th> + <td> + <select id="type" name="type"> + <option value="RyaAccumuloSail"> + Rya Accumulo Store + </option> + </select> + </td> + <td></td> + </tr> + <tr> + <th> + <xsl:value-of select="$repository-id.label" /> + </th> + <td> + <input type="text" id="id" name="Repository ID" size="16" + value="RyaAccumuloSail" /> + </td> + <td></td> + </tr> + <tr> + <th> + <xsl:value-of select="$repository-title.label" /> + </th> + <td> + <input type="text" id="title" name="Repository title" size="48" + value="RyaAccumuloSail Store" /> + </td> + <td></td> + </tr> + <tr> + <th> + Accumulo User + </th> + <td> + <input type="text" id="user" name="Rya Accumulo user" size="32" + value="root" /> + </td> + <td></td> + </tr> + <tr> + <th> + Accumulo Password + </th> + <td> + <input type="text" id="password" name="Rya Accumulo password" size="32" value="root" /> + </td> + <td></td> + </tr> + <tr> + <th> + Accumulo Instance + </th> + <td> + <input type="text" id="instance" name="Rya Accumulo instance" size="32" value="dev" /> + </td> + <td></td> + </tr> + <tr> + <th> + Zookeepers + </th> + <td> + <input type="text" id="zoo" name="Rya Accumulo zookeepers" size="32" + value="localhost" /> + </td> + <td></td> + </tr> + <tr> + <th> + is Mock? + </th> + <td> + <input type="text" id="ismock" name="Rya Accumulo is mock" + size="32" value="false"/> + </td> + <td></td> + </tr> + <tr> + <td></td> + <td> + <input type="button" value="{$cancel.label}" style="float:right" + href="repositories" onclick="document.location.href=this.getAttribute('href')" /> + <input id="create" type="button" value="{$create.label}" + onclick="checkOverwrite()" /> + </td> + </tr> + </tbody> + </table> + </form> + </xsl:template> + +</xsl:stylesheet> http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/22f82c7a/extras/vagrantExample/src/main/resources/create.xsl ---------------------------------------------------------------------- diff --git a/extras/vagrantExample/src/main/resources/create.xsl b/extras/vagrantExample/src/main/resources/create.xsl new file mode 100644 index 0000000..9d4392c --- /dev/null +++ b/extras/vagrantExample/src/main/resources/create.xsl @@ -0,0 +1,128 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE rdf:RDF [ + <!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" > + ]> + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +<xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:sparql="http://www.w3.org/2005/sparql-results#" xmlns="http://www.w3.org/1999/xhtml"> + + <xsl:include href="../locale/messages.xsl" /> + + <xsl:variable name="title"> + <xsl:value-of select="$repository-create.title" /> + </xsl:variable> + + <xsl:include href="template.xsl" /> + + <xsl:template match="sparql:sparql"> + <form action="create"> + <table class="dataentry"> + <tbody> + <tr> + <th> + <xsl:value-of select="$repository-type.label" /> + </th> + <td> + <select id="type" name="type"> + <option value="RyaAccumuloSail"> + Rya Accumulo Store + </option> + <option value="memory"> + In Memory Store + </option> + <option value="memory-rdfs"> + In Memory Store RDF Schema + </option> + <option value="memory-rdfs-dt"> + In Memory Store RDF Schema and + Direct Type + Hierarchy + </option> + <option value="memory-customrule"> + In Memory Store Custom Graph Query + Inference + </option> + <option value="native"> + Native Java Store + </option> + <option value="native-rdfs"> + Native Java Store RDF Schema + </option> + <option value="native-rdfs-dt"> + Native Java Store RDF Schema and + Direct Type + Hierarchy + </option> + <option value="native-customrule"> + Native Java Store Custom + Graph Query Inference + </option> + <option value="mysql"> + MySql RDF Store + </option> + <option value="pgsql"> + PostgreSQL RDF Store + </option> + <option value="remote"> + Remote RDF Store + </option> + <option value="sparql"> + SPARQL endpoint proxy + </option> + <option value="federate">Federation Store</option> + </select> + </td> + <td></td> + </tr> + <tr> + <th> + <xsl:value-of select="$repository-id.label" /> + </th> + <td> + <input type="text" id="id" name="id" size="16" /> + </td> + <td></td> + </tr> + <tr> + <th> + <xsl:value-of select="$repository-title.label" /> + </th> + <td> + <input type="text" id="title" name="title" size="48" /> + </td> + <td></td> + </tr> + <tr> + <td></td> + <td> + <input type="button" value="{$cancel.label}" style="float:right" + href="repositories" onclick="document.location.href=this.getAttribute('href')" /> + <input type="submit" name="next" value="{$next.label}" /> + </td> + </tr> + </tbody> + </table> + </form> + </xsl:template> + +</xsl:stylesheet> http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/22f82c7a/extras/vagrantExample/src/main/vagrant/Vagrantfile ---------------------------------------------------------------------- diff --git a/extras/vagrantExample/src/main/vagrant/Vagrantfile b/extras/vagrantExample/src/main/vagrant/Vagrantfile new file mode 100644 index 0000000..f024dfb --- /dev/null +++ b/extras/vagrantExample/src/main/vagrant/Vagrantfile @@ -0,0 +1,268 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# -*- mode: ruby -*- +# vi: set ft=ruby : + +# Note: Machine's ip is 192.168.33.10 +# username : vagrant +# password : vagrant +# +# accumulo instance : dev +# accumulo username : root +# accumulo password : root + +Vagrant.configure(2) do |config| + + config.vm.box = "ubuntu/trusty64" + + config.vm.provider "virtualbox" do |vb| + vb.name = "rya-example-box" + vb.memory = "4096" + vb.cpus = 4 + end + + config.vm.network :private_network, ip: "192.168.33.10" + config.vm.hostname = "rya-example-box" + + config.vm.provision "shell", inline: <<-SHELL + echo "Updating host file with permanent ip" + sudo sed -i 's/127.0.1.1/192.168.33.10/' /etc/hosts + cat >> /etc/hosts <<EOF +192.168.33.10 zoo1 zoo2 zoo3 +EOF + + sudo apt-get update + + echo "Installing Sun Java..." + sudo add-apt-repository ppa:webupd8team/java + sudo apt-get update + echo debconf shared/accepted-oracle-license-v1-1 select true | \ + sudo /usr/bin/debconf-set-selections + echo debconf shared/accepted-oracle-license-v1-1 seen true | \ + sudo /usr/bin/debconf-set-selections + sudo apt-get install -y oracle-java8-installer + sudo ln -s /usr/lib/jvm/java-8-oracle/ /usr/lib/jvm/default-java + + echo "Installing Tomcat..." + sudo apt-get install -y tomcat7 + + echo "Installing Unzip..." + apt-get install unzip + + echo "Setting up environment..." + export JAVA_HOME=/usr/lib/jvm/java-8-oracle + export HADOOP_HOME=/home/vagrant/hadoop-1.2.1 + export ZOOKEEPER_HOME=/home/vagrant/zookeeper-3.4.5-cdh4.5.0 + export ACCUMULO_HOME=/home/vagrant/accumulo-1.6.4 + export PATH=$PATH:$JAVA_HOME/bin:$ZOOKEEPER_HOME/bin:$ACCUMULO_HOME/bin + + export HADOOP_PREFIX="$HADOOP_HOME" + export HADOOP_CONF_DIR="$HADOOP_PREFIX/conf" + export ACCUMULO_LOG_DIR=$ACCUMULO_HOME/logs + export ACCUMULO_TSERVER_OPTS="-Xmx384m -Xms384m " + export ACCUMULO_MASTER_OPTS="-Xmx128m -Xms128m" + export ACCUMULO_MONITOR_OPTS="-Xmx64m -Xms64m" + export ACCUMULO_GC_OPTS="-Xmx64m -Xms64m" + export ACCUMULO_GENERAL_OPTS="-XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -Djava.net.preferIPv4Stack=true" + export ACCUMULO_OTHER_OPTS="-Xmx128m -Xms64m" + export ACCUMULO_KILL_CMD='kill -9 %p' + + cat >> /home/vagrant/.bashrc <<EOF + export JAVA_HOME=/usr/lib/jvm/java-8-oracle + export HADOOP_HOME=/home/vagrant/hadoop-1.2.1 + export ZOOKEEPER_HOME=/home/vagrant/zookeeper-3.4.5-cdh4.5.0 + export ACCUMULO_HOME=/home/vagrant/accumulo-1.6.4 + export PATH=$PATH:$JAVA_HOME/bin:$ZOOKEEPER_HOME/bin:$ACCUMULO_HOME/bin + + export HADOOP_PREFIX="$HADOOP_HOME" + export HADOOP_CONF_DIR="$HADOOP_PREFIX/conf" + export ACCUMULO_LOG_DIR=$ACCUMULO_HOME/logs + export ACCUMULO_TSERVER_OPTS="-Xmx384m -Xms384m " + export ACCUMULO_MASTER_OPTS="-Xmx128m -Xms128m" + export ACCUMULO_MONITOR_OPTS="-Xmx64m -Xms64m" + export ACCUMULO_GC_OPTS="-Xmx64m -Xms64m" + export ACCUMULO_GENERAL_OPTS="-XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -Djava.net.preferIPv4Stack=true" + export ACCUMULO_OTHER_OPTS="-Xmx128m -Xms64m" + export ACCUMULO_KILL_CMD='kill -9 %p' +EOF + + + echo "Acquiring and Extracting ..." + + echo "- Hadoop" + curl -SL http://apache.mirrors.tds.net/hadoop/common/hadoop-1.2.1/hadoop-1.2.1.tar.gz \ + | tar -zxC /home/vagrant + + echo "- Zookeeper" + curl -SL http://archive-primary.cloudera.com/cdh4/cdh/4/zookeeper-3.4.5-cdh4.5.0.tar.gz \ + | tar -zxC /home/vagrant + + echo "- Accumulo" + curl -SL http://apache.mirrors.pair.com/accumulo/1.6.4/accumulo-1.6.4-bin.tar.gz \ + | tar -zxC /home/vagrant + + echo "Configuring Zookeeper..." + sudo mkdir /var/zookeeper + sudo chown vagrant:vagrant /var/zookeeper + + echo "Running Zookeeper..." + cp zookeeper-3.4.5-cdh4.5.0/conf/zoo_sample.cfg zookeeper-3.4.5-cdh4.5.0/conf/zoo.cfg + sudo zookeeper-3.4.5-cdh4.5.0/bin/zkServer.sh start + + echo "Configuring Accumulo..." + cp accumulo-1.6.4/conf/examples/1GB/standalone/* accumulo-1.6.4/conf/ + rm accumulo-1.6.4/conf/accumulo-site.xml + cat >> accumulo-1.6.4/conf/accumulo-site.xml <<EOF + <configuration> + <property><name>instance.dfs.uri</name><value>file:///</value></property> + <property><name>instance.dfs.dir</name><value>/data/accumulo</value></property> + <property><name>instance.zookeeper.host</name><value>localhost:2181</value></property> + <property><name>instance.secret</name><value>DONTTELL</value></property> + <property><name>tserver.port.search</name><value>true</value></property> + <property><name>logger.dir.walog</name><value>/data/accumulo/walogs</value></property> + <property><name>tserver.cache.data.size</name><value>15M</value></property> + <property><name>tserver.cache.index.size</name><value>15M</value></property> + <property><name>tserver.memory.maps.max</name><value>256M</value></property> + <property><name>tserver.walog.max.size</name><value>256M</value></property> + <property><name>tserver.memory.maps.native.enabled</name><value>false</value></property> + <property><name>trace.token.property.password</name><value>root</value></property> + <property><name>gc.cycle.delay</name><value>4s</value></property> + <property><name>gc.cycle.start</name><value>0s</value></property> + <property><name>tserver.compaction.major.delay</name><value>3</value></property> + <property><name>general.classpaths</name><value> + /data/accumulo/lib/[^.].*.jar, + /home/vagrant/hadoop-1.2.1/share/hadoop/common/.*.jar, + /home/vagrant/hadoop-1.2.1/share/hadoop/common/lib/.*.jar, + /home/vagrant/hadoop-1.2.1/share/hadoop/hdfs/.*.jar, + /home/vagrant/hadoop-1.2.1/share/hadoop/mapreduce/.*.jar, + /home/vagrant/hadoop-1.2.1/share/hadoop/yarn/.*.jar, + /home/vagrant/accumulo-1.6.4/server/target/classes/, + /home/vagrant/accumulo-1.6.4/lib/accumulo-server.jar, + /home/vagrant/accumulo-1.6.4/core/target/classes/, + /home/vagrant/accumulo-1.6.4/lib/accumulo-core.jar, + /home/vagrant/accumulo-1.6.4/start/target/classes/, + /home/vagrant/accumulo-1.6.4/lib/accumulo-start.jar, + /home/vagrant/accumulo-1.6.4/fate/target/classes/, + /home/vagrant/accumulo-1.6.4/lib/accumulo-fate.jar, + /home/vagrant/accumulo-1.6.4/proxy/target/classes/, + /home/vagrant/accumulo-1.6.4/lib/accumulo-proxy.jar, + /home/vagrant/accumulo-1.6.4/lib/[^.].*.jar, + /home/vagrant/zookeeper-3.4.5-cdh4.5.0/zookeeper[^.].*.jar, + $HADOOP_CONF_DIR, + /home/vagrant/hadoop-1.2.1/[^.].*.jar, + /home/vagrant/hadoop-1.2.1/lib/[^.].*.jar, + </value></property> + <property><name>general.dynamic.classpaths</name><value>/data/accumulo/lib/ext/[^.].*.jar</value></property> + <property><name>trace.port.client</name><value>0</value></property> + <property><name>monitor.port.client</name><value>0</value></property> + <property><name>master.port.client</name><value>0</value></property> + <property><name>tserver.port.client</name><value>0</value></property> + <property><name>gc.port.client</name><value>0</value></property> + </configuration> +EOF + cat > accumulo-1.6.4/conf/masters <<EOF +rya-example-box +EOF + + cat > accumulo-1.6.4/conf/slaves <<EOF +rya-example-box +EOF + sudo mkdir /data + sudo chown vagrant:vagrant /data + mkdir /data/accumulo + mkdir /data/accumulo/lib + mkdir /data/accumulo/lib/ext + + echo "Starting Accumulo..." + accumulo-1.6.4/bin/accumulo init --instance-name dev --password root + accumulo-1.6.4/bin/start-all.sh + + echo 'Done!' + + echo "Installing Sesame Server" + # creating log dir sesame-http-server-2.7.6 + sudo mkdir -p /usr/share/tomcat7/.aduna + sudo chown -R tomcat7:tomcat7 /usr/share/tomcat7 + sudo ln -s /usr/share/tomcat7/.aduna/openrdf-sesame/logs /var/log/tomcat7/openrdf-sesame + + sudo curl -O http://repo1.maven.org/maven2/org/openrdf/sesame/sesame-http-server/2.7.6/sesame-http-server-2.7.6.war + sudo mv sesame-http-server-2.7.6.war /var/lib/tomcat7/webapps/openrdf-sesame.war + echo "Sesame http server deployed at http://rya-example-box:8080/openrdf-sesame" + + echo "Installing Sesame Workbench" + sudo curl -O http://repo1.maven.org/maven2/org/openrdf/sesame/sesame-http-workbench/2.7.6/sesame-http-workbench-2.7.6.war + sudo mv sesame-http-workbench-2.7.6.war /var/lib/tomcat7/webapps/openrdf-workbench.war + echo "Sesame workbench deployed at http://rya-example-box:8080/openrdf-workbench" + + echo "Downloading Rya" + # Right now it's on dropbox, but eventually it'll be on maven... + + sudo curl -L https://www.dropbox.com/s/7e74yiuq4jmu0od/rya.indexing.example-3.2.10-SNAPSHOT-distribution.zip?dl=0 -o rya.indexing.example-3.2.10-SNAPSHOT-distribution.zip + sudo mkdir rya.indexing.example-3.2.10-SNAPSHOT-distribution + sudo unzip rya.indexing.example-3.2.10-SNAPSHOT-distribution.zip -d rya.indexing.example-3.2.10-SNAPSHOT-distribution + + # soft linking the files doesn't seem to work in tomcat, so we copy them instead :( + sudo cp rya.indexing.example-3.2.10-SNAPSHOT-distribution/dist/lib/* /var/lib/tomcat7/webapps/openrdf-workbench/WEB-INF/lib/ + sudo cp rya.indexing.example-3.2.10-SNAPSHOT-distribution/dist/lib/* /var/lib/tomcat7/webapps/openrdf-sesame/WEB-INF/lib/ + + # These are older libs that breaks tomcat 7 + sudo rm /var/lib/tomcat7/webapps/openrdf-workbench/WEB-INF/lib/servlet-api-2.5.jar + sudo rm /var/lib/tomcat7/webapps/openrdf-workbench/WEB-INF/lib/jsp-api-2.1.jar + sudo rm /var/lib/tomcat7/webapps/openrdf-sesame/WEB-INF/lib/servlet-api-2.5.jar + sudo rm /var/lib/tomcat7/webapps/openrdf-sesame/WEB-INF/lib/jsp-api-2.1.jar + + sudo chown -R tomcat7:tomcat7 /var/lib/tomcat7/webapps/openrdf-workbench/WEB-INF/lib/ + sudo chown -R tomcat7:tomcat7 /var/lib/tomcat7/webapps/openrdf-sesame/WEB-INF/lib/ + + # Download and install new templates for OpenRdf WorkBench + sudo curl -L -O https://www.dropbox.com/s/dgw63m66nubyy4z/rya.vagrant.example-3.2.10-SNAPSHOT.jar + sudo mkdir rya.vagrant.example-3.2.10-SNAPSHOT + sudo unzip rya.vagrant.example-3.2.10-SNAPSHOT.jar -d rya.vagrant.example-3.2.10-SNAPSHOT + sudo cp rya.vagrant.example-3.2.10-SNAPSHOT/*.xsl /var/lib/tomcat7/webapps/openrdf-workbench/transformations/ + + echo "Deploying Rya Web" + sudo curl -L https://www.dropbox.com/s/332wr4b2f34dp6e/web.rya-3.2.10-SNAPSHOT.war?dl=0 -o web.rya.war + sudo cp web.rya.war /var/lib/tomcat7/webapps/web.rya.war + # Wait for the war to deploy + sudo sleep 10 + # These are older libs that breaks tomcat 7 + sudo rm /var/lib/tomcat7/webapps/web.rya/WEB-INF/lib/servlet-api-2.5*.jar + sudo rm /var/lib/tomcat7/webapps/web.rya/WEB-INF/lib/jsp-api-2.1.jar + + echo "Modify Rya Web Config" + cat > /var/lib/tomcat7/webapps/web.rya/WEB-INF/classes/environment.properties <<EOF +instance.name=dev +instance.zk=localhost:2181 +instance.username=root +instance.password=root +rya.tableprefix=rya_ +rya.displayqueryplan=true +EOF + + echo "Rya web deployed at http://rya-example-box:8080/web.rya/sparqlQuery.jsp" + + # restart tomcat + sudo service tomcat7 restart + + + + + + SHELL + +end http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/22f82c7a/extras/vagrantExample/src/main/vagrant/readme.md ---------------------------------------------------------------------- diff --git a/extras/vagrantExample/src/main/vagrant/readme.md b/extras/vagrantExample/src/main/vagrant/readme.md new file mode 100644 index 0000000..be36848 --- /dev/null +++ b/extras/vagrantExample/src/main/vagrant/readme.md @@ -0,0 +1,183 @@ +<!-- + +[comment]: # Licensed to the Apache Software Foundation (ASF) under one +[comment]: # or more contributor license agreements. See the NOTICE file +[comment]: # distributed with this work for additional information +[comment]: # regarding copyright ownership. The ASF licenses this file +[comment]: # to you under the Apache License, Version 2.0 (the +[comment]: # "License"); you may not use this file except in compliance +[comment]: # with the License. You may obtain a copy of the License at +[comment]: # +[comment]: # http://www.apache.org/licenses/LICENSE-2.0 +[comment]: # +[comment]: # Unless required by applicable law or agreed to in writing, +[comment]: # software distributed under the License is distributed on an +[comment]: # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +[comment]: # KIND, either express or implied. See the License for the +[comment]: # specific language governing permissions and limitations +[comment]: # under the License. + +--> + +# Rya Vagrant Example Documentation + +The Rya Vagrant Example project allows users to quickly get up and running on Rya using a Virtual Machine. Specifically, this project uses Vagrant to create a VM, install Rya on Accumulo, and configure the OpenRDF Workbench Web Application to use Rya. + +## Setting up the VM + +### Installing Vagrant + +The Rya Example Box VM requires Vagrant to install, configure, and run the VM. Vagrant is freely available for many host operating systems. More information about Vagrant (including installers) are available at <https://www.vagrantup.com/> + +The Rya Example Box was developed using Vagrant 1.7.4 and Oracle Virtual Box 5.0.6. + +If a user would rather not use Vagrant, expert users should be able to read through the [Rya-Example-Box Vagrantfile][pathToVF] and understand the operations that the Vagrantfile is performing to configure the VM for Rya. These operations should be applicable to other Linux machines and VMs. + +### Starting up the VM + +Once Vagrant is installed, starting up the Rya-Example-Box is fairly straightforward. + +1. Create a custom directory for the Rya Example Box (e.g., for windows users `c:\users\<user>\ryavagrant` or for Mac/Linux users `/home/<user>/ryavagrant`) + +1. Download the [Rya-Example-Box Vagrantfile][pathToVF] to the custom directory. Note that it must be named `Vagrantfile` with no extension. + +1. Open a DOS prompt (Windows) or Terminal (Mac/Linux), change to the custom directory, and issue the command `vagrant up`. Note that it may take up to 30 minutes to download, install, and configure Rya and all of the components. + +### Verification + +By default, the VM should be assigned the IP address of `192.168.33.10`. This value is defined in the Vagrantfile and it is configurable. All of the procedures in this in this document assume that the hostname `rya-example-box` resolves to the VMâs IP address `192.168.33.10`. The easiest way to do this is to add the entry `192.168.33.10 rya-example-box` to your machineâs host file (e.g., for windows users modify `C:\Windows\System32\drivers\etc\hosts` or for Mac/Linux users modify `/etc/hosts`) + +1. **Verify the Tomcat instance**: Open a browser to <http://rya-example-box:8080/>. You should see a webpage that says âIt works! If you're seeing this page via a web browser, it means you've setup Tomcat successfully. Congratulations!â + +1. **Verify the deployed OpenRDF Sesame service**: Open your browser to <http://rya-example-box:8080/openrdf-sesame/protocol> and you should see a â6â (this is the OpenRDF Protocol Version). + +1. **Verify the deployed OpenRDF Workbench**: Open your browser to <http://rya-example-box:8080/openrdf-workbench> + +1. **Verify the deployed Rya Web**: Open your browser to <http://rya-example-box:8080/web.rya/sparqlQuery.jsp> + +1. **Ssh into into the VM**: SSH from your host machine to `rya-example-box` with user/pass of vagrant/vagrant. + +1. **Test the Accumulo shell**: After ssh'ing into the VM, run the command: `/home/vagrant/accumulo-1.6.4/bin/accumulo shell -u root -p root` + +### Common Errors on the VM + +Most of the time, the Vagrant script works perfectly and passes all of the verification. However, below are a list of the common issues that we've seen and how to mitigate those issues + +#### Rya libraries are not installed +Run these two commands and see if you have any Rya files in the two lib directories: + +``` + ls /var/lib/tomcat7/webapps/openrdf-sesame/WEB-INF/lib/rya* + ls /var/lib/tomcat7/webapps/openrdf-workbench/WEB-INF/lib/rya* +``` + +If these files do note exists, open the vagrant file and look for the line `echo "Downloading Rya"`. Try working through those commands manually on your Vagrant VM. + +#### OpenRDF Workbench transformations are not installed + +OpenRDF Workbench requires a set of "transformations" for listing Rya in the OpenRDF Workbench Repository list. The transforms are in this directory: /var/lib/tomcat7/webapps/openrdf-workbench/transformations/ + +1. Verify that this file exists: create-RyaAccumuloSail.xsl +1. Verify that create.xsl has been updated for rya. (run: "cat create.xsl | grep Rya" and make sure there's some stuff there.) + + +If these files do note exists, open the vagrant file and look for the line `echo "Downloading Rya"`. Try working through those commands manually on your Vagrant VM. + +#### Other useful commands + +Below is a list of other useful commands on the VMs + +*Restart Tomcat* + +1. Log into the vm (run: `ssh vagrant@rya-example-box` with pass: `vagrant`) +2. Switch to root (run: `su` with pass: `vagrant`) +3. Restart tomcat (run: `service tomcat7 restart`) + +*Restart Accumulo* + +1. Log into the vm (run: `ssh vagrant@rya-example-box` with pass: `vagrant`) +1. Switch to root (run: `su` with pass: `vagrant`) +1. Stop Accumulo (run: `/home/vagrant/accumulo-1.6.4/bin/stop-all.sh`) + * If `stop-all` doesn't complete, hit `ctrl-c` once and you should see `Initiating forced shutdown in 15 seconds`. Wait 15 seconds +1. Start Accumulo (run: `/home/vagrant/accumulo-1.6.4/bin/start-all.sh`) + +*Test and Restart Zookeeper* + +1. Log into the vm (run: `ssh vagrant@rya-example-box` with pass: `vagrant`) +1. Switch to root (run: `su` with pass: `vagrant`) +1. Ping Zookeeper (run: `echo ruok | nc 127.0.0.1 2181`). + * If Zookeeper is okay, you should see the response `imok` + * Otherwise, restart Zookeeper (run `/home/vagrant/zookeeper-3.4.5-cdh4.5.0/bin/zkServer.sh start`) + +## Interacting with Rya on the VM + +### Connecting to Rya via OpenRDF Workbench + +The first step to using Rya via the OpenRDF Workbench is to create a repository using the Rya Accumulo Store connector. + +1. Open your browser to the [OpenRDF Workbench](http://rya-example-box:8080/openrdf-workbench) +2. Click on `New Repository` +3. Choose "Type" of `Rya Accumulo Store`, a Repository "ID" (e.g., `RyaAccumulo`), and a Repository "Title" (e.g., `Rya Accumulo`). Click on `Next` when complete. +4. Enter the Rya Accumulo Store connection parameters. The default parameters will connect to the Rya Example Box Acccumulo deployment (i.e., Accumulo User: `root`, Accumulo Password: `root`, Accumulo Instance: `dev`, Zookeepers: `localhost`, is Mock?: `false`). Click on `Create` when complete. + +### Uploading Data via OpenRDF Workbench + +Once we've created a Rya repository, we can load data into Rya via the OpenRDF Workbench. + +1. Open your browser to the [OpenRDF Workbench](http://rya-example-box:8080/openrdf-workbench) +1. Verify that OpenRDF Workbench is connected to Rya. The OpenRDF Workbench screen should have `Current Selections: Repository: Rya Accumulo ( RyaAccumulo )` at the top of the page. +2. Click on `Add` on the left side of the page. +3. This page allows a user to add data either through a local file (uploaded through the browser), cut-and-pasted RDF, or a file located on the web. For this example, let's choose a file on the web. Set "Data Format" to `RDF/XML` and "Location of the RDF data you wish to upload" to `http://telegraphis.net/data/currencies/currencies.rdf`. All other fields should remain empty. Click on `Upload` when complete. + +### Querying Data via OpenRDF Workbench + +Once we've created a Rya repository and uploaded data, we can query Rya via the OpenRDF Workbench. + +1. Open your browser to the [OpenRDF Workbench](http://rya-example-box:8080/openrdf-workbench) +1. Verify that OpenRDF Workbench is connected to Rya. The OpenRDF Workbench screen should have `Current Selections: Repository: Rya Accumulo ( RyaAccumulo )` at the top of the page. +1. Click on `Query` on the left side of the page. +1. Use the example SPARQL query below to query for Currencies with a Short Name of "dollar" + ``` + PREFIX money:<http://telegraphis.net/ontology/money/money#> + + select ?name where { + ?x a money:Currency . + ?x money:shortName "dollar" . + ?x money:name ?name . + } + ``` + +### Using the OpenRDF REST Service + +More information about the Sesame REST HTTP Protocol is availible in the [OpenRDF 2.7 Docs] (http://rdf4j.org/sesame/2.7/docs/system.docbook?view#The_Sesame_REST_HTTP_Protocol) + +### Using Rya Java Client +TODO + +### Using Rya Web Client + +The Rya Web Client provides a user a web gui to query Rya. Once data has been loaded into Rya, we can run the same query as before + +1. Open your browser to the [Rya Web](http://rya-example-box:8080/web.rya/sparqlQuery.jsp) page. +1. Use the example SPARQL query below to query for Currencies with a Short Name of "dollar" + ``` + PREFIX money:<http://telegraphis.net/ontology/money/money#> + + select ?name where { + ?x a money:Currency . + ?x money:shortName "dollar" . + ?x money:name ?name . + } + ``` +1. You should see an XML document with the results. + +## Developing Rya on the VM +TODO + +### Enabling Secondary Indexing +TODO + +### Resizing the VMs Disk space +Instructions for resizing a Vagrant/VirtualBox image can be found [here] (http://www.midwesternmac.com/blogs/jeff-geerling/resizing-virtualbox-disk-image) + +[pathToVF]: Vagrantfile http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/22f82c7a/sail/src/main/java/mvm/rya/rdftriplestore/RdfCloudTripleStoreFactory.java ---------------------------------------------------------------------- diff --git a/sail/src/main/java/mvm/rya/rdftriplestore/RdfCloudTripleStoreFactory.java b/sail/src/main/java/mvm/rya/rdftriplestore/RdfCloudTripleStoreFactory.java deleted file mode 100644 index 42f1aa4..0000000 --- a/sail/src/main/java/mvm/rya/rdftriplestore/RdfCloudTripleStoreFactory.java +++ /dev/null @@ -1,56 +0,0 @@ -package mvm.rya.rdftriplestore; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - - - -import org.openrdf.sail.Sail; -import org.openrdf.sail.config.SailConfigException; -import org.openrdf.sail.config.SailFactory; -import org.openrdf.sail.config.SailImplConfig; - -public class RdfCloudTripleStoreFactory implements SailFactory { - - public static final String SAIL_TYPE = "openrdf:RdfCloudTripleStore"; - - @Override - public SailImplConfig getConfig() { - return new RdfCloudTripleStoreSailConfig(); - } - - @Override - public Sail getSail(SailImplConfig config) throws SailConfigException { -// RdfCloudTripleStore cbStore = new RdfCloudTripleStore(); -// RdfCloudTripleStoreSailConfig cbconfig = (RdfCloudTripleStoreSailConfig) config; -// cbStore.setServer(cbconfig.getServer()); -// cbStore.setPort(cbconfig.getPort()); -// cbStore.setInstance(cbconfig.getInstance()); -// cbStore.setPassword(cbconfig.getPassword()); -// cbStore.setUser(cbconfig.getUser()); -// return cbStore; - return null; //TODO: How? - } - - @Override - public String getSailType() { - return SAIL_TYPE; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/22f82c7a/sail/src/main/java/mvm/rya/rdftriplestore/RdfCloudTripleStoreSailConfig.java ---------------------------------------------------------------------- diff --git a/sail/src/main/java/mvm/rya/rdftriplestore/RdfCloudTripleStoreSailConfig.java b/sail/src/main/java/mvm/rya/rdftriplestore/RdfCloudTripleStoreSailConfig.java deleted file mode 100644 index 6542b55..0000000 --- a/sail/src/main/java/mvm/rya/rdftriplestore/RdfCloudTripleStoreSailConfig.java +++ /dev/null @@ -1,133 +0,0 @@ -package mvm.rya.rdftriplestore; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - - - -import org.openrdf.model.*; -import org.openrdf.model.impl.ValueFactoryImpl; -import org.openrdf.model.util.GraphUtil; -import org.openrdf.model.util.GraphUtilException; -import org.openrdf.sail.config.SailConfigException; -import org.openrdf.sail.config.SailImplConfigBase; - -public class RdfCloudTripleStoreSailConfig extends SailImplConfigBase { - - public static final String NAMESPACE = "http://www.openrdf.org/config/sail/cloudbasestore#"; - - public static final URI SERVER; - public static final URI PORT; - public static final URI INSTANCE; - public static final URI USER; - public static final URI PASSWORD; - - static { - ValueFactory factory = ValueFactoryImpl.getInstance(); - SERVER = factory.createURI(NAMESPACE, "server"); - PORT = factory.createURI(NAMESPACE, "port"); - INSTANCE = factory.createURI(NAMESPACE, "instance"); - USER = factory.createURI(NAMESPACE, "user"); - PASSWORD = factory.createURI(NAMESPACE, "password"); - } - - private String server = "stratus13"; - - private int port = 2181; - - private String user = "root"; - - private String password = "password"; - - private String instance = "stratus"; - - public String getServer() { - return server; - } - - public void setServer(String server) { - this.server = server; - } - - public int getPort() { - return port; - } - - public void setPort(int port) { - this.port = port; - } - - public String getUser() { - return user; - } - - public void setUser(String user) { - this.user = user; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - public String getInstance() { - return instance; - } - - public void setInstance(String instance) { - this.instance = instance; - } - - @Override - public void parse(Graph graph, Resource implNode) - throws SailConfigException - { - super.parse(graph, implNode); - System.out.println("parsing"); - - try { - Literal serverLit = GraphUtil.getOptionalObjectLiteral(graph, implNode, SERVER); - if (serverLit != null) { - setServer(serverLit.getLabel()); - } - Literal portLit = GraphUtil.getOptionalObjectLiteral(graph, implNode, PORT); - if (portLit != null) { - setPort(Integer.parseInt(portLit.getLabel())); - } - Literal instList = GraphUtil.getOptionalObjectLiteral(graph, implNode, INSTANCE); - if (instList != null) { - setInstance(instList.getLabel()); - } - Literal userLit = GraphUtil.getOptionalObjectLiteral(graph, implNode, USER); - if (userLit != null) { - setUser(userLit.getLabel()); - } - Literal pwdLit = GraphUtil.getOptionalObjectLiteral(graph, implNode, PASSWORD); - if (pwdLit != null) { - setPassword(pwdLit.getLabel()); - } - } - catch (GraphUtilException e) { - throw new SailConfigException(e.getMessage(), e); - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/22f82c7a/sail/src/main/resources/META-INF/org.openrdf.store.schemas ---------------------------------------------------------------------- diff --git a/sail/src/main/resources/META-INF/org.openrdf.store.schemas b/sail/src/main/resources/META-INF/org.openrdf.store.schemas deleted file mode 100644 index ad9993f..0000000 --- a/sail/src/main/resources/META-INF/org.openrdf.store.schemas +++ /dev/null @@ -1 +0,0 @@ -META-INF/schemas/cloudbasestore-schema.ttl \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/22f82c7a/sail/src/main/resources/META-INF/schemas/cloudbasestore-schema.ttl ---------------------------------------------------------------------- diff --git a/sail/src/main/resources/META-INF/schemas/cloudbasestore-schema.ttl b/sail/src/main/resources/META-INF/schemas/cloudbasestore-schema.ttl deleted file mode 100644 index 708a964..0000000 --- a/sail/src/main/resources/META-INF/schemas/cloudbasestore-schema.ttl +++ /dev/null @@ -1,20 +0,0 @@ -@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>. -@prefix rep: <http://www.openrdf.org/config/repository#>. -@prefix sr: <http://www.openrdf.org/config/repository/sail#>. -@prefix sail: <http://www.openrdf.org/config/sail#>. -@prefix cbs: <http://www.openrdf.org/config/sail/cloudbasestore#>. - -[] a rep:Repository ; - rep:repositoryID "{%Repository ID|cloudbasestore%}" ; - rdfs:label "{%Repository title|Cloudbase store%}" ; - rep:repositoryImpl [ - rep:repositoryType "openrdf:SailRepository" ; - sr:sailImpl [ - sail:sailType "openrdf:RdfCloudTripleStore" ; - cbs:server "{%CBSail server|stratus13%}" ; - cbs:port "{%CBSail port|2181%}" ; - cbs:instance "{%CBSail instance|stratus%}" ; - cbs:user "{%CBSail user|root%}" ; - cbs:password "{%CBSail password|password%}" ; - ] - ]. \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/22f82c7a/sail/src/main/resources/META-INF/services/org.openrdf.sail.config.SailFactory ---------------------------------------------------------------------- diff --git a/sail/src/main/resources/META-INF/services/org.openrdf.sail.config.SailFactory b/sail/src/main/resources/META-INF/services/org.openrdf.sail.config.SailFactory deleted file mode 100644 index 09a0661..0000000 --- a/sail/src/main/resources/META-INF/services/org.openrdf.sail.config.SailFactory +++ /dev/null @@ -1 +0,0 @@ -mvm.rya.rdftriplestore.RdfCloudTripleStoreFactory \ No newline at end of file
