You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2015/04/23 21:56:22 UTC
[06/51] [partial] jena git commit: Rename com.hp.hpl.jena.* as
org.apache.jena.*
http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/sparql_11/Token.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/sparql_11/Token.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/sparql_11/Token.java
deleted file mode 100644
index 601b8c2..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/sparql_11/Token.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/* Generated By:JavaCC: Do not edit this line. Token.java Version 5.0 */
-/* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COL=null,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
-package com.hp.hpl.jena.sparql.lang.sparql_11 ;
-
-/**
- * Describes the input token stream.
- */
-
-public class Token implements java.io.Serializable {
-
- /**
- * The version identifier for this Serializable class.
- * Increment only if the <i>serialized</i> form of the
- * class changes.
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * An integer that describes the kind of this token. This numbering
- * system is determined by JavaCCParser, and a table of these numbers is
- * stored in the file ...Constants.java.
- */
- public int kind;
-
- /** The line number of the first character of this Token. */
- public int beginLine;
- /** The column number of the first character of this Token. */
- public int beginColumn;
- /** The line number of the last character of this Token. */
- public int endLine;
- /** The column number of the last character of this Token. */
- public int endColumn;
-
- /**
- * The string image of the token.
- */
- public String image;
-
- /**
- * A reference to the next regular (non-special) token from the input
- * stream. If this is the last token from the input stream, or if the
- * token manager has not read tokens beyond this one, this field is
- * set to null. This is true only if this token is also a regular
- * token. Otherwise, see below for a description of the contents of
- * this field.
- */
- public Token next;
-
- /**
- * This field is used to access special tokens that occur prior to this
- * token, but after the immediately preceding regular (non-special) token.
- * If there are no such special tokens, this field is set to null.
- * When there are more than one such special token, this field refers
- * to the last of these special tokens, which in turn refers to the next
- * previous special token through its specialToken field, and so on
- * until the first special token (whose specialToken field is null).
- * The next fields of special tokens refer to other special tokens that
- * immediately follow it (without an intervening regular token). If there
- * is no such token, this field is null.
- */
- public Token specialToken;
-
- /**
- * An optional attribute value of the Token.
- * Tokens which are not used as syntactic sugar will often contain
- * meaningful values that will be used later on by the compiler or
- * interpreter. This attribute value is often different from the image.
- * Any subclass of Token that actually wants to return a non-null value can
- * override this method as appropriate.
- */
- public Object getValue() {
- return null;
- }
-
- /**
- * No-argument constructor
- */
- public Token() {}
-
- /**
- * Constructs a new token for the specified Image.
- */
- public Token(int kind)
- {
- this(kind, null);
- }
-
- /**
- * Constructs a new token for the specified Image and Kind.
- */
- public Token(int kind, String image)
- {
- this.kind = kind;
- this.image = image;
- }
-
- /**
- * Returns the image.
- */
- @Override public String toString()
- {
- return image;
- }
-
- /**
- * Returns a new Token object, by default. However, if you want, you
- * can create and return subclass objects based on the value of ofKind.
- * Simply add the cases to the switch for all those special cases.
- * For example, if you have a subclass of Token called IDToken that
- * you want to create if ofKind is ID, simply add something like :
- *
- * case MyParserConstants.ID : return new IDToken(ofKind, image);
- *
- * to the following switch statement. Then you can cast matchedToken
- * variable to the appropriate type and use sit in your lexical actions.
- */
- public static Token newToken(int ofKind, String image)
- {
- switch(ofKind)
- {
- default : return new Token(ofKind, image);
- }
- }
-
- public static Token newToken(int ofKind)
- {
- return newToken(ofKind, null);
- }
-
-}
-/* JavaCC - OriginalChecksum=5c2fdaf8c1922d90ffd35e0e3347f8a1 (do not edit this line) */
http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/sparql_11/TokenMgrError.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/sparql_11/TokenMgrError.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/sparql_11/TokenMgrError.java
deleted file mode 100644
index 86fb29d..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/sparql_11/TokenMgrError.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 5.0 */
-/* JavaCCOptions: */
-package com.hp.hpl.jena.sparql.lang.sparql_11 ;
-
-/** Token Manager Error. */
-public class TokenMgrError extends Error
-{
-
- /**
- * The version identifier for this Serializable class.
- * Increment only if the <i>serialized</i> form of the
- * class changes.
- */
- private static final long serialVersionUID = 1L;
-
- /*
- * Ordinals for various reasons why an Error of this type can be thrown.
- */
-
- /**
- * Lexical error occurred.
- */
- static final int LEXICAL_ERROR = 0;
-
- /**
- * An attempt was made to create a second instance of a static token manager.
- */
- static final int STATIC_LEXER_ERROR = 1;
-
- /**
- * Tried to change to an invalid lexical state.
- */
- static final int INVALID_LEXICAL_STATE = 2;
-
- /**
- * Detected (and bailed out of) an infinite loop in the token manager.
- */
- static final int LOOP_DETECTED = 3;
-
- /**
- * Indicates the reason why the exception is thrown. It will have
- * one of the above 4 values.
- */
- int errorCode;
-
- /**
- * Replaces unprintable characters by their escaped (or unicode escaped)
- * equivalents in the given string
- */
- protected static final String addEscapes(String str) {
- StringBuffer retval = new StringBuffer();
- char ch;
- for (int i = 0; i < str.length(); i++) {
- switch (str.charAt(i))
- {
- case 0 :
- continue;
- case '\b':
- retval.append("\\b");
- continue;
- case '\t':
- retval.append("\\t");
- continue;
- case '\n':
- retval.append("\\n");
- continue;
- case '\f':
- retval.append("\\f");
- continue;
- case '\r':
- retval.append("\\r");
- continue;
- case '\"':
- retval.append("\\\"");
- continue;
- case '\'':
- retval.append("\\\'");
- continue;
- case '\\':
- retval.append("\\\\");
- continue;
- default:
- if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
- String s = "0000" + Integer.toString(ch, 16);
- retval.append("\\u" + s.substring(s.length() - 4, s.length()));
- } else {
- retval.append(ch);
- }
- continue;
- }
- }
- return retval.toString();
- }
-
- /**
- * Returns a detailed message for the Error when it is thrown by the
- * token manager to indicate a lexical error.
- * Parameters :
- * EOFSeen : indicates if EOF caused the lexical error
- * curLexState : lexical state in which this error occurred
- * errorLine : line number when the error occurred
- * errorColumn : column number when the error occurred
- * errorAfter : prefix that was seen before this error occurred
- * curchar : the offending character
- * Note: You can customize the lexical error message by modifying this method.
- */
- protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) {
- return("Lexical error at line " +
- errorLine + ", column " +
- errorColumn + ". Encountered: " +
- (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") +
- "after : \"" + addEscapes(errorAfter) + "\"");
- }
-
- /**
- * You can also modify the body of this method to customize your error messages.
- * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not
- * of end-users concern, so you can return something like :
- *
- * "Internal Error : Please file a bug report .... "
- *
- * from this method for such cases in the release version of your parser.
- */
- @Override public String getMessage() {
- return super.getMessage();
- }
-
- /*
- * Constructors of various flavors follow.
- */
-
- /** No arg constructor. */
- public TokenMgrError() {
- }
-
- /** Constructor with message and reason. */
- public TokenMgrError(String message, int reason) {
- super(message);
- errorCode = reason;
- }
-
- /** Full Constructor. */
- public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) {
- this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason);
- }
-}
-/* JavaCC - OriginalChecksum=41e4390f78fa6b404b39840a0a206ba2 (do not edit this line) */
http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lib/DatasetLib.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lib/DatasetLib.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lib/DatasetLib.java
deleted file mode 100644
index 4f0b679..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lib/DatasetLib.java
+++ /dev/null
@@ -1,69 +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 com.hp.hpl.jena.sparql.lib;
-
-import org.apache.jena.atlas.io.IndentedWriter ;
-
-import com.hp.hpl.jena.query.Dataset ;
-import com.hp.hpl.jena.sparql.core.DatasetGraph ;
-import com.hp.hpl.jena.sparql.core.DatasetGraphFactory ;
-import com.hp.hpl.jena.sparql.sse.writers.WriterGraph ;
-import com.hp.hpl.jena.sparql.util.IsoMatcher ;
-
-public class DatasetLib
-{
- /** Write, in SSE format (a debugging format).
- */
- @Deprecated
- public static void dump(DatasetGraph dataset)
- {
- WriterGraph.output(IndentedWriter.stdout, dataset, null) ;
- IndentedWriter.stdout.flush();
- }
-
- /**
- * Return true if the datasets are isomorphic - same names for graphs, graphs isomorphic.
- * @deprecated Use {@link IsoMatcher#isomorphic(DatasetGraph, DatasetGraph)}
- */
- @Deprecated
- public static boolean isomorphic(Dataset dataset1, Dataset dataset2)
- {
- return isomorphic(dataset1.asDatasetGraph(), dataset2.asDatasetGraph()) ;
- }
-
- /**
- * Return true if the datasets are isomorphic - same names for graphs, graphs isomorphic.
- * @deprecated Use {@link IsoMatcher#isomorphic(DatasetGraph, DatasetGraph)}
- */
- @Deprecated
- public static boolean isomorphic(DatasetGraph dataset1, DatasetGraph dataset2)
- {
- return IsoMatcher.isomorphic(dataset1, dataset2) ;
- }
-
- // A DatasetGraph that creates memory graphs on mention
- /**
- * @deprecated Use {@link DatasetGraphFactory#createMem()}
- */
- @Deprecated
- public static DatasetGraph createDatasetGraphMem()
- {
- return DatasetGraphFactory.createMem() ;
- }
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lib/Metadata.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lib/Metadata.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lib/Metadata.java
deleted file mode 100644
index 00ad7f0..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lib/Metadata.java
+++ /dev/null
@@ -1,112 +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 com.hp.hpl.jena.sparql.lib;
-
-import java.io.IOException ;
-import java.io.InputStream ;
-import java.util.ArrayList ;
-import java.util.InvalidPropertiesFormatException ;
-import java.util.List ;
-import java.util.Properties ;
-
-import org.apache.jena.atlas.lib.SystemUtils ;
-import org.apache.jena.atlas.logging.Log ;
-
-import com.hp.hpl.jena.sparql.ARQException ;
-
-/** Simple wrapper for reading metadata, once, from a system resource.
- * Note that in some environments, it's tricky to get a class loader.
- */
-
-public class Metadata
-{
- private List<String> resources = new ArrayList<>() ;
- private Properties properties = new Properties() ;
-
- public Metadata() { }
-
- public Metadata(String resourceName)
- {
- this() ;
- addMetadata(resourceName) ;
- }
-
- public void addMetadata(String resourceName)
- {
- resources.add(resourceName) ;
- read(properties, resourceName) ;
- }
-
- // Protect all classloader choosing -- sometimes systems mess with even the system class loader.
- private static void read(Properties properties, String resourceName)
- {
- // Armour-plate this - classloaders and using them can be blocked by some environments.
- try {
- ClassLoader classLoader = null ;
-
- try { classLoader = SystemUtils.chooseClassLoader() ; } catch (ARQException ex) {}
-
- if (classLoader == null)
- {
- try { classLoader = Metadata.class.getClassLoader(); } catch (ARQException ex) {}
- }
-
- if ( classLoader == null )
- {
- Log.fatal(Metadata.class, "No classloader") ;
- return ;
- }
-
- InputStream in = classLoader.getResourceAsStream(resourceName) ;
- if ( in == null )
- //throw new ARQException("Failed to find the properties file") ;
- // In development, there is no properties file.
- return ;
-
- try { properties.loadFromXML(in) ; }
- catch (InvalidPropertiesFormatException ex)
- { throw new ARQException("Invalid properties file", ex) ; }
- catch (IOException ex)
- { throw new ARQException("Metadata ==> IOException", ex) ; }
- }
- catch (Throwable ex)
- {
- Log.fatal(Metadata.class, "Unexpected Thorwable", ex) ;
- return ;
- }
- }
-
- public String get(String name) { return get(name, null) ; }
-
- public String get(String name, String defaultValue)
- {
- if ( properties == null ) return defaultValue ;
- return properties.getProperty(name, defaultValue) ;
- }
-
- public List<String> getResources()
- {
- return resources ;
- }
-
- public Properties getProperties()
- {
- return properties ;
- }
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/mgt/ARQMgt.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/mgt/ARQMgt.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/mgt/ARQMgt.java
deleted file mode 100644
index 1c49d24..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/mgt/ARQMgt.java
+++ /dev/null
@@ -1,27 +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 com.hp.hpl.jena.sparql.mgt ;
-
-public class ARQMgt {
- // No-op version.
- // See JENA-614 and ARQMgt_X
- public static void init() {}
- public static void register(String name, Object bean) { }
- public static void unregister(String name) { }
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/mgt/ARQMgt_X.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/mgt/ARQMgt_X.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/mgt/ARQMgt_X.java
deleted file mode 100644
index 466a0cf..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/mgt/ARQMgt_X.java
+++ /dev/null
@@ -1,136 +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 com.hp.hpl.jena.sparql.mgt ;
-
-import java.lang.management.ManagementFactory ;
-import java.util.HashMap ;
-import java.util.Map ;
-
-import javax.management.* ;
-
-import org.apache.jena.atlas.lib.InternalErrorException ;
-import org.apache.jena.atlas.logging.Log ;
-import org.slf4j.Logger ;
-import org.slf4j.LoggerFactory ;
-
-import com.hp.hpl.jena.query.ARQ ;
-import com.hp.hpl.jena.sparql.ARQException ;
-import com.hp.hpl.jena.sparql.engine.QueryEngineBase ;
-
-/* Old version of the class which did JMX operations.
- * See JENA-614
- */
-class ARQMgt_X {
- // In some environments, JMX does not exist.
- static private Logger log = LoggerFactory.getLogger(ARQMgt_X.class) ;
- private static boolean initialized = false ;
- private static boolean noJMX = false ;
- private static Map<ObjectName, Object> mgtObjects = new HashMap<>() ;
- private static MBeanServer mbs = null ;
-
- public static synchronized void init() {
- if (initialized)
- return ;
- initialized = true ;
- if ( noJMX )
- return ;
-
- try {
- mbs = ManagementFactory.getPlatformMBeanServer() ;
- } catch (Throwable ex) {
- Log.debug(ARQMgt_X.class, "Failed to initialize JMX: "+ex.getMessage()) ;
- noJMX = true ;
- mbs = null ;
- }
- }
-
- public static void register() {
- init() ;
- String NS = ARQ.PATH ;
- ContextMBean cxtBean = new ContextMBean(ARQ.getContext()) ;
- QueryEngineInfo qeInfo = QueryEngineBase.queryEngineInfo ;
- // Done in ARQ initialization --
- // register(NS+".system:type=SystemInfo", ARQ.systemInfo) ;
- register(NS + ".system:type=Context", cxtBean) ;
- register(NS + ".system:type=Engine", qeInfo) ;
- }
-
- public static void register(String name, Object bean) {
- init() ;
- if (noJMX)
- return ;
- ObjectName objName = objectName(name) ;
- register(objName, bean) ;
- }
-
- public static void unregister(String name) {
- init() ;
- if (noJMX)
- return ;
- ObjectName objName = objectName(name) ;
- unregister(objName) ;
- }
-
- private static void register(ObjectName objName, Object bean) {
- try {
- // Unregister to avoid classloader problems.
- // A previous load of this class will have registered something
- // with the object name. Remove it - copes with reloading.
- // (Does not cope with multiple loads running in parallel.)
- if (mbs.isRegistered(objName)) {
- try {
- mbs.unregisterMBean(objName) ;
- } catch (InstanceNotFoundException ex) {}
- }
- log.debug("Register MBean: " + objName) ;
- mbs.registerMBean(bean, objName) ;
- // remember ...
- mgtObjects.put(objName, bean) ;
- } catch (NotCompliantMBeanException ex) {
- log.warn("Failed to register (NotCompliantMBeanException)'" + objName.getCanonicalName() + "': " + ex.getMessage()) ;
- throw new ARQException("Failed to register '" + objName.getCanonicalName() + "': " + ex.getMessage(), ex) ;
- } catch (InstanceAlreadyExistsException ex) {
- log.warn("Failed to register (InstanceAlreadyExistsException)'" + objName.getCanonicalName() + "': " + ex.getMessage()) ;
- throw new ARQException("Failed to register '" + objName.getCanonicalName() + "': " + ex.getMessage(), ex) ;
- } catch (MBeanRegistrationException ex) {
- log.warn("Failed to register (MBeanRegistrationException)'" + objName.getCanonicalName() + "': " + ex.getMessage()) ;
- throw new ARQException("Failed to register '" + objName.getCanonicalName() + "': " + ex.getMessage(), ex) ;
- }
- }
-
- private static void unregister(ObjectName objName) {
- log.debug("Unregister MBean: " + objName) ;
- if ( ! mgtObjects.containsKey(objName) )
- log.warn("MBean not already registered: " + objName) ;
- try {
- mbs.unregisterMBean(objName) ;
- }
- catch (InstanceNotFoundException ex) { } // Meh, whatever
- catch (MBeanRegistrationException ex) {
- throw new InternalErrorException(ex) ;
- }
- }
-
- private static ObjectName objectName(String name) {
- try { return new ObjectName(name) ; }
- catch (MalformedObjectNameException ex) {
- throw new ARQException("Failed to create name '" + name + "': " + ex.getMessage(), ex) ;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/mgt/ContextMBean.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/mgt/ContextMBean.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/mgt/ContextMBean.java
deleted file mode 100644
index ccc4a46..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/mgt/ContextMBean.java
+++ /dev/null
@@ -1,132 +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 com.hp.hpl.jena.sparql.mgt;
-
-import javax.management.* ;
-
-import com.hp.hpl.jena.sparql.util.Context ;
-import com.hp.hpl.jena.sparql.util.Symbol ;
-
-/** MBean for a context object (which can change) */
-public class ContextMBean implements DynamicMBean
-{
- private final Context context ;
-
- public ContextMBean(Context context)
- {
- this.context = context ;
- }
-
- private Object getAsString(String name) { return context.getAsString(Symbol.create(name)) ; }
-
- @Override
- public Object getAttribute(String attribute) throws AttributeNotFoundException, MBeanException, ReflectionException
- {
- return getAsString(attribute) ;
- }
-
- @Override
- public AttributeList getAttributes(String[] attributes)
- {
- AttributeList x = new AttributeList() ;
- for ( String k : attributes )
- {
- Attribute a = new Attribute(k, getAsString(k)) ;
- x.add(a) ;
- }
- return x ;
- }
-
- @Override
- public MBeanInfo getMBeanInfo()
- {
- /*
- * MBeanAttributeInfo(String name, String type, String description, boolean isReadable, boolean isWritable, boolean isIs)
- */
- MBeanAttributeInfo[] attrInfo = new MBeanAttributeInfo[context.size()] ;
- int idx = 0 ;
- for ( Symbol sk : context.keys() )
- {
- // Not all are settable - only is string, boolean, integer.
- Object obj = context.get(sk) ;
- boolean settable = false ;
-
- if ( obj instanceof String ) settable = true ;
- if ( obj instanceof Boolean ) settable = true ;
- if ( obj instanceof Integer ) settable = true ;
-
- MBeanAttributeInfo attr = new MBeanAttributeInfo(sk.getSymbol(), "java.lang.String", sk.getSymbol(),
- true, settable, false) ;
- attrInfo[idx++] = attr ;
- }
-
- /*
- * String className,
- String description,
- MBeanAttributeInfo[] attributes,
- MBeanConstructorInfo[] constructors,
- MBeanOperationInfo[] operations,
- MBeanNotificationInfo[] notifications)
- throws IllegalArgumentException
- */
- MBeanInfo info = new MBeanInfo(this.getClass().getName(), "ARQ global context",
- attrInfo,
- null, // Constructors
- null, // Operations
- null // Notifications
- ) ;
- return info ;
- }
-
- @Override
- public Object invoke(String actionName, Object[] params, String[] signature) throws MBeanException,
- ReflectionException
- {
- return null ;
- }
-
- @Override
- public void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException,
- MBeanException, ReflectionException
- {
- context.set(Symbol.create(attribute.getName()), attribute.getValue()) ;
- }
-
- @Override
- public AttributeList setAttributes(AttributeList attributes)
- {
- AttributeList results = new AttributeList() ;
- for ( Object obj : attributes )
- {
- Attribute a = (Attribute)obj ;
-
- Object value = a.getValue() ;
- Object oldValue = getAsString(a.getName()) ;
-
- // Check type of old value.
- //if ( oldValue instanceof Boolean )
-
- try { setAttribute(a) ; } catch (Exception ex) {}
- results.add(new Attribute( a.getName(), getAsString(a.getName()) )) ;
- }
-
- return results ;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/mgt/Explain.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/mgt/Explain.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/mgt/Explain.java
deleted file mode 100644
index 35ba9ad..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/mgt/Explain.java
+++ /dev/null
@@ -1,374 +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 com.hp.hpl.jena.sparql.mgt ;
-
-import org.apache.jena.atlas.io.IndentedLineBuffer ;
-import org.apache.jena.atlas.lib.StrUtils ;
-import org.slf4j.Logger ;
-
-import com.hp.hpl.jena.graph.Node ;
-import com.hp.hpl.jena.graph.Triple ;
-import com.hp.hpl.jena.query.ARQ ;
-import com.hp.hpl.jena.query.Query ;
-import com.hp.hpl.jena.sparql.algebra.Op ;
-import com.hp.hpl.jena.sparql.core.BasicPattern ;
-import com.hp.hpl.jena.sparql.core.Quad ;
-import com.hp.hpl.jena.sparql.core.QuadPattern ;
-import com.hp.hpl.jena.sparql.path.Path ;
-import com.hp.hpl.jena.sparql.serializer.SerializationContext ;
-import com.hp.hpl.jena.sparql.sse.SSE ;
-import com.hp.hpl.jena.sparql.sse.writers.WriterNode ;
-import com.hp.hpl.jena.sparql.util.Context ;
-
-/**
- * Execution logging for query processing on a per query basis. This class
- * provides an overlay on top of the system logging to provide control of log
- * message down to a per query basis. The associated logging channel must also
- * be enabled.
- *
- * An execution can detail the query, the algebra and every point at which the
- * dataset is touched.
- *
- * Caution: logging can be a significant cost for small queries and for
- * memory-backed datasets because of formatting the output and disk or console
- * output overhead.
- *
- * @see ARQ#logExec
- * @see ARQ#getExecutionLogging
- * @see ARQ#setExecutionLogging
- */
-
-public class Explain {
- /**
- * Control whether messages include multiple line output. In multiple line
- * output, subsequent lines start with a space to help log file parsing.
- */
- public static boolean MultiLineMode = true ;
-
- /*
- * The logging system provided levels: TRACE < DEBUG < INFO < WARN < ERROR <
- * FATAL Explain logging is always at logging level INFO. Per query: SYSTEM
- * > EXEC (Query) > DETAIL (Algebra) > DEBUG (every BGP)
- *
- * Control: tdb:logExec = true (all), or enum
- *
- * Document: Include setting different loggers etc for log4j.
- */
-
- // Need per-query identifier.
-
- // These are the per-execution levels.
-
- /** Information level for query execution. */
- public static enum InfoLevel {
- /** Log each query */
- INFO {
- @Override
- public int level() {
- return 10 ;
- }
- },
-
- /** Log each query and it's algebra form after optimization */
- FINE {
- @Override
- public int level() {
- return 20 ;
- }
- },
-
- /** Log query, algebra and every database access (can be expensive) */
- ALL {
- @Override
- public int level() {
- return 30 ;
- }
- },
-
- /** No query execution logging. */
- NONE {
- @Override
- public int level() {
- return -1 ;
- }
- } ;
-
- abstract public int level() ;
-
- public static InfoLevel get(String name) {
- if ( "ALL".equalsIgnoreCase(name) )
- return ALL ;
- if ( "FINE".equalsIgnoreCase(name) )
- return FINE ;
- if ( "INFO".equalsIgnoreCase(name) )
- return INFO ;
- if ( "NONE".equalsIgnoreCase(name) )
- return NONE ;
- return null ;
- }
- }
-
- static public final Logger logExec = ARQ.getExecLogger() ;
- static public final Logger logInfo = ARQ.getInfoLogger() ;
-
- //
- // // MOVE ME to ARQConstants
- // public static final Symbol symLogExec = TDB.symLogExec ;
- // //ARQConstants.allocSymbol("logExec") ;
-
- // ---- Query
-
- public static void explain(Query query, Context context) {
- explain("Query", query, context) ;
- }
-
- public static void explain(String message, Query query, Context context) {
- if ( explaining(InfoLevel.INFO, logExec, context) ) {
- // One line or indented multiline format
- IndentedLineBuffer iBuff = new IndentedLineBuffer() ;
- if ( true )
- iBuff.incIndent() ;
- else
- iBuff.setFlatMode(true) ;
- query.serialize(iBuff) ;
- String x = iBuff.asString() ;
- _explain(logExec, message, x, true) ;
- }
- }
-
- // ---- Algebra
-
- public static void explain(Op op, Context context) {
- explain("Algebra", op, context) ;
- }
-
- private static final boolean MultiLinesForOps = true ;
- private static final boolean MultiLinesForPatterns = true ;
-
- public static void explain(String message, Op op, Context context) {
- if ( explaining(InfoLevel.FINE, logExec, context) ) {
- try (IndentedLineBuffer iBuff = new IndentedLineBuffer()) {
- if ( MultiLinesForOps )
- iBuff.incIndent() ;
- else
- iBuff.setFlatMode(true) ;
- op.output(iBuff) ;
- String x = iBuff.asString() ;
- _explain(logExec, message, x, true) ;
- }
- }
- }
-
- // ---- BGP and quads
-
- public static void explain(BasicPattern bgp, Context context) {
- explain("BGP", bgp, context) ;
- }
-
- public static void explain(String message, BasicPattern bgp, Context context) {
- if ( explaining(InfoLevel.ALL, logExec, context) ) {
- try (IndentedLineBuffer iBuff = new IndentedLineBuffer()) {
- if ( MultiLinesForPatterns )
- iBuff.incIndent() ;
- formatTriples(iBuff, bgp) ;
- iBuff.flush() ;
- String str = iBuff.toString() ;
- _explain(logExec, message, str, false) ;
- }
- }
- }
-
- public static void explain(String message, QuadPattern quads, Context context) {
- if ( explaining(InfoLevel.ALL, logExec, context) ) {
- try (IndentedLineBuffer iBuff = new IndentedLineBuffer()) {
- if ( MultiLinesForPatterns )
- iBuff.incIndent() ;
- formatQuads(iBuff, quads) ;
- iBuff.flush() ;
- String str = iBuff.toString() ;
- _explain(logExec, message, str, false) ;
- }
- }
- }
-
- // public static void explainHTTP(String message, String request, Context
- // context)
- // {
- // if ( explaining(InfoLevel.ALL, logExec,context) )
- // {
- // IndentedLineBuffer iBuff = new IndentedLineBuffer() ;
- // if ( true )
- // iBuff.incIndent() ;
- // else
- // iBuff.setFlatMode(true) ;
- // ???
- // iBuff.flush() ;
- // String str = iBuff.toString() ;
- // _explain(logExec, message, str, false) ;
- // }
- // }
-
- // TEMP : quad list that looks right.
- // Remove when QuadPatterns roll through from ARQ.
-
- private static void formatQuads(IndentedLineBuffer out, QuadPattern quads) {
- SerializationContext sCxt = SSE.sCxt((SSE.defaultPrefixMapWrite)) ;
-
- boolean first = true ;
- for ( Quad qp : quads ) {
- if ( !first ) {
- if ( ! MultiLinesForPatterns )
- out.print(" ") ;
- } else
- first = false ;
- out.print("(") ;
- if ( qp.getGraph() == null )
- out.print("_") ;
- else
- WriterNode.output(out, qp.getGraph(), sCxt) ;
- out.print(" ") ;
- WriterNode.output(out, qp.getSubject(), sCxt) ;
- out.print(" ") ;
- WriterNode.output(out, qp.getPredicate(), sCxt) ;
- out.print(" ") ;
- WriterNode.output(out, qp.getObject(), sCxt) ;
- out.print(")") ;
- if ( MultiLinesForPatterns )
- out.println() ;
- }
- }
-
- private static void formatTriples(IndentedLineBuffer out, BasicPattern triples) {
- SerializationContext sCxt = SSE.sCxt((SSE.defaultPrefixMapWrite)) ;
-
- boolean first = true ;
- for ( Triple qp : triples ) {
- if ( !first ) {
- if ( !MultiLinesForPatterns )
- out.print(" ") ;
- } else
- first = false ;
- out.print("(") ;
- WriterNode.output(out, qp.getSubject(), sCxt) ;
- out.print(" ") ;
- WriterNode.output(out, qp.getPredicate(), sCxt) ;
- out.print(" ") ;
- WriterNode.output(out, qp.getObject(), sCxt) ;
- out.print(")") ;
- if ( MultiLinesForPatterns )
- out.println() ;
- }
- }
-
- // ----
-
- private static void _explain(Logger logger, String reason, String explanation, boolean newlineAlways) {
- // "explanation" should already be indented with some whitespace
- while (explanation.endsWith("\n") || explanation.endsWith("\r"))
- explanation = StrUtils.chop(explanation) ;
- if ( newlineAlways || explanation.contains("\n") )
- explanation = reason + "\n" + explanation ;
- else
- explanation = reason + " :: " + explanation ;
- _explain(logger, explanation) ;
- // System.out.println(explanation) ;
- }
-
- private static void _explain(Logger logger, String explanation) {
- logger.info(explanation) ;
- }
-
- // General information
- public static void explain(Context context, String message) {
- if ( explaining(InfoLevel.INFO, logInfo, context) )
- _explain(logInfo, message) ;
- }
-
- public static void explain(Context context, String format, Object... args) {
- if ( explaining(InfoLevel.INFO, logInfo, context) ) {
- // Caveat: String.format is not cheap.
- String str = String.format(format, args) ;
- _explain(logInfo, str) ;
- }
- }
-
- // public static boolean explaining(InfoLevel level, Context context)
- // {
- // return explaining(level, logExec, context) ;
- // }
-
- public static boolean explaining(InfoLevel level, Logger logger, Context context) {
- if ( !_explaining(level, context) )
- return false ;
- return logger.isInfoEnabled() ;
- }
-
- private static boolean _explaining(InfoLevel level, Context context) {
- if ( level == InfoLevel.NONE )
- return false ;
-
- Object x = context.get(ARQ.symLogExec, null) ;
-
- if ( x == null )
- return false ;
-
- // Enum level.
- if ( level.level() == InfoLevel.NONE.level() )
- return false ;
-
- if ( x instanceof InfoLevel ) {
- InfoLevel z = (InfoLevel)x ;
- if ( z == InfoLevel.NONE )
- return false ;
- return (z.level() >= level.level()) ;
- }
-
- if ( x instanceof String ) {
- String s = (String)x ;
-
- if ( s.equalsIgnoreCase("info") )
- return level.equals(InfoLevel.INFO) ;
- if ( s.equalsIgnoreCase("fine") )
- return level.equals(InfoLevel.FINE) || level.equals(InfoLevel.INFO) ;
- if ( s.equalsIgnoreCase("all") )
- // All levels.
- return true ;
- // Backwards compatibility.
- if ( s.equalsIgnoreCase("true") )
- return true ;
- if ( s.equalsIgnoreCase("none") )
- return false ;
-
- }
-
- return Boolean.TRUE.equals(x) ;
- }
-
- // Path
- public static void explain(Node s, Path path, Node o, Context context) {
- explain("Path", s, path, o, context) ;
- }
-
- public static void explain(String message, Node s, Path path, Node o, Context context) {
- if ( explaining(InfoLevel.ALL, logExec, context) ) {
- String str = s + " " + path + " " + o ;
- _explain(logExec, message, str, false) ;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/mgt/QueryEngineInfo.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/mgt/QueryEngineInfo.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/mgt/QueryEngineInfo.java
deleted file mode 100644
index 1a3437d..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/mgt/QueryEngineInfo.java
+++ /dev/null
@@ -1,68 +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 com.hp.hpl.jena.sparql.mgt;
-
-import java.util.concurrent.atomic.AtomicLong ;
-
-import com.hp.hpl.jena.query.Query ;
-import com.hp.hpl.jena.sparql.algebra.Op ;
-import com.hp.hpl.jena.sparql.util.Utils ;
-
-public class QueryEngineInfo implements QueryEngineInfoMBean
-{
- // Has to be careful about concurrency.
- // It is possible that the count may be momentarily wrong
- // (reading longs is not atomic).
-
- private AtomicLong count = new AtomicLong(0) ;
- @Override
- public long getQueryCount() { return count.get() ; }
- public void incQueryCount() { count.incrementAndGet() ; }
-
- Query query = null ;
- @Override
- public String getLastQueryString()
- {
- Query q = query ; // Get once.
- if ( q != null ) return q.toString() ;
- // Sometimes an alegra expression is executited without a query.
- return getLastAlgebra() ;
- }
- public void setLastQueryString(Query q) { query = q ; }
-
- private Op op = null ;
- @Override
- public String getLastAlgebra()
- {
- Op _op = op ; // Get once.
- return _op == null ? "none" : _op.toString() ;
- }
- public void setLastOp(Op op) { this.op = op ; }
-
- private String timeSeen = "" ;
- @Override
- public String getLastQueryExecAt() { return timeSeen ; }
- public void setLastQueryExecAt() { timeSeen = Utils.nowAsString() ; }
-
-// private long lastExecTime ;
-// public long getLastQueryExecTime() { return lastExecTime ; }
-// public void setLastQueryExecTime(long timeMillis) { lastExecTime = timeMillis ; }
-
-
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/mgt/QueryEngineInfoMBean.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/mgt/QueryEngineInfoMBean.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/mgt/QueryEngineInfoMBean.java
deleted file mode 100644
index 133153d..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/mgt/QueryEngineInfoMBean.java
+++ /dev/null
@@ -1,38 +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 com.hp.hpl.jena.sparql.mgt;
-
-/** Overall statistics from a query engine - one such per type of engine. */
-public interface QueryEngineInfoMBean
-{
- /** Number of queries executed */
- long getQueryCount() ;
-
- /** Last query seen, as a string */
- String getLastQueryString() ;
-
- /** Last algebra expression seen, as a string */
- String getLastAlgebra() ;
-
- /** Point in time when last query seen */
- String getLastQueryExecAt() ;
-
-// /** Length of elapsed time (in microseconds) for the last query : -1 for unknown */
-// long getLastQueryExecTime() ;
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/mgt/QueryExecMBean.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/mgt/QueryExecMBean.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/mgt/QueryExecMBean.java
deleted file mode 100644
index 54fc2ec..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/mgt/QueryExecMBean.java
+++ /dev/null
@@ -1,35 +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 com.hp.hpl.jena.sparql.mgt;
-
-/** Details of a single query execution */
-public interface QueryExecMBean
-{
- /** State - what's it doing */
- String getState() ;
-
- /** Query as a string */
- String getQueryString() ;
-
- /** Point in time when query execution started */
- String getQueryExecAt() ;
-
- /** Length of elapsed time (in microseconds) for query : -1 for unknown or unfinished */
- long getQueryExecTime() ;
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/mgt/SystemInfo.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/mgt/SystemInfo.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/mgt/SystemInfo.java
deleted file mode 100644
index 039cd4d..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/mgt/SystemInfo.java
+++ /dev/null
@@ -1,71 +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 com.hp.hpl.jena.sparql.mgt ;
-
-import org.apache.jena.riot.system.IRIResolver ;
-
-import com.hp.hpl.jena.graph.Node ;
-import com.hp.hpl.jena.graph.NodeFactory ;
-
-public class SystemInfo implements SystemInfoMBean {
- private final String name ;
- private final Node iri ;
- private final String jmxPath ;
- private final String version ;
- private final String buildDate ;
-
- public SystemInfo(String name, String jmxPath, String version, String buildDate) {
- this.name = name ;
- this.iri = createIRI(name) ;
- this.jmxPath = jmxPath ;
- this.version = version ;
- this.buildDate = buildDate ;
- }
-
- private static Node createIRI(String iriStr) {
- try {
- return NodeFactory.createURI(IRIResolver.resolveString(iriStr)) ;
- } catch (RuntimeException ex) {
- return null ;
- }
- }
-
- @Override
- public String getBuildDate() {
- return buildDate ;
- }
-
- @Override
- public String getVersion() {
- return version ;
- }
-
- @Override
- public String getName() {
- return name ;
- }
-
- public Node getIRI() {
- return NodeFactory.createURI(name) ;
- }
-
- public String getJmxPath() {
- return jmxPath ;
- }
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/mgt/SystemInfoMBean.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/mgt/SystemInfoMBean.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/mgt/SystemInfoMBean.java
deleted file mode 100644
index dd3072e..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/mgt/SystemInfoMBean.java
+++ /dev/null
@@ -1,26 +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 com.hp.hpl.jena.sparql.mgt;
-
-public interface SystemInfoMBean
-{
- public String getName() ;
- public String getVersion() ;
- public String getBuildDate() ;
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/GraphStoreAction.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/GraphStoreAction.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/GraphStoreAction.java
deleted file mode 100644
index e4656e9..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/GraphStoreAction.java
+++ /dev/null
@@ -1,23 +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 com.hp.hpl.jena.sparql.modify;
-
-import com.hp.hpl.jena.graph.Graph ;
-
-public interface GraphStoreAction { public void exec(Graph graph) ; }
http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/GraphStoreBasic.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/GraphStoreBasic.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/GraphStoreBasic.java
deleted file mode 100644
index b857eb7..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/GraphStoreBasic.java
+++ /dev/null
@@ -1,56 +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 com.hp.hpl.jena.sparql.modify;
-
-import com.hp.hpl.jena.query.Dataset ;
-import com.hp.hpl.jena.query.DatasetFactory ;
-import com.hp.hpl.jena.sparql.core.DatasetGraph ;
-import com.hp.hpl.jena.sparql.core.DatasetGraphWrapper ;
-import com.hp.hpl.jena.update.GraphStore ;
-
-public class GraphStoreBasic extends DatasetGraphWrapper implements GraphStore
-{
- public GraphStoreBasic(Dataset ds)
- {
- super(ds.asDatasetGraph()) ;
- }
-
- public GraphStoreBasic(DatasetGraph dsg)
- {
- super(dsg) ;
- }
-
- @Override
- public Dataset toDataset()
- {
- return DatasetFactory.create(getWrapped()) ;
- }
-
- @Override
- public void startRequest()
- {}
-
- @Override
- public void finishRequest()
- {}
-
- @Override
- public void close()
- {}
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/GraphStoreNull.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/GraphStoreNull.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/GraphStoreNull.java
deleted file mode 100644
index ca83b70..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/GraphStoreNull.java
+++ /dev/null
@@ -1,85 +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 com.hp.hpl.jena.sparql.modify;
-
-import java.util.Iterator ;
-
-import org.apache.jena.atlas.iterator.Iter ;
-
-import com.hp.hpl.jena.graph.* ;
-import com.hp.hpl.jena.query.Dataset ;
-import com.hp.hpl.jena.query.DatasetFactory ;
-import com.hp.hpl.jena.sparql.core.DatasetGraphQuad ;
-import com.hp.hpl.jena.sparql.core.Quad ;
-import com.hp.hpl.jena.update.GraphStore ;
-
-/**
- * A black hole for Quads, add as many as you want and it will forget them all. Useful for testing.
- */
-public class GraphStoreNull extends DatasetGraphQuad implements GraphStore
-{
- @Override
- public Iterator<Quad> find(Node g, Node s, Node p, Node o)
- {
- return Iter.nullIterator();
- }
-
- @Override
- public Iterator<Quad> findNG(Node g, Node s, Node p, Node o)
- {
- return Iter.nullIterator();
- }
-
- @Override
- public void add(Quad quad)
- { }
-
- @Override
- public void delete(Quad quad)
- { }
-
- @Override
- public void addGraph(Node graphName, Graph graph) {}
-
- @Override
- public Graph getDefaultGraph()
- {
- return Factory.empty() ;
- }
-
- @Override
- public Graph getGraph(Node graphNode)
- {
- return Factory.empty() ;
- }
-
- @Override
- public Dataset toDataset()
- {
- return DatasetFactory.create(this);
- }
-
- @Override
- public void startRequest()
- { }
-
- @Override
- public void finishRequest()
- { }
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/GraphStoreNullTransactional.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/GraphStoreNullTransactional.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/GraphStoreNullTransactional.java
deleted file mode 100644
index d112190..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/GraphStoreNullTransactional.java
+++ /dev/null
@@ -1,62 +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 com.hp.hpl.jena.sparql.modify ;
-
-import com.hp.hpl.jena.query.ReadWrite ;
-import com.hp.hpl.jena.sparql.core.Transactional ;
-import com.hp.hpl.jena.sparql.core.TransactionalNull ;
-
-/**
- * A transactional black hole for Quads, add as many as you want and it will forget them all. Useful for testing.
- */
-public class GraphStoreNullTransactional extends GraphStoreNull implements Transactional
-{
- private final Transactional transaction = new TransactionalNull() ;
-
- @Override
- public void begin(ReadWrite readWrite)
- {
- transaction.begin(readWrite) ;
- }
-
- @Override
- public void commit()
- {
- transaction.commit() ;
- }
-
- @Override
- public void abort()
- {
- transaction.abort() ;
- }
-
- @Override
- public boolean isInTransaction()
- {
- return transaction.isInTransaction() ;
- }
-
- @Override
- public void end()
- {
- transaction.end() ;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/GraphStoreWrapper.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/GraphStoreWrapper.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/GraphStoreWrapper.java
deleted file mode 100644
index 89c0e27..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/GraphStoreWrapper.java
+++ /dev/null
@@ -1,47 +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 com.hp.hpl.jena.sparql.modify;
-
-import com.hp.hpl.jena.query.Dataset ;
-import com.hp.hpl.jena.sparql.core.DatasetGraphWrapper ;
-import com.hp.hpl.jena.update.GraphStore ;
-
-public class GraphStoreWrapper extends DatasetGraphWrapper implements GraphStore
-{
- protected final GraphStore graphStore ;
-
- public GraphStoreWrapper(GraphStore graphStore)
- {
- super(graphStore) ;
- this.graphStore = graphStore ;
- }
-
- @Override
- public Dataset toDataset()
- { return graphStore.toDataset() ; }
-
- @Override
- public void startRequest()
- { graphStore.startRequest() ; }
-
- @Override
- public void finishRequest()
- { graphStore.finishRequest() ; }
-}
-
http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/NodeTransformBNodesToVariables.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/NodeTransformBNodesToVariables.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/NodeTransformBNodesToVariables.java
deleted file mode 100644
index 5464be2..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/NodeTransformBNodesToVariables.java
+++ /dev/null
@@ -1,54 +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 com.hp.hpl.jena.sparql.modify;
-
-import java.util.HashMap ;
-import java.util.Map ;
-
-import com.hp.hpl.jena.graph.Node ;
-import com.hp.hpl.jena.sparql.ARQConstants ;
-import com.hp.hpl.jena.sparql.core.Var ;
-import com.hp.hpl.jena.sparql.core.VarAlloc ;
-import com.hp.hpl.jena.sparql.graph.NodeTransform ;
-
-public class NodeTransformBNodesToVariables implements NodeTransform
-{
- private VarAlloc varAlloc = new VarAlloc(ARQConstants.allocVarBNodeToVar) ;
- private Map<Node, Var> mapping ;
-
- public NodeTransformBNodesToVariables()
- {
- this.mapping = new HashMap<>();
- }
-
- @Override
- public Node convert(Node node)
- {
- if ( ! node.isBlank() )
- return node ;
- Node node2 = mapping.get(node) ;
- if ( node2 == null )
- {
- Var v = varAlloc.allocVar() ;
- mapping.put(node, v) ;
- node2 = v ;
- }
- return node2 ;
- }
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/TemplateLib.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/TemplateLib.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/TemplateLib.java
deleted file mode 100644
index a68e7d2..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/TemplateLib.java
+++ /dev/null
@@ -1,198 +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 com.hp.hpl.jena.sparql.modify;
-
-import java.util.* ;
-
-import org.apache.jena.atlas.iterator.Iter ;
-import org.apache.jena.atlas.iterator.Transform ;
-
-import com.hp.hpl.jena.graph.Node ;
-import com.hp.hpl.jena.graph.NodeFactory ;
-import com.hp.hpl.jena.graph.Triple ;
-import com.hp.hpl.jena.sparql.core.Quad ;
-import com.hp.hpl.jena.sparql.core.Substitute ;
-import com.hp.hpl.jena.sparql.core.Var ;
-import com.hp.hpl.jena.sparql.engine.binding.Binding ;
-import com.hp.hpl.jena.sparql.util.ModelUtils;
-
-public class TemplateLib
-{
- // See also Substitute -- combine?
- // Or is this specifc enough to CONSTRUCT/Update template processing?
-
- // TODO We could eliminate some of the duplication in this class by writing generic methods and adding a shared super-interface to Triple and Quad
-
- /**
- * Take a template, as a list of quad patterns, a default graph, and an iterator of bindings,
- * and produce an iterator of quads that results from applying the template to the bindings.
- */
- public static Iterator<Quad> template(List<Quad> quads, final Node dftGraph, Iterator<Binding> bindings)
- {
- if ( quads == null || quads.isEmpty() ) return null ;
-
- quads = remapDefaultGraph(quads, dftGraph);
- return calcQuads(quads, bindings);
- }
-
- protected static List<Quad> remapDefaultGraph(List<Quad> quads, final Node dftGraph)
- {
- // The default graph has been set to something else.
- if ( dftGraph != null )
- {
- Transform<Quad, Quad> nt = new Transform<Quad, Quad>() {
- @Override
- public Quad convert(Quad quad)
- {
- if ( ! quad.isDefaultGraph() ) return quad ;
-
- return new Quad(dftGraph, quad.getSubject(), quad.getPredicate(), quad.getObject()) ;
- }
- };
- quads = Iter.map(quads, nt) ;
- }
- return quads;
- }
-
- /** Substitute into triple patterns */
- public static Iterator<Triple> calcTriples(final List<Triple> triples, Iterator<Binding> bindings)
- {
- return Iter.mapMany(bindings, new Transform<Binding, Iterator<Triple>>()
- {
- Map<Node, Node> bNodeMap = new HashMap<>() ;
- @Override
- public Iterator<Triple> convert(final Binding b)
- {
- // Iteration is a new mapping of bnodes.
- bNodeMap.clear() ;
-
- List<Triple> tripleList = new ArrayList<>(triples.size());
- for (Triple triple : triples)
- {
- Triple q = subst(triple, b, bNodeMap) ;
- if ( ! q.isConcrete() || ! ModelUtils.isValidAsStatement(q.getSubject(), q.getPredicate(), q.getObject()) )
- {
- //Log.warn(TemplateLib.class, "Unbound quad: "+FmtUtils.stringForQuad(quad)) ;
- continue ;
- }
- tripleList.add(q);
- }
- return tripleList.iterator();
- }
- });
- }
-
- /** Substitute into quad patterns */
- public static Iterator<Quad> calcQuads(final List<Quad> quads, Iterator<Binding> bindings)
- {
- return Iter.mapMany(bindings, new Transform<Binding, Iterator<Quad>>()
- {
- Map<Node, Node> bNodeMap = new HashMap<>() ;
- @Override
- public Iterator<Quad> convert(final Binding b)
- {
- // Iteration is a new mapping of bnodes.
- bNodeMap.clear() ;
-
- List<Quad> quadList = new ArrayList<>(quads.size());
- for (Quad quad : quads)
- {
- Quad q = subst(quad, b, bNodeMap) ;
- if ( ! q.isConcrete() )
- {
- //Log.warn(TemplateLib.class, "Unbound quad: "+FmtUtils.stringForQuad(quad)) ;
- continue ;
- }
- quadList.add(q);
- }
- return quadList.iterator();
- }
- });
- }
-
- /** Substitute into a quad, with rewriting of bNodes */
- public static Quad subst(Quad quad, Binding b, Map<Node, Node> bNodeMap)
- {
- Node g = quad.getGraph() ;
- Node s = quad.getSubject() ;
- Node p = quad.getPredicate() ;
- Node o = quad.getObject() ;
-
- Node g1 = g ;
- Node s1 = s ;
- Node p1 = p ;
- Node o1 = o ;
-
- // replace blank nodes.
- if ( g1.isBlank() || Var.isBlankNodeVar(g1) )
- g1 = newBlank(g1, bNodeMap) ;
-
- if ( s1.isBlank() || Var.isBlankNodeVar(s1) )
- s1 = newBlank(s1, bNodeMap) ;
-
- if ( p1.isBlank() || Var.isBlankNodeVar(p1) )
- p1 = newBlank(p1, bNodeMap) ;
-
- if ( o1.isBlank() || Var.isBlankNodeVar(o1) )
- o1 = newBlank(o1, bNodeMap) ;
-
- Quad q = quad ;
- if ( s1 != s || p1 != p || o1 != o || g1 != g )
- q = new Quad(g1, s1, p1, o1) ;
-
- Quad q2 = Substitute.substitute(q, b) ;
- return q2 ;
- }
-
- /** Substitute into a triple, with rewriting of bNodes */
- public static Triple subst(Triple triple, Binding b, Map<Node, Node> bNodeMap)
- {
- Node s = triple.getSubject() ;
- Node p = triple.getPredicate() ;
- Node o = triple.getObject() ;
-
- Node s1 = s ;
- Node p1 = p ;
- Node o1 = o ;
-
- if ( s1.isBlank() || Var.isBlankNodeVar(s1) )
- s1 = newBlank(s1, bNodeMap) ;
-
- if ( p1.isBlank() || Var.isBlankNodeVar(p1) )
- p1 = newBlank(p1, bNodeMap) ;
-
- if ( o1.isBlank() || Var.isBlankNodeVar(o1) )
- o1 = newBlank(o1, bNodeMap) ;
-
- Triple t = triple ;
- if ( s1 != s || p1 != p || o1 != o )
- t = new Triple(s1, p1, o1) ;
-
- Triple t2 = Substitute.substitute(t, b) ;
- return t2 ;
- }
-
- /** generate a blank node consistently */
- private static Node newBlank(Node n, Map<Node, Node> bNodeMap)
- {
- if ( ! bNodeMap.containsKey(n) )
- bNodeMap.put(n, NodeFactory.createAnon() );
- return bNodeMap.get(n) ;
- }
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/UpdateCompare.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/UpdateCompare.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/UpdateCompare.java
deleted file mode 100644
index 88fdbf9..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/UpdateCompare.java
+++ /dev/null
@@ -1,57 +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 com.hp.hpl.jena.sparql.modify;
-
-import java.util.List ;
-
-import com.hp.hpl.jena.sparql.util.NodeIsomorphismMap ;
-import com.hp.hpl.jena.update.Update ;
-import com.hp.hpl.jena.update.UpdateRequest ;
-
-public class UpdateCompare {
-
- public static boolean isomorphic(UpdateRequest req1, UpdateRequest req2) {
- if ( req1 == req2 )
- return true ;
- if ( ! req1.samePrologue(req2) )
- return false ;
- List<Update> updates1 = req1.getOperations() ;
- List<Update> updates2 = req2.getOperations() ;
- if ( updates1.size() != updates2.size() )
- return false ;
-
- NodeIsomorphismMap isomap = new NodeIsomorphismMap() ;
- for ( int i = 0 ; i < updates1.size() ; i++ ) {
- Update upd1 = updates1.get(i) ;
- Update upd2 = updates2.get(i) ;
- if ( !isomorphic(upd1, upd2, isomap) )
- return false ;
- }
- return true ;
- }
-
- public static boolean isomorphic(Update req1, Update req2) {
- return isomorphic(req1, req2, new NodeIsomorphismMap()) ;
- }
-
- private static boolean isomorphic(Update upd1, Update upd2, NodeIsomorphismMap isomap) {
- return upd1.equalTo(upd2, isomap) ;
- }
-}
-
http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/UpdateEngine.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/UpdateEngine.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/UpdateEngine.java
deleted file mode 100644
index 58cf366..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/UpdateEngine.java
+++ /dev/null
@@ -1,43 +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 com.hp.hpl.jena.sparql.modify;
-
-
-/**
- * An UpdateEngine provides an interface to execute a SPARQL update request.
- * An update engine is use-once; that is, it executes a single SPARQL Update request
- * (there may be multiple operations in one request).
- */
-public interface UpdateEngine
-{
- /**
- * Signal start of a request being executed
- */
- public void startRequest();
-
- /**
- * Signal end of a request being executed
- */
- public void finishRequest();
-
- /**
- * Returns an {@link UpdateSink} that accepts Update operations
- */
- public UpdateSink getUpdateSink();
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/UpdateEngineBase.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/UpdateEngineBase.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/UpdateEngineBase.java
deleted file mode 100644
index bc81218..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/UpdateEngineBase.java
+++ /dev/null
@@ -1,57 +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 com.hp.hpl.jena.sparql.modify;
-
-import com.hp.hpl.jena.query.ARQ ;
-import com.hp.hpl.jena.sparql.ARQConstants ;
-import com.hp.hpl.jena.sparql.core.DatasetGraph ;
-import com.hp.hpl.jena.sparql.engine.binding.Binding ;
-import com.hp.hpl.jena.sparql.util.Context ;
-import com.hp.hpl.jena.sparql.util.NodeFactoryExtra ;
-import com.hp.hpl.jena.update.GraphStore ;
-
-public abstract class UpdateEngineBase implements UpdateEngine
-{
- protected final GraphStore graphStore ;
- protected final Binding inputBinding;
- protected final Context context ;
-
- public UpdateEngineBase(GraphStore graphStore,
- Binding inputBinding,
- Context context)
- {
- this.graphStore = graphStore ;
- this.inputBinding = inputBinding ;
- this.context = setupContext(context, graphStore) ;
- }
-
- private static Context setupContext(Context context, DatasetGraph dataset)
- {
- // To many copies?
- if ( context == null ) // Copy of global context to protect against change.
- context = ARQ.getContext() ;
- context = context.copy() ;
-
- if ( dataset.getContext() != null )
- context.putAll(dataset.getContext()) ;
-
- context.set(ARQConstants.sysCurrentTime, NodeFactoryExtra.nowAsDateTime()) ;
- return context ;
- }
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/UpdateEngineFactory.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/UpdateEngineFactory.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/UpdateEngineFactory.java
deleted file mode 100644
index 48608d6..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/UpdateEngineFactory.java
+++ /dev/null
@@ -1,35 +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 com.hp.hpl.jena.sparql.modify;
-
-import com.hp.hpl.jena.sparql.engine.binding.Binding ;
-import com.hp.hpl.jena.sparql.util.Context ;
-import com.hp.hpl.jena.update.GraphStore ;
-
-/**
- * Interface for factories that accept and process SPARQL update requests.
- */
-public interface UpdateEngineFactory
-{
- /** Answer whether this factory can produce an UpdateEngine for the specified GraphStore */
- public boolean accept(GraphStore graphStore, Context context) ;
-
- /** Create the update engine - having returned true to accept, should not fail */
- public UpdateEngine create(GraphStore graphStore, Binding inputBinding, Context context);
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/UpdateEngineMain.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/UpdateEngineMain.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/UpdateEngineMain.java
deleted file mode 100644
index 385c0b5..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/UpdateEngineMain.java
+++ /dev/null
@@ -1,96 +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 com.hp.hpl.jena.sparql.modify;
-
-import com.hp.hpl.jena.sparql.engine.binding.Binding ;
-import com.hp.hpl.jena.sparql.modify.request.UpdateVisitor ;
-import com.hp.hpl.jena.sparql.util.Context ;
-import com.hp.hpl.jena.update.GraphStore ;
-
-/**
- * Default implementation of an update engine
- * <p>
- * Developers who only want to change/extend the processing of individual updates can easily
- * </p>
- */
-public class UpdateEngineMain extends UpdateEngineBase
-{
- /**
- * Creates a new Update Engine
- * @param graphStore Graph Store the updates operate over
- * @param inputBinding Initial binding to be applied to Update operations that can apply an initial binding (i.e. UpdateDeleteWhere, UpdateModify)
- * @param context Execution Context
- */
- public UpdateEngineMain(GraphStore graphStore, Binding inputBinding, Context context)
- {
- super(graphStore, inputBinding, context) ;
- }
-
- @Override
- public void startRequest()
- {
- graphStore.startRequest();
- }
-
- @Override
- public void finishRequest()
- {
- graphStore.finishRequest();
- }
-
- private UpdateSink updateSink = null ;
-
- /**
- * Returns the {@link UpdateSink}. In this implementation, this is done by
- * with an {@link UpdateVisitor} which will visit each update operation
- * and send the operation to the associated {@link UpdateEngineWorker}.
- */
- @Override
- public UpdateSink getUpdateSink()
- {
- if ( updateSink == null )
- updateSink = new UpdateVisitorSink(this.prepareWorker());
- return updateSink ;
- }
-
- /**
- * Creates the {@link UpdateVisitor} which will do the work of applying the updates
- * @return The update visitor to be used to apply the updates
- */
- protected UpdateVisitor prepareWorker() {
- return new UpdateEngineWorker(graphStore, inputBinding, context) ;
- }
-
- private static UpdateEngineFactory factory = new UpdateEngineFactory()
- {
- @Override
- public boolean accept(GraphStore graphStore, Context context)
- {
- return true ;
- }
-
- @Override
- public UpdateEngine create(GraphStore graphStore, Binding inputBinding, Context context)
- {
- return new UpdateEngineMain(graphStore, inputBinding, context);
- }
- } ;
-
- public static UpdateEngineFactory getFactory() { return factory ; }
-}