http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/44a2dcf0/common/rya.api/src/main/java/mvm/rya/api/domain/Node.java ---------------------------------------------------------------------- diff --git a/common/rya.api/src/main/java/mvm/rya/api/domain/Node.java b/common/rya.api/src/main/java/mvm/rya/api/domain/Node.java deleted file mode 100644 index f5ca08c..0000000 --- a/common/rya.api/src/main/java/mvm/rya/api/domain/Node.java +++ /dev/null @@ -1,38 +0,0 @@ -package mvm.rya.api.domain; - -/* - * 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.impl.URIImpl; - -/** - * A Node is an expected node in the global graph. This typing of the URI allows us to dictate the difference between a - * URI that is just an Attribute on the subject vs. a URI that is another subject Node in the global graph. It does not - * guarantee that the subject exists, just that there is an Edge to it. - */ -public class Node extends URIImpl { - public Node() { - } - - public Node(String uriString) { - super(uriString); - } -}
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/44a2dcf0/common/rya.api/src/main/java/mvm/rya/api/domain/RangeURI.java ---------------------------------------------------------------------- diff --git a/common/rya.api/src/main/java/mvm/rya/api/domain/RangeURI.java b/common/rya.api/src/main/java/mvm/rya/api/domain/RangeURI.java deleted file mode 100644 index 67d5742..0000000 --- a/common/rya.api/src/main/java/mvm/rya/api/domain/RangeURI.java +++ /dev/null @@ -1,52 +0,0 @@ -package mvm.rya.api.domain; - -/* - * 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.URI; -import org.openrdf.model.Value; - -/** - * Created by IntelliJ IDEA. - * Date: 4/11/12 - * Time: 1:03 PM - * To change this template use File | Settings | File Templates. - */ -public class RangeURI extends RangeValue<URI> implements URI { - - public RangeURI(URI start, URI end) { - super(start, end); - } - - public RangeURI(RangeValue rangeValue) { - super((URI) rangeValue.getStart(), (URI) rangeValue.getEnd()); - } - - @Override - public String getNamespace() { - throw new UnsupportedOperationException("Ranges do not have a namespace"); - } - - @Override - public String getLocalName() { - throw new UnsupportedOperationException("Ranges do not have a localname"); - } -} http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/44a2dcf0/common/rya.api/src/main/java/mvm/rya/api/domain/RangeValue.java ---------------------------------------------------------------------- diff --git a/common/rya.api/src/main/java/mvm/rya/api/domain/RangeValue.java b/common/rya.api/src/main/java/mvm/rya/api/domain/RangeValue.java deleted file mode 100644 index c27edfd..0000000 --- a/common/rya.api/src/main/java/mvm/rya/api/domain/RangeValue.java +++ /dev/null @@ -1,72 +0,0 @@ -package mvm.rya.api.domain; - -/* - * 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.Value; - -/** - * Created by IntelliJ IDEA. - * Date: 4/10/12 - * Time: 3:57 PM - * To change this template use File | Settings | File Templates. - */ -public class RangeValue<T extends Value> implements Value { - - private T start; - private T end; - - public RangeValue(T start, T end) { - this.start = start; - this.end = end; - } - - @Override - public String stringValue() { - throw new UnsupportedOperationException("Range is only supported at query time"); - } - - public T getStart() { - return start; - } - - public void setStart(T start) { - this.start = start; - } - - public T getEnd() { - return end; - } - - public void setEnd(T end) { - this.end = end; - } - - @Override - public String toString() { - final StringBuilder sb = new StringBuilder(); - sb.append("RangeValue"); - sb.append("{start=").append(start); - sb.append(", end=").append(end); - sb.append('}'); - return sb.toString(); - } -} http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/44a2dcf0/common/rya.api/src/main/java/mvm/rya/api/domain/RyaRange.java ---------------------------------------------------------------------- diff --git a/common/rya.api/src/main/java/mvm/rya/api/domain/RyaRange.java b/common/rya.api/src/main/java/mvm/rya/api/domain/RyaRange.java deleted file mode 100644 index e99f451..0000000 --- a/common/rya.api/src/main/java/mvm/rya/api/domain/RyaRange.java +++ /dev/null @@ -1,32 +0,0 @@ -package mvm.rya.api.domain; - -/* - * 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. - */ - - - -/** - * Date: 7/17/12 - * Time: 10:02 AM - */ -public interface RyaRange { - public RyaType getStart(); - - public RyaType getStop(); -} http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/44a2dcf0/common/rya.api/src/main/java/mvm/rya/api/domain/RyaSchema.java ---------------------------------------------------------------------- diff --git a/common/rya.api/src/main/java/mvm/rya/api/domain/RyaSchema.java b/common/rya.api/src/main/java/mvm/rya/api/domain/RyaSchema.java deleted file mode 100644 index 6744d20..0000000 --- a/common/rya.api/src/main/java/mvm/rya/api/domain/RyaSchema.java +++ /dev/null @@ -1,43 +0,0 @@ -package mvm.rya.api.domain; - -/* - * 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.api.RdfCloudTripleStoreConstants; -import org.openrdf.model.URI; - -/** - * Date: 7/16/12 - * Time: 11:59 AM - */ -public class RyaSchema { - - public static final String NAMESPACE = "urn:mvm.rya/2012/05#"; - public static final String AUTH_NAMESPACE = "urn:mvm.rya/auth/2012/05#"; - public static final String BNODE_NAMESPACE = "urn:mvm.rya/bnode/2012/07#"; - - //datatypes - public static final URI NODE = RdfCloudTripleStoreConstants.VALUE_FACTORY.createURI(NAMESPACE, "node"); - public static final URI LANGUAGE = RdfCloudTripleStoreConstants.VALUE_FACTORY.createURI(NAMESPACE, "lang"); - - //functions - public static final URI RANGE = RdfCloudTripleStoreConstants.VALUE_FACTORY.createURI(NAMESPACE, "range"); -} http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/44a2dcf0/common/rya.api/src/main/java/mvm/rya/api/domain/RyaStatement.java ---------------------------------------------------------------------- diff --git a/common/rya.api/src/main/java/mvm/rya/api/domain/RyaStatement.java b/common/rya.api/src/main/java/mvm/rya/api/domain/RyaStatement.java deleted file mode 100644 index 18bde98..0000000 --- a/common/rya.api/src/main/java/mvm/rya/api/domain/RyaStatement.java +++ /dev/null @@ -1,252 +0,0 @@ -package mvm.rya.api.domain; - -/* - * 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 java.util.Arrays; - -/** - * Date: 7/17/12 - * Time: 7:20 AM - */ -public class RyaStatement { - private RyaURI subject; - private RyaURI predicate; - private RyaType object; - private RyaURI context; - private String qualifer; - private byte[] columnVisibility; - private byte[] value; - private Long timestamp; - - public RyaStatement() { - } - - public RyaStatement(RyaURI subject, RyaURI predicate, RyaType object) { - this(subject, predicate, object, null); - } - - public RyaStatement(RyaURI subject, RyaURI predicate, RyaType object, RyaURI context) { - this(subject, predicate, object, context, null); - } - - public RyaStatement(RyaURI subject, RyaURI predicate, RyaType object, RyaURI context, String qualifier) { - this(subject, predicate, object, context, qualifier, null); - } - - public RyaStatement(RyaURI subject, RyaURI predicate, RyaType object, RyaURI context, String qualifier, byte[] columnVisibility) { - this(subject, predicate, object, context, qualifier, columnVisibility, null); - } - - public RyaStatement(RyaURI subject, RyaURI predicate, RyaType object, RyaURI context, String qualifier, byte[] columnVisibility, byte[] value) { - this(subject, predicate, object, context, qualifier, columnVisibility, value, null); - } - - public RyaStatement(RyaURI subject, RyaURI predicate, RyaType object, RyaURI context, String qualifier, byte[] columnVisibility, byte[] value, Long timestamp) { - this.subject = subject; - this.predicate = predicate; - this.object = object; - this.context = context; - this.qualifer = qualifier; - this.columnVisibility = columnVisibility; - this.value = value; - this.timestamp = timestamp != null ? timestamp : System.currentTimeMillis(); - } - - public RyaURI getSubject() { - return subject; - } - - public void setSubject(RyaURI subject) { - this.subject = subject; - } - - public RyaURI getPredicate() { - return predicate; - } - - public void setPredicate(RyaURI predicate) { - this.predicate = predicate; - } - - public RyaType getObject() { - return object; - } - - public void setObject(RyaType object) { - this.object = object; - } - - public RyaURI getContext() { - return context; - } - - public void setContext(RyaURI context) { - this.context = context; - } - - public byte[] getColumnVisibility() { - return columnVisibility; - } - - public void setColumnVisibility(byte[] columnVisibility) { - this.columnVisibility = columnVisibility; - } - - public byte[] getValue() { - return value; - } - - public void setValue(byte[] value) { - this.value = value; - } - - public Long getTimestamp() { - return timestamp; - } - - public void setTimestamp(Long timestamp) { - this.timestamp = timestamp; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - RyaStatement that = (RyaStatement) o; - - if (!Arrays.equals(columnVisibility, that.columnVisibility)) return false; - if (context != null ? !context.equals(that.context) : that.context != null) return false; - if (object != null ? !object.equals(that.object) : that.object != null) return false; - if (predicate != null ? !predicate.equals(that.predicate) : that.predicate != null) return false; - if (qualifer != null ? !qualifer.equals(that.qualifer) : that.qualifer != null) return false; - if (subject != null ? !subject.equals(that.subject) : that.subject != null) return false; - if (timestamp != null ? !timestamp.equals(that.timestamp) : that.timestamp != null) return false; - if (!Arrays.equals(value, that.value)) return false; - - return true; - } - - @Override - public int hashCode() { - int result = subject != null ? subject.hashCode() : 0; - result = 31 * result + (predicate != null ? predicate.hashCode() : 0); - result = 31 * result + (object != null ? object.hashCode() : 0); - result = 31 * result + (context != null ? context.hashCode() : 0); - result = 31 * result + (qualifer != null ? qualifer.hashCode() : 0); - result = 31 * result + (columnVisibility != null ? Arrays.hashCode(columnVisibility) : 0); - result = 31 * result + (value != null ? Arrays.hashCode(value) : 0); - result = 31 * result + (timestamp != null ? timestamp.hashCode() : 0); - return result; - } - - public String getQualifer() { - return qualifer; - } - - public void setQualifer(String qualifer) { - this.qualifer = qualifer; - } - - @Override - public String toString() { - final StringBuilder sb = new StringBuilder(); - sb.append("RyaStatement"); - sb.append("{subject=").append(subject); - sb.append(", predicate=").append(predicate); - sb.append(", object=").append(object); - sb.append(", context=").append(context); - sb.append(", qualifier=").append(qualifer); - sb.append(", columnVisibility=").append(columnVisibility == null ? "null" : new String(columnVisibility)); - sb.append(", value=").append(value == null ? "null" : new String(value)); - sb.append(", timestamp=").append(timestamp); - sb.append('}'); - return sb.toString(); - } - - public static RyaStatementBuilder builder() { - return new RyaStatementBuilder(); - } - - public static RyaStatementBuilder builder(RyaStatement ryaStatement) { - return new RyaStatementBuilder(ryaStatement); - } - - - //builder - public static class RyaStatementBuilder { - - RyaStatement ryaStatement; - - public RyaStatementBuilder() { - ryaStatement = new RyaStatement(); - } - - public RyaStatementBuilder(RyaStatement ryaStatement) { - this.ryaStatement = ryaStatement; - } - - public RyaStatementBuilder setTimestamp(Long timestamp) { - ryaStatement.setTimestamp(timestamp); - return this; - } - - public RyaStatementBuilder setValue(byte[] value) { - ryaStatement.setValue(value); - return this; - } - - public RyaStatementBuilder setColumnVisibility(byte[] columnVisibility) { - ryaStatement.setColumnVisibility(columnVisibility); - return this; - } - - public RyaStatementBuilder setQualifier(String str) { - ryaStatement.setQualifer(str); - return this; - } - - public RyaStatementBuilder setContext(RyaURI ryaURI) { - ryaStatement.setContext(ryaURI); - return this; - } - - public RyaStatementBuilder setSubject(RyaURI ryaURI) { - ryaStatement.setSubject(ryaURI); - return this; - } - - public RyaStatementBuilder setPredicate(RyaURI ryaURI) { - ryaStatement.setPredicate(ryaURI); - return this; - } - - public RyaStatementBuilder setObject(RyaType ryaType) { - ryaStatement.setObject(ryaType); - return this; - } - - public RyaStatement build() { - return ryaStatement; - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/44a2dcf0/common/rya.api/src/main/java/mvm/rya/api/domain/RyaType.java ---------------------------------------------------------------------- diff --git a/common/rya.api/src/main/java/mvm/rya/api/domain/RyaType.java b/common/rya.api/src/main/java/mvm/rya/api/domain/RyaType.java deleted file mode 100644 index 7a35253..0000000 --- a/common/rya.api/src/main/java/mvm/rya/api/domain/RyaType.java +++ /dev/null @@ -1,135 +0,0 @@ -package mvm.rya.api.domain; - -/* - * 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.URI; -import org.openrdf.model.vocabulary.XMLSchema; - -/** - * Base Rya Type - * Date: 7/16/12 - * Time: 11:45 AM - */ -public class RyaType implements Comparable { - - private URI dataType; - private String data; - - public RyaType() { - setDataType(XMLSchema.STRING); - } - - public RyaType(String data) { - this(XMLSchema.STRING, data); - } - - - public RyaType(URI dataType, String data) { - setDataType(dataType); - setData(data); - } - - /** - * TODO: Can we get away without using the openrdf URI - * - * @return - */ - public URI getDataType() { - return dataType; - } - - public String getData() { - return data; - } - - public void setDataType(URI dataType) { - this.dataType = dataType; - } - - public void setData(String data) { - this.data = data; - } - - @Override - public String toString() { - final StringBuilder sb = new StringBuilder(); - sb.append("RyaType"); - sb.append("{dataType=").append(dataType); - sb.append(", data='").append(data).append('\''); - sb.append('}'); - return sb.toString(); - } - - /** - * Determine equality based on string representations of data and datatype. - * @param o The object to compare with - * @return true if the other object is also a RyaType and both data and datatype match. - */ - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || !(o instanceof RyaType)) return false; - RyaType ryaType = (RyaType) o; - if (data != null ? !data.equals(ryaType.data) : ryaType.data != null) return false; - if (dataType != null ? !dataType.equals(ryaType.dataType) : ryaType.dataType != null) return false; - return true; - } - - /** - * Generate a hash based on the string representations of both data and datatype. - * @return A hash consistent with equals. - */ - @Override - public int hashCode() { - int result = dataType != null ? dataType.hashCode() : 0; - result = 31 * result + (data != null ? data.hashCode() : 0); - return result; - } - - /** - * Define a natural ordering based on data and datatype. - * @param o The object to compare with - * @return 0 if both the data string and the datatype string representation match between the objects, - * where matching is defined by string comparison or both being null; - * Otherwise, an integer whose sign yields a consistent ordering. - */ - @Override - public int compareTo(Object o) { - int result = -1; - if (o != null && o instanceof RyaType) { - result = 0; - RyaType other = (RyaType) o; - if (this.data != other.data) { - if (this.data == null) return 1; - if (other.data == null) return -1; - result = this.data.compareTo(other.data); - } - if (result == 0 && this.dataType != other.dataType) { - if (this.dataType == null) return 1; - if (other.dataType == null) return -1; - result = this.dataType.toString().compareTo(other.dataType.toString()); - } - } - return result; - } -} http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/44a2dcf0/common/rya.api/src/main/java/mvm/rya/api/domain/RyaTypePrefix.java ---------------------------------------------------------------------- diff --git a/common/rya.api/src/main/java/mvm/rya/api/domain/RyaTypePrefix.java b/common/rya.api/src/main/java/mvm/rya/api/domain/RyaTypePrefix.java deleted file mode 100644 index d394417..0000000 --- a/common/rya.api/src/main/java/mvm/rya/api/domain/RyaTypePrefix.java +++ /dev/null @@ -1,59 +0,0 @@ -package mvm.rya.api.domain; - -/* - * 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.URI; - -import static mvm.rya.api.RdfCloudTripleStoreConstants.DELIM; -import static mvm.rya.api.RdfCloudTripleStoreConstants.LAST; - -/** - * Date: 7/24/12 - * Time: 3:26 PM - */ -public class RyaTypePrefix extends RyaTypeRange { - - public RyaTypePrefix(URI datatype, String prefix) { - super(); - setPrefix(datatype, prefix); - } - - public RyaTypePrefix(String prefix) { - super(); - setPrefix(prefix); - } - - public void setPrefix(String prefix) { - setStart(new RyaType(prefix + DELIM)); - setStop(new RyaType(prefix + LAST)); - } - - public void setPrefix(URI datatype, String prefix) { - setStart(new RyaType(datatype, prefix + DELIM)); - setStop(new RyaType(datatype, prefix + LAST)); - } - - public String getPrefix() { - String data = getStart().getData(); - return data.substring(0, data.length() - 1); - } -} http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/44a2dcf0/common/rya.api/src/main/java/mvm/rya/api/domain/RyaTypeRange.java ---------------------------------------------------------------------- diff --git a/common/rya.api/src/main/java/mvm/rya/api/domain/RyaTypeRange.java b/common/rya.api/src/main/java/mvm/rya/api/domain/RyaTypeRange.java deleted file mode 100644 index a744399..0000000 --- a/common/rya.api/src/main/java/mvm/rya/api/domain/RyaTypeRange.java +++ /dev/null @@ -1,99 +0,0 @@ -package mvm.rya.api.domain; - -/* - * 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.URI; - -/** - * Date: 7/17/12 - * Time: 9:53 AM - */ -public class RyaTypeRange extends RyaType implements RyaRange { - private RyaType start; - private RyaType stop; - - public RyaTypeRange() { - } - - public RyaTypeRange(RyaType start, RyaType stop) { - this.start = start; - this.stop = stop; - } - - public RyaType getStart() { - return start; - } - - public void setStart(RyaType start) { - this.start = start; - } - - public RyaType getStop() { - return stop; - } - - public void setStop(RyaType stop) { - this.stop = stop; - } - - @Override - public URI getDataType() { - return start.getDataType(); - } - - @Override - public String getData() { - throw new UnsupportedOperationException(); - } - - @Override - public String toString() { - final StringBuilder sb = new StringBuilder(); - sb.append("RyaTypeRange"); - sb.append("{start=").append(start); - sb.append(", stop=").append(stop); - sb.append('}'); - return sb.toString(); - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - if (!super.equals(o)) return false; - - RyaTypeRange that = (RyaTypeRange) o; - - if (start != null ? !start.equals(that.start) : that.start != null) return false; - if (stop != null ? !stop.equals(that.stop) : that.stop != null) return false; - - return true; - } - - @Override - public int hashCode() { - int result = super.hashCode(); - result = 31 * result + (start != null ? start.hashCode() : 0); - result = 31 * result + (stop != null ? stop.hashCode() : 0); - return result; - } -} http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/44a2dcf0/common/rya.api/src/main/java/mvm/rya/api/domain/RyaURI.java ---------------------------------------------------------------------- diff --git a/common/rya.api/src/main/java/mvm/rya/api/domain/RyaURI.java b/common/rya.api/src/main/java/mvm/rya/api/domain/RyaURI.java deleted file mode 100644 index aa174c5..0000000 --- a/common/rya.api/src/main/java/mvm/rya/api/domain/RyaURI.java +++ /dev/null @@ -1,63 +0,0 @@ -package mvm.rya.api.domain; - -/* - * 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.URI; -import org.openrdf.model.util.URIUtil; -import org.openrdf.model.vocabulary.XMLSchema; - - -/** - * Date: 7/16/12 - * Time: 11:56 AM - */ -public class RyaURI extends RyaType { - - public RyaURI() { - setDataType(XMLSchema.ANYURI); - } - - public RyaURI(String data) { - super(XMLSchema.ANYURI, data); - } - - public RyaURI(String namespace, String data) { - super(XMLSchema.ANYURI, namespace + data); - } - - protected RyaURI(URI datatype, String data) { - super(datatype, data); - } - - @Override - public void setData(String data) { - super.setData(data); - validate(data); - } - - protected void validate(String data) { - if (data == null) - throw new IllegalArgumentException("Null not URI"); - URIUtil.getLocalNameIndex(data); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/44a2dcf0/common/rya.api/src/main/java/mvm/rya/api/domain/RyaURIPrefix.java ---------------------------------------------------------------------- diff --git a/common/rya.api/src/main/java/mvm/rya/api/domain/RyaURIPrefix.java b/common/rya.api/src/main/java/mvm/rya/api/domain/RyaURIPrefix.java deleted file mode 100644 index f808607..0000000 --- a/common/rya.api/src/main/java/mvm/rya/api/domain/RyaURIPrefix.java +++ /dev/null @@ -1,47 +0,0 @@ -package mvm.rya.api.domain; - -/* - * 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.api.RdfCloudTripleStoreConstants; - -/** - * Date: 7/24/12 - * Time: 3:26 PM - */ -public class RyaURIPrefix extends RyaURIRange { - public static final String LAST = "\u00FF"; - - public RyaURIPrefix(String prefix) { - super(); - setPrefix(prefix); - } - - public void setPrefix(String prefix) { - setStart(new RyaURI(prefix + RdfCloudTripleStoreConstants.DELIM)); - setStop(new RyaURI(prefix + LAST)); - } - - public String getPrefix() { - String data = getStart().getData(); - return data.substring(0, data.length() - 1); - } -} http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/44a2dcf0/common/rya.api/src/main/java/mvm/rya/api/domain/RyaURIRange.java ---------------------------------------------------------------------- diff --git a/common/rya.api/src/main/java/mvm/rya/api/domain/RyaURIRange.java b/common/rya.api/src/main/java/mvm/rya/api/domain/RyaURIRange.java deleted file mode 100644 index 2c2b836..0000000 --- a/common/rya.api/src/main/java/mvm/rya/api/domain/RyaURIRange.java +++ /dev/null @@ -1,95 +0,0 @@ -package mvm.rya.api.domain; - -/* - * 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. - */ - - - -/** - * Date: 7/17/12 - * Time: 9:59 AM - */ -public class RyaURIRange extends RyaURI implements RyaRange { - public static final RyaURI LAST_URI = new RyaURI(((char) 255) + ":#" + ((char) 255)); - - private RyaURI start; - private RyaURI stop; - - public RyaURIRange() { - super(); - } - - public RyaURIRange(RyaURI start, RyaURI stop) { - this.start = start; - this.stop = stop; - } - - public RyaURI getStart() { - return start; - } - - public void setStart(RyaURI start) { - this.start = start; - } - - public RyaURI getStop() { - return stop; - } - - public void setStop(RyaURI stop) { - this.stop = stop; - } - - @Override - public String getData() { - throw new UnsupportedOperationException(); - } - - @Override - public String toString() { - final StringBuilder sb = new StringBuilder(); - sb.append("RyaURIRange"); - sb.append("{start=").append(start); - sb.append(", stop=").append(stop); - sb.append('}'); - return sb.toString(); - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - if (!super.equals(o)) return false; - - RyaURIRange that = (RyaURIRange) o; - - if (start != null ? !start.equals(that.start) : that.start != null) return false; - if (stop != null ? !stop.equals(that.stop) : that.stop != null) return false; - - return true; - } - - @Override - public int hashCode() { - int result = super.hashCode(); - result = 31 * result + (start != null ? start.hashCode() : 0); - result = 31 * result + (stop != null ? stop.hashCode() : 0); - return result; - } -} http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/44a2dcf0/common/rya.api/src/main/java/mvm/rya/api/instance/ConfigurationFields.java ---------------------------------------------------------------------- diff --git a/common/rya.api/src/main/java/mvm/rya/api/instance/ConfigurationFields.java b/common/rya.api/src/main/java/mvm/rya/api/instance/ConfigurationFields.java deleted file mode 100644 index 25212f4..0000000 --- a/common/rya.api/src/main/java/mvm/rya/api/instance/ConfigurationFields.java +++ /dev/null @@ -1,35 +0,0 @@ -package mvm.rya.api.instance; - -/* - * 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. - */ - -/** - * The possible configuration fields used in a Rya application. - * - * Note: The fields used here are from ConfigUtils.java, but this project - * doesn't have scope. - * TODO: Refactor ConfigUtils so this class is not needed. - */ -class ConfigurationFields { - static final String USE_GEO = "sc.use_geo"; - static final String USE_FREETEXT = "sc.use_freetext"; - static final String USE_TEMPORAL = "sc.use_temporal"; - static final String USE_ENTITY = "sc.use_entity"; - static final String USE_PCJ = "sc.use_pcj"; -} http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/44a2dcf0/common/rya.api/src/main/java/mvm/rya/api/instance/RyaDetails.java ---------------------------------------------------------------------- diff --git a/common/rya.api/src/main/java/mvm/rya/api/instance/RyaDetails.java b/common/rya.api/src/main/java/mvm/rya/api/instance/RyaDetails.java deleted file mode 100644 index 565b545..0000000 --- a/common/rya.api/src/main/java/mvm/rya/api/instance/RyaDetails.java +++ /dev/null @@ -1,1031 +0,0 @@ -package mvm.rya.api.instance; - -/* - * 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 java.util.Objects.requireNonNull; - -import java.io.Serializable; -import java.util.Date; -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Objects; - -import javax.annotation.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; -import javax.annotation.concurrent.Immutable; - -import com.google.common.base.Optional; -import com.google.common.collect.ImmutableMap; - -/** - * Details about how a Rya instance's state. - */ -@Immutable -@ParametersAreNonnullByDefault -public class RyaDetails implements Serializable { - private static final long serialVersionUID = 1L; - - // General metadata about the instance. - private final String instanceName; - private final String version; - - // Secondary Index Details. - private final EntityCentricIndexDetails entityCentricDetails; - private final GeoIndexDetails geoDetails; - private final PCJIndexDetails pcjDetails; - private final TemporalIndexDetails temporalDetails; - private final FreeTextIndexDetails freeTextDetails; - - // Statistics Details. - private final ProspectorDetails prospectorDetails; - private final JoinSelectivityDetails joinSelectivityDetails; - - /** - * Private to prevent initialization through the constructor. To build - * instances of this class, use the {@link Builder}. - */ - private RyaDetails( - final String instanceName, - final String version, - final EntityCentricIndexDetails entityCentricDetails, - final GeoIndexDetails geoDetails, - final PCJIndexDetails pcjDetails, - final TemporalIndexDetails temporalDetails, - final FreeTextIndexDetails freeTextDetails, - final ProspectorDetails prospectorDetails, - final JoinSelectivityDetails joinSelectivityDetails) { - this.instanceName = requireNonNull(instanceName); - this.version = requireNonNull(version); - this.entityCentricDetails = requireNonNull(entityCentricDetails); - this.geoDetails = requireNonNull(geoDetails); - this.pcjDetails = requireNonNull(pcjDetails); - this.temporalDetails = requireNonNull(temporalDetails); - this.freeTextDetails = requireNonNull(freeTextDetails); - this.prospectorDetails = requireNonNull(prospectorDetails); - this.joinSelectivityDetails = requireNonNull(joinSelectivityDetails); - } - - /** - * @return The name that uniquely identifies the instance of Rya within - * the system that hosts it. - */ - public String getRyaInstanceName() { - return instanceName; - } - - /** - * @return The version of Rya this instance uses. - */ - public String getRyaVersion() { - return version; - } - - /** - * @return Information about the instance's Entity Centric Index. - */ - public EntityCentricIndexDetails getEntityCentricIndexDetails() { - return entityCentricDetails; - } - - /** - * @return Information about the instance's Geospatial Index. - */ - public GeoIndexDetails getGeoIndexDetails() { - return geoDetails; - } - - /** - * @return Information about the instance's Precomputed Join Index. - */ - public PCJIndexDetails getPCJIndexDetails() { - return pcjDetails; - } - - /** - * @return Information about the instance's Temporal Index. - */ - public TemporalIndexDetails getTemporalIndexDetails() { - return temporalDetails; - } - - /** - * @return Information about the instance's Free Text Index. - */ - public FreeTextIndexDetails getFreeTextIndexDetails() { - return freeTextDetails; - } - - /** - * @return Information about the instance's Prospector Statistics. - */ - public ProspectorDetails getProspectorDetails() { - return prospectorDetails; - } - - /** - * @return Information about the instance's Join Selectivity Statistics. - */ - public JoinSelectivityDetails getJoinSelectivityDetails() { - return joinSelectivityDetails; - } - - @Override - public int hashCode() { - return Objects.hash( - instanceName, - version, - entityCentricDetails, - geoDetails, - pcjDetails, - temporalDetails, - freeTextDetails, - prospectorDetails, - joinSelectivityDetails); - } - - @Override - public boolean equals(final Object obj) { - if(this == obj) { - return true; - } - if(obj instanceof RyaDetails) { - final RyaDetails details = (RyaDetails) obj; - return Objects.equals(instanceName, details.instanceName) && - Objects.equals(version, details.version) && - Objects.equals(entityCentricDetails, details.entityCentricDetails) && - Objects.equals(geoDetails, details.geoDetails) && - Objects.equals(pcjDetails, details.pcjDetails) && - Objects.equals(temporalDetails, details.temporalDetails) && - Objects.equals(freeTextDetails, details.freeTextDetails) && - Objects.equals(prospectorDetails, details.prospectorDetails) && - Objects.equals(joinSelectivityDetails, details.joinSelectivityDetails); - } - return false; - } - - /** - * @return An empty instance of {@link Builder}. - */ - public static Builder builder() { - return new Builder(); - } - - /** - * @param detials - The builder will be initialized with this object's values. (not null) - * @return An instance of {@link Builder} that is initialized with a {@link RyaDetails}'s values. - */ - public static Builder builder(final RyaDetails details) { - return new Builder(details); - } - - /** - * Builds instances of {@link RyaDetails}. - */ - @ParametersAreNonnullByDefault - public static class Builder { - - // General metadata about the instance. - private String instanceName; - private String version; - - // Secondary Index Details. - private EntityCentricIndexDetails entityCentricDetails; - private GeoIndexDetails geoDetails; - private PCJIndexDetails.Builder pcjIndexDetailsBuilder; - private TemporalIndexDetails temporalDetails; - private FreeTextIndexDetails freeTextDetails; - - // Statistics Details. - private ProspectorDetails prospectorDetails; - private JoinSelectivityDetails joinSelectivityDetails; - - /** - * Construcst an empty instance of {@link Builder}. - */ - public Builder() { } - - /** - * Constructs an instance of {@link Builder} that is initialized with - * a {@link RyaDetails}'s values. - * - * @param detials - The builder will be initialized with this object's values. (not null) - */ - public Builder(final RyaDetails details) { - requireNonNull(details); - instanceName = details.instanceName; - version = details.version; - entityCentricDetails = details.entityCentricDetails; - geoDetails = details.geoDetails; - pcjIndexDetailsBuilder = PCJIndexDetails.builder( details.pcjDetails ); - temporalDetails = details.temporalDetails; - freeTextDetails = details.freeTextDetails; - prospectorDetails = details.prospectorDetails; - joinSelectivityDetails = details.joinSelectivityDetails; - } - - /** - * @param instanceName - The name that uniquely identifies the instance of Rya within - * the system that hosts it. - * @return This {@link Builder} so that method invocations may be chained. - */ - public Builder setRyaInstanceName(@Nullable final String instanceName) { - this.instanceName = instanceName; - return this; - } - - /** - * @param version - The version of Rya this instance uses. - * @return This {@link Builder} so that method invocations may be chained. - */ - public Builder setRyaVersion(@Nullable final String version) { - this.version = version; - return this; - } - - /** - * @param entityCentricDetails - Information about the instance's Entity Centric Index. - * @return This {@link Builder} so that method invocations may be chained. - */ - public Builder setEntityCentricIndexDetails(@Nullable final EntityCentricIndexDetails entityCentricDetails) { - this.entityCentricDetails = entityCentricDetails; - return this; - } - - /** - * - * @param geoDetails - Information about the instance's Geospatial Index. - * @return This {@link Builder} so that method invocations may be chained. - */ - public Builder setGeoIndexDetails(@Nullable final GeoIndexDetails geoDetails) { - this.geoDetails = geoDetails; - return this; - } - - /** - * @param temporalDetails - Information about the instance's Temporal Index. - * @return This {@link Builder} so that method invocations may be chained. - */ - public Builder setTemporalIndexDetails(@Nullable final TemporalIndexDetails temporalDetails) { - this.temporalDetails = temporalDetails; - return this; - } - - /** - * @param freeTextDetails - Information about the instance's Free Text Index. - * @return This {@link Builder} so that method invocations may be chained. - */ - public Builder setFreeTextDetails(@Nullable final FreeTextIndexDetails freeTextDetails) { - this.freeTextDetails = freeTextDetails; - return this; - } - - /** - * @param pcjDetails - Information about the instance's Precomputed Join Index. - * @return This {@link Builder} so that method invocations may be chained. - */ - public Builder setPCJIndexDetails(@Nullable final PCJIndexDetails.Builder pcjDetailsBuilder) { - this.pcjIndexDetailsBuilder = pcjDetailsBuilder; - return this; - } - - /** - * @return Get the {@link PCJIndexDetails.Builder} used to build the - * PCJ Index's details. - */ - public @Nullable PCJIndexDetails.Builder getPCJIndexDetails() { - return pcjIndexDetailsBuilder; - } - - /** - * @param prospectorDetails - Information about the instance's Prospector Statistics. - * @return This {@link Builder} so that method invocations may be chained. - */ - public Builder setProspectorDetails(@Nullable final ProspectorDetails prospectorDetails) { - this.prospectorDetails = prospectorDetails; - return this; - } - - /** - * @param joinSelectivityDetails - Information about the instance's Join Selectivity Statistics. - * @return This {@link Builder} so that method invocations may be chained. - */ - public Builder setJoinSelectivityDetails(@Nullable final JoinSelectivityDetails joinSelectivityDetails) { - this.joinSelectivityDetails = joinSelectivityDetails; - return this; - } - - /** - * @return An instance of {@link RyaDetails} built using this - * builder's values. - */ - public RyaDetails build() { - return new RyaDetails( - instanceName, - version, - entityCentricDetails, - geoDetails, - pcjIndexDetailsBuilder.build(), - temporalDetails, - freeTextDetails, - prospectorDetails, - joinSelectivityDetails); - } - } - - /** - * Details about a Rya instance's Geospatial Index. - */ - @Immutable - @ParametersAreNonnullByDefault - public static class GeoIndexDetails implements Serializable { - private static final long serialVersionUID = 1L; - - private final boolean enabled; - - /** - * Constructs an instance of {@link GeoIndexDetails}. - * - * @param enabled - Whether or not a Geospatial Index will be maintained by the Rya instance. - */ - public GeoIndexDetails(final boolean enabled) { - this.enabled = enabled; - } - - /** - * @return Whether or not a Geospatial Index will be maintained by the Rya instance. - */ - public boolean isEnabled() { - return enabled; - } - - @Override - public int hashCode() { - return Objects.hash( enabled ); - } - - @Override - public boolean equals(final Object obj) { - if(this == obj) { - return true; - } - if(obj instanceof GeoIndexDetails) { - final GeoIndexDetails details = (GeoIndexDetails) obj; - return enabled == details.enabled; - } - return false; - } - } - - /** - * Details about a Rya instance's Temporal Index. - */ - @Immutable - @ParametersAreNonnullByDefault - public static class TemporalIndexDetails implements Serializable { - private static final long serialVersionUID = 1L; - - private final boolean enabled; - - /** - * Constructs an instance of {@link TemporalIndexDetails}. - * - * @param enabled - Whether or not a Temporal Index will be maintained by the Rya instance. - */ - public TemporalIndexDetails(final boolean enabled) { - this.enabled = enabled; - } - - /** - * @return Whether or not a Temporal Index will be maintained by the Rya instance. - */ - public boolean isEnabled() { - return enabled; - } - - @Override - public int hashCode() { - return Objects.hash( enabled ); - } - - @Override - public boolean equals(final Object obj) { - if(this == obj) { - return true; - } - if(obj instanceof TemporalIndexDetails) { - final TemporalIndexDetails details = (TemporalIndexDetails) obj; - return enabled == details.enabled; - } - return false; - } - } - - /** - * Details about a Rya instance's Entity Centric Index. - */ - @Immutable - @ParametersAreNonnullByDefault - public static class EntityCentricIndexDetails implements Serializable { - private static final long serialVersionUID = 1L; - - private final boolean enabled; - - /** - * Constructs an instance of {@link EntityCentricIndexDetails}. - * - * @param enabled - Whether or not a Entity Centric Index will be maintained by the Rya instance. - */ - public EntityCentricIndexDetails(final boolean enabled) { - this.enabled = enabled; - } - - /** - * @return Whether or not a Entity Centric Index will be maintained by the Rya instance. - */ - public boolean isEnabled() { - return enabled; - } - - @Override - public int hashCode() { - return Objects.hash( enabled ); - } - - @Override - public boolean equals(final Object obj) { - if(this == obj) { - return true; - } - if(obj instanceof EntityCentricIndexDetails) { - final EntityCentricIndexDetails details = (EntityCentricIndexDetails) obj; - return enabled == details.enabled; - } - return false; - } - } - - /** - * Details about a Rya instance's Free Text Index. - */ - @Immutable - @ParametersAreNonnullByDefault - public static class FreeTextIndexDetails implements Serializable { - private static final long serialVersionUID = 1L; - - private final boolean enabled; - - /** - * Constructs an instance of {@link FreeTextIndexDetails}. - * - * @param enabled - Whether or not a Free Text Index will be maintained by the Rya instance. - */ - public FreeTextIndexDetails(final boolean enabled) { - this.enabled = enabled; - } - - /** - * @return Whether or not a Free Text Index will be maintained by the Rya instance. - */ - public boolean isEnabled() { - return enabled; - } - - @Override - public int hashCode() { - return Objects.hash( enabled ); - } - - @Override - public boolean equals(final Object obj) { - if(this == obj) { - return true; - } - if(obj instanceof FreeTextIndexDetails) { - final FreeTextIndexDetails details = (FreeTextIndexDetails) obj; - return enabled == details.enabled; - } - return false; - } - } - - /** - * Details about a Rya instance's PCJ Index. - */ - @Immutable - @ParametersAreNonnullByDefault - public static class PCJIndexDetails implements Serializable { - private static final long serialVersionUID = 1L; - - public final boolean enabled; - private final Optional<FluoDetails> fluoDetails; - private final ImmutableMap<String, PCJDetails> pcjDetails; - - /** - * Private to prevent initialization through the constructor. To build - * instances of this class, use the {@link Builder}. - * - * @param enabled - Whether or not a Precomputed Join Index will be maintained by the Rya instance. - * @param fluoDetails - Details about a Fluo application that is used to - * incrementally update PCJs if one has been installed for this RYA - * instance. (not null) - * @param pcjDetails - Details about the PCJs that have been created - * for this Rya instance. (not null) - */ - private PCJIndexDetails( - final boolean enabled, - final Optional<FluoDetails> fluoDetails, - final ImmutableMap<String, PCJDetails> pcjDetails) { - this.enabled = enabled; - this.fluoDetails = requireNonNull(fluoDetails); - this.pcjDetails = requireNonNull(pcjDetails); - } - - /** - * @return Whether or not a Precomputed Join Index will be maintained by the Rya instance. - */ - public boolean isEnabled() { - return enabled; - } - - /** - * @return Details about a Fluo application that is used to incrementally - * update PCJs if one has been installed for this RYA instance. - */ - public Optional<FluoDetails> getFluoDetails() { - return fluoDetails; - } - - /** - * @return Details about the PCJs that have been created for this Rya instance. - * The key is the PCJ ID and the value are the details for the ID. - */ - public ImmutableMap<String, PCJDetails> getPCJDetails() { - return pcjDetails; - } - - @Override - public int hashCode() { - return Objects.hash(enabled, fluoDetails, pcjDetails); - } - - @Override - public boolean equals(final Object obj) { - if(this == obj) { - return true; - } - if(obj instanceof PCJIndexDetails) { - final PCJIndexDetails details = (PCJIndexDetails) obj; - return Objects.equals(enabled, details.enabled) && - Objects.equals(fluoDetails, details.fluoDetails) && - Objects.equals(pcjDetails, details.pcjDetails); - } - return false; - } - - /** - * @return A new instance of {@link Builder}. - */ - public static Builder builder() { - return new Builder(); - } - - /** - * @param detials - The builder will be initialized with this object's values. (not null) - * @return An instance of {@link Builder} that is initialized with a {@link PCJIndexDetails}'s values. - */ - public static Builder builder(final PCJIndexDetails pcjIndexDetails) { - return new Builder(pcjIndexDetails); - } - - /** - * Builds instance of {@link PCJIndexDetails). - */ - @ParametersAreNonnullByDefault - public static class Builder { - - private Boolean enabled = null; - private FluoDetails fluoDetails = null; - private final Map<String, PCJDetails.Builder> pcjDetailsBuilders = new HashMap<>(); - - /** - * Constructs an empty instance of {@link Builder}. - */ - public Builder() { } - - /** - * Constructs an instance of {@link Builder} that is initialized with - * the values of a {@link PCJIndexDetails}. - * - * @param pcjIndexDetails - This objects values will be used to initialize - * the builder. (not null) - */ - public Builder(final PCJIndexDetails pcjIndexDetails) { - requireNonNull(pcjIndexDetails); - this.enabled = pcjIndexDetails.enabled; - this.fluoDetails = pcjIndexDetails.fluoDetails.orNull(); - - for(final PCJDetails pcjDetails : pcjIndexDetails.pcjDetails.values()) { - pcjDetailsBuilders.put(pcjDetails.getId(), PCJDetails.builder(pcjDetails)); - } - } - - /** - * @param enabled - Whether or not a Precomputed Join Index will be maintained by the Rya instance. - * @return This {@link Builder} so that method invocations may be chained. - */ - public Builder setEnabled(final Boolean enabled) { - this.enabled = enabled; - return this; - } - - /** - * @param fluoDetails - Details about a Fluo application that is used - * to incrementally update PCJs if one has been installed for this RYA instance. - * @return This {@link Builder} so that method invocations may be chained. - */ - public Builder setFluoDetails(@Nullable final FluoDetails fluoDetails) { - this.fluoDetails = fluoDetails; - return this; - } - - /** - * @param pcjDetails - Details about the PCJs that have been created for this Rya instance. - * @return This {@link Builder} so that method invocations may be chained. - */ - public Builder addPCJDetails(@Nullable final PCJDetails.Builder pcjDetailsBuilder) { - if(pcjDetailsBuilder != null) { - this.pcjDetailsBuilders.put(pcjDetailsBuilder.getId(), pcjDetailsBuilder); - } - return this; - } - - /** - * @param pcjId - The PCJ ID of the {@link PCJDetails.Builder} to remove. (not null) - * @return This {@link Builder} so that method invocations may be chained. - */ - public Builder removePCJDetails(@Nullable final String pcjId) { - requireNonNull(pcjId); - this.pcjDetailsBuilders.remove(pcjId); - return this; - } - - /** - * @return Builds an instance of {@link PCJIndexDetails} using this builder's values. - */ - public PCJIndexDetails build() { - final ImmutableMap.Builder<String, PCJDetails> pcjDetails = ImmutableMap.builder(); - for(final Entry<String, PCJDetails.Builder> entry : pcjDetailsBuilders.entrySet()) { - pcjDetails.put(entry.getKey(), entry.getValue().build()); - } - - return new PCJIndexDetails( - enabled, - Optional.fromNullable( fluoDetails ), - pcjDetails.build()); - } - } - - /** - * Details about a Fluo Incremental PCJ application that has been installed - * as part of this Rya instance. - */ - @Immutable - @ParametersAreNonnullByDefault - public static class FluoDetails implements Serializable { - private static final long serialVersionUID = 1L; - - private final String updateAppName; - - /** - * Constructs an instance of {@link FluoDetails}. - * - * @param updateAppName - The name of the Fluo application that is - * updating this Rya instance's incremental PCJs. (not null) - */ - public FluoDetails(final String updateAppName) { - this.updateAppName = requireNonNull(updateAppName); - } - - /** - * @return The name of the Fluo application. - */ - public String getUpdateAppName() { - return updateAppName; - } - - @Override - public int hashCode() { - return Objects.hash(updateAppName); - } - - @Override - public boolean equals(final Object obj) { - if(this == obj) { - return true; - } - if(obj instanceof FluoDetails) { - final FluoDetails details = (FluoDetails) obj; - return Objects.equals(updateAppName, details.updateAppName); - } - return false; - } - } - - /** - * Details about a specific PCJ that is being maintained within the Rya instance. - */ - @Immutable - @ParametersAreNonnullByDefault - public static class PCJDetails implements Serializable { - private static final long serialVersionUID = 1L; - - private final String id; - private final Optional<PCJUpdateStrategy> updateStrategy; - private final Optional<Date> lastUpdateTime; - - /** - * Private to prevent initialization through the constructor. To build - * instances of this class, use the {@link Builder}. - * - * @param id - Uniquely identifies the PCJ within this instance of Rya. (not null) - * @param updateStrategy - Describes how the PCJ is being updated. (not null) - * @param lastUpdateTime - The last time the PCJ was updated. This information - * may not be provided. (not null) - */ - private PCJDetails( - final String id, - final Optional<PCJUpdateStrategy> updateStrategy, - final Optional<Date> lastUpdateTime) { - this.id = requireNonNull(id); - this.updateStrategy = requireNonNull(updateStrategy); - this.lastUpdateTime = requireNonNull(lastUpdateTime); - } - - /** - * @return Uniquely identifies the PCJ within this instance of Rya. - */ - public String getId() { - return id; - } - - /** - * @return Describes how the PCJ is being updated. - */ - public Optional<PCJUpdateStrategy> getUpdateStrategy() { - return updateStrategy; - } - - /** - * @return The last time the PCJ was updated. This information - * may not be provided. - */ - public Optional<Date> getLastUpdateTime() { - return lastUpdateTime; - } - - @Override - public int hashCode() { - return Objects.hash(id, updateStrategy, lastUpdateTime); - } - - @Override - public boolean equals(final Object obj) { - if(this == obj) { - return true; - } - if(obj instanceof PCJDetails) { - final PCJDetails details = (PCJDetails) obj; - return Objects.equals(id, details.id) && - Objects.equals(updateStrategy, details.updateStrategy) && - Objects.equals(lastUpdateTime, details.lastUpdateTime); - } - return false; - } - - /** - * @return A new instance of {@link Builder}. - */ - public static Builder builder() { - return new Builder(); - } - - /** - * @param detials - The builder will be initialized with this object's values. (not null) - * @return An instance of {@link Builder} that is initialized with a {@link PCJDetails}' values. - */ - public static Builder builder(final PCJDetails details) { - return new Builder(details); - } - - /** - * Builds instance of {@link PCJDetails}. - */ - @ParametersAreNonnullByDefault - public static class Builder { - - private String id; - private PCJUpdateStrategy updateStrategy; - private Date lastUpdateTime; - - /** - * Constructs an instance of {@link Builder}. - */ - public Builder() { } - - /** - * Constructs an instance of {@link Builder} that is initialized with - * the values of a {@link PCJDetails}. - * - * @param details - This object's values will be used to initialize the builder. (not null) - */ - public Builder(final PCJDetails details) { - requireNonNull(details); - this.id = details.id; - this.updateStrategy = details.updateStrategy.orNull(); - this.lastUpdateTime = details.lastUpdateTime.orNull(); - } - - /** - * @return Uniquely identifies the PCJ within this instance of Rya. - */ - public @Nullable String getId() { - return id; - } - - /** - * @param id - Uniquely identifies the PCJ within this instance of Rya. - * @return This {@link Builder} so that method invocations may be chained. - */ - public Builder setId(@Nullable final String id) { - this.id = id; - return this; - } - - /** - * @return Describes how the PCJ is being updated. - */ - public PCJUpdateStrategy getUpdateStrategy() { - return updateStrategy; - } - - /** - * @param updateStrategy - Describes how the PCJ is being updated. - * @return This {@link Builder} so that method invocations may be chained. - */ - public Builder setUpdateStrategy(@Nullable final PCJUpdateStrategy updateStrategy) { - this.updateStrategy = updateStrategy; - return this; - } - - /** - * @return The last time the PCJ was updated. This information may not be provided. - */ - public @Nullable Date getLastUpdateTime() { - return lastUpdateTime; - } - - /** - * @param lastUpdateTime - The last time the PCJ was updated. This information - * may not be provided. - * @return This {@link Builder} so that method invocations may be chained. - */ - public Builder setLastUpdateTime(@Nullable final Date lastUpdateTime) { - this.lastUpdateTime = lastUpdateTime; - return this; - } - - /** - * @return An instance of {@link PCJDetails} built using this builder's values. - */ - public PCJDetails build() { - return new PCJDetails( - id, - Optional.fromNullable(updateStrategy), - Optional.fromNullable(lastUpdateTime)); - } - } - - /** - * Describes the different strategies that may be used to update a PCJ index. - */ - public static enum PCJUpdateStrategy { - /** - * The PCJ is being updated by periodically rebuilding all of the results. - */ - BATCH, - - /** - * The PCJ is being updated frequently and incrementally as new - * Statements are inserted into the Tya instance. - */ - INCREMENTAL; - } - } - } - - /** - * Details about a Rya instance's Prospector statistics. - */ - @Immutable - @ParametersAreNonnullByDefault - public static class ProspectorDetails implements Serializable { - private static final long serialVersionUID = 1L; - - private final Optional<Date> lastUpdated; - - /** - * Constructs an instance of {@link ProspectorDetails}. - * - * @param lastUpdated - The last time the Prospector statistics were updated for the Rya instance. (not null) - */ - public ProspectorDetails(final Optional<Date> lastUpdated) { - this.lastUpdated = requireNonNull(lastUpdated); - } - - /** - * @return The last time the Prospector statistics were updated for the Rya instance. - */ - public Optional<Date> getLastUpdated() { - return lastUpdated; - } - - @Override - public int hashCode() { - return Objects.hash( lastUpdated ); - } - - @Override - public boolean equals(final Object obj) { - if(this == obj) { - return true; - } - if(obj instanceof ProspectorDetails) { - final ProspectorDetails details = (ProspectorDetails) obj; - return Objects.equals(lastUpdated, details.lastUpdated); - } - return false; - } - } - - /** - * Details about a Rya instance's Join Selectivity statistics. - */ - @Immutable - @ParametersAreNonnullByDefault - public static class JoinSelectivityDetails implements Serializable { - private static final long serialVersionUID = 1L; - - private final Optional<Date> lastUpdated; - - /** - * Constructs an instance of {@link JoinSelectivityDetails}. - * - * @param lastUpdated - The last time the Join Selectivity statistics were updated for the Rya instance. (not null) - */ - public JoinSelectivityDetails(final Optional<Date> lastUpdated) { - this.lastUpdated = requireNonNull(lastUpdated); - } - - /** - * @return The last time the Join Selectivity statistics were updated for the Rya instance. - */ - public Optional<Date> getLastUpdated() { - return lastUpdated; - } - - @Override - public int hashCode() { - return Objects.hash( lastUpdated ); - } - - @Override - public boolean equals(final Object obj) { - if(this == obj) { - return true; - } - if(obj instanceof JoinSelectivityDetails) { - final JoinSelectivityDetails details = (JoinSelectivityDetails) obj; - return Objects.equals(lastUpdated, details.lastUpdated); - } - return false; - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/44a2dcf0/common/rya.api/src/main/java/mvm/rya/api/instance/RyaDetailsRepository.java ---------------------------------------------------------------------- diff --git a/common/rya.api/src/main/java/mvm/rya/api/instance/RyaDetailsRepository.java b/common/rya.api/src/main/java/mvm/rya/api/instance/RyaDetailsRepository.java deleted file mode 100644 index d05c65a..0000000 --- a/common/rya.api/src/main/java/mvm/rya/api/instance/RyaDetailsRepository.java +++ /dev/null @@ -1,123 +0,0 @@ -package mvm.rya.api.instance; - -/* - * 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 javax.annotation.ParametersAreNonnullByDefault; - -/** - * Provides access to the {@link RyaDetails} information that describes - * an instance of Rya. - */ -@ParametersAreNonnullByDefault -public interface RyaDetailsRepository { - - /** - * Check whether the details for this instance of Rya have been initialized or not. - * - * @return {@code true} if it has been initialized; otherwise {@code false}. - * @throws RyaDetailsRepositoryException Something caused this operation to fail. - */ - public boolean isInitialized() throws RyaDetailsRepositoryException; - - /** - * Initializes the {@link RyaDetails} that is stored for an instance of Rya. - * - * @param details - A Rya instance's details at installation time. (not null) - * @throws AlreadyInitializedException This repository has already been initialized. - * @throws RyaDetailsRepositoryException Something caused this operation to fail. - */ - public void initialize(RyaDetails details) throws AlreadyInitializedException, RyaDetailsRepositoryException; - - /** - * Get the {@link RyaDetails} that describe this instance of Rya. - * - * @return The details that describe this instance of Rya. - * @throws NotInitializedException The Rya instance's details have not been initialized yet. - * @throws RyaDetailsRepositoryException Something caused this operation to fail. - */ - public RyaDetails getRyaInstanceDetails() throws NotInitializedException, RyaDetailsRepositoryException; - - /** - * Update the {@link RyaDetails} that describe this instance of Rya. - * - * @param oldDetails - The copy of the details that have been updated. (not null) - * @param newDetails - The updated details. (not null) - * @throws NotInitializedException The Rya instance's details have not been initialized yet. - * @throws ConcurrentUpdateException An update couldn't be performed because - * the old state of the object no longer matches the current state. - * @throws RyaDetailsRepositoryException Something caused this operation to fail. - */ - public void update(RyaDetails oldDetails, RyaDetails newDetails) throws NotInitializedException, ConcurrentUpdateException, RyaDetailsRepositoryException; - - /** - * The root exception of all {@link RyaDetailsRepository} operations. - */ - public static class RyaDetailsRepositoryException extends Exception { - private static final long serialVersionUID = 1L; - - public RyaDetailsRepositoryException(final String message) { - super(message); - } - - public RyaDetailsRepositoryException(final String message, final Throwable cause) { - super(message, cause); - } - } - - /** - * You can not initialize a {@link RyaDetailsRepository} that has already - * been initialized. - */ - public static class AlreadyInitializedException extends RyaDetailsRepositoryException { - private static final long serialVersionUID = 1L; - - public AlreadyInitializedException(final String message) { - super(message); - } - } - - /** - * Some methods of {@link RyaDetailsRepository} may only be invoked after - * it has been initialized. - */ - public static class NotInitializedException extends RyaDetailsRepositoryException { - private static final long serialVersionUID = 1L; - - public NotInitializedException(final String message) { - super(message); - } - - public NotInitializedException(final String message, final Throwable cause) { - super(message, cause); - } - } - - /** - * An update couldn't be performed because the old state of the object no - * longer matches the current state. - */ - public static class ConcurrentUpdateException extends RyaDetailsRepositoryException { - private static final long serialVersionUID = 1L; - - public ConcurrentUpdateException(final String message) { - super(message); - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/44a2dcf0/common/rya.api/src/main/java/mvm/rya/api/instance/RyaDetailsToConfiguration.java ---------------------------------------------------------------------- diff --git a/common/rya.api/src/main/java/mvm/rya/api/instance/RyaDetailsToConfiguration.java b/common/rya.api/src/main/java/mvm/rya/api/instance/RyaDetailsToConfiguration.java deleted file mode 100644 index 8734adc..0000000 --- a/common/rya.api/src/main/java/mvm/rya/api/instance/RyaDetailsToConfiguration.java +++ /dev/null @@ -1,98 +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. - */ -package mvm.rya.api.instance; - -import static java.util.Objects.requireNonNull; - -import javax.annotation.ParametersAreNonnullByDefault; - -import org.apache.hadoop.conf.Configuration; -import org.apache.log4j.Logger; - -import com.google.common.base.Optional; - -/** - * Used to fetch {@link RyaDetails} from a {@link RyaDetailsRepository} and - * add them to the application's {@link Configuration}. - */ -@ParametersAreNonnullByDefault -public class RyaDetailsToConfiguration { - private static final Logger log = Logger.getLogger(RyaDetailsToConfiguration.class); - - /** - * Ensures the values in the {@link Configuration} do not conflict with the values in {@link RyaDetails}. - * If they do, the values in {@link RyaDetails} take precedent and the {@link Configuration} value will - * be overwritten. - * - * @param details - The {@link RyaDetails} to add to the {@link Configuration}. (not null) - * @param conf - The {@link Configuration} to add {@link RyaDetails} to. (not null) - */ - public static void addRyaDetailsToConfiguration(final RyaDetails details, final Configuration conf) { - requireNonNull(details); - requireNonNull(conf); - - checkAndSet(conf, ConfigurationFields.USE_ENTITY, details.getEntityCentricIndexDetails().isEnabled()); - checkAndSet(conf, ConfigurationFields.USE_FREETEXT, details.getFreeTextIndexDetails().isEnabled()); - checkAndSet(conf, ConfigurationFields.USE_GEO, details.getGeoIndexDetails().isEnabled()); - checkAndSet(conf, ConfigurationFields.USE_TEMPORAL, details.getTemporalIndexDetails().isEnabled()); - checkAndSet(conf, ConfigurationFields.USE_PCJ, details.getPCJIndexDetails().isEnabled()); - } - - /** - * Ensures a Rya Client will not try to use a secondary index that is not not supported by the Rya Instance - * it is connecting to. - * </p> - * If the configuration... - * <ul> - * <li>provides an 'on' value for an index that is supported, then nothing changes.</li> - * <li>provides an 'off' value for an index that is or is not supported, then nothing changes.</li> - * <li>provides an 'on' value for an index that is not supported, then the index is turned - * off and a warning is logged.</li> - * <li>does not provide any value for an index, then it will be turned on if supported.</li> - * </ul> - * - * @param conf - The {@link Configuration} to potentially change. (not null) - * @param useIndexField - The field within {@code conf} that indicates if the client will utilize the index. (not null) - * @param indexSupported - {@code true} if the Rya Instance supports the index; otherwise {@code false}. - */ - private static void checkAndSet(final Configuration conf, final String useIndexField, final boolean indexSupported) { - requireNonNull(conf); - requireNonNull(useIndexField); - - final Optional<String> useIndexStr = Optional.fromNullable( conf.get(useIndexField) ); - - // If no value was provided, default to using the index if it is supported. - if(!useIndexStr.isPresent()) { - log.info("No Rya Client configuration was provided for the " + useIndexField + - " index, so it is being defaulted to " + indexSupported); - conf.setBoolean(useIndexField, indexSupported); - return; - } - - // If configured to use the index, but the Rya Instance does not support it, then turn it off. - final boolean useIndex = Boolean.parseBoolean( useIndexStr.get() ); - if(useIndex && !indexSupported) { - log.warn("The Rya Client indicates it wants to use a secondary index that the Rya Instance does not support. " + - "This is not allowed, so the index will be turned off. Index Configuration Field: " + useIndexField); - conf.setBoolean(useIndexField, false); - } - - // Otherwise use whatever the Client wants to use. - } -} \ No newline at end of file
