Author: rvesse
Date: Tue Jan 29 17:46:56 2013
New Revision: 1440029
URL: http://svn.apache.org/viewvc?rev=1440029&view=rev
Log:
Add extend() method to PrefixMapFactory.
Comment out a test which can pass/fail depending on machine conditions i.e. too
indeterminate
Modified:
jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/system/PrefixMapFactory.java
jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/system/Prologue.java
jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/system/TestAbbreviationPerformance.java
Modified:
jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/system/PrefixMapFactory.java
URL:
http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/system/PrefixMapFactory.java?rev=1440029&r1=1440028&r2=1440029&view=diff
==============================================================================
---
jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/system/PrefixMapFactory.java
(original)
+++
jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/system/PrefixMapFactory.java
Tue Jan 29 17:46:56 2013
@@ -46,19 +46,22 @@ public class PrefixMapFactory {
* Will use whatever the version of ARQ you are using considers the default
* implementation, this may change from release to release.
* </p>
- * @param pmap Prefix Map to copy
+ *
+ * @param pmap
+ * Prefix Map to copy
*
* @return Prefix Map
*/
public static PrefixMap create(PrefixMap pmap) {
return new PrefixMapStd(pmap);
}
-
+
/**
* Creates a new prefix map which is intended for use in output which
starts
* with a copy of an existing map
* <p>
- * Will use whatever the version of ARQ you are using considers the
default implementation, this may change from release to release.
+ * Will use whatever the version of ARQ you are using considers the default
+ * implementation, this may change from release to release.
* </p>
*
* @param pmap
@@ -100,7 +103,7 @@ public class PrefixMapFactory {
public static PrefixMap createForInput(PrefixMap pmap) {
return new PrefixMapStd(pmap);
}
-
+
/**
* Creates a new prefix map which is intended for use in iput which starts
* with a copy of an existing map
@@ -149,7 +152,7 @@ public class PrefixMapFactory {
public static PrefixMap createForOutput(PrefixMap pmap) {
return new FastAbbreviatingPrefixMap(pmap);
}
-
+
/**
* Creates a new prefix map which is intended for use in output which
starts
* with a copy of an existing map
@@ -169,4 +172,25 @@ public class PrefixMapFactory {
return created;
}
+ /**
+ * Creates a new prefix map which is an extension of an existing prefix map
+ * <p>
+ * This differs from using one of the various {@code create()} methods
since
+ * it does not copy the existing prefix map, rather it maintains both a
+ * local map and the existing map. All operations favour the local map but
+ * defer to the existing map if the local map cannot fulfil a request.
+ * </p>
+ * <p>
+ * Will use whatever the version of ARQ you are using considers the default
+ * extending implementation, this may change from release to release.
+ * </p>
+ *
+ * @param pmap
+ * Prefix Map to extend
+ * @return Prefix Map
+ */
+ public static PrefixMap extend(PrefixMap pmap) {
+ return new PrefixMapExtended(pmap);
+ }
+
}
Modified:
jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/system/Prologue.java
URL:
http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/system/Prologue.java?rev=1440029&r1=1440028&r2=1440029&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/system/Prologue.java
(original)
+++ jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/system/Prologue.java
Tue Jan 29 17:46:56 2013
@@ -87,7 +87,7 @@ public class Prologue
// New prefix mappings
PrefixMap ext = getPrefixMap() ;
if ( newMappings != null )
- ext = new PrefixMapExtended(ext) ;
+ ext = PrefixMapFactory.extend(ext) ;
// New base.
IRIResolver r = resolver ;
if ( base != null )
Modified:
jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/system/TestAbbreviationPerformance.java
URL:
http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/system/TestAbbreviationPerformance.java?rev=1440029&r1=1440028&r2=1440029&view=diff
==============================================================================
---
jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/system/TestAbbreviationPerformance.java
(original)
+++
jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/system/TestAbbreviationPerformance.java
Tue Jan 29 17:46:56 2013
@@ -85,19 +85,21 @@ public class TestAbbreviationPerformance
test_amalgamated_performance(pmap, fmap, 1, false);
}
- /**
- * Expect {@link FastAbbreviatingPrefixMap} to outperform {@link
PrefixMapStd} as soon as
- * there are a few namespaces
- */
- @Test
- public void prefixMap_abbrev_performance_02() {
- PrefixMapStd pmap = new PrefixMapStd();
- populate(pmap, 5);
- FastAbbreviatingPrefixMap fmap = new FastAbbreviatingPrefixMap();
- populate(fmap, 5);
-
- test_amalgamated_performance(pmap, fmap, 5, true);
- }
+ //This test can go either way depending on machine conditions
+
+// /**
+// * Expect {@link FastAbbreviatingPrefixMap} to outperform {@link
PrefixMapStd} as soon as
+// * there are a few namespaces
+// */
+// @Test
+// public void prefixMap_abbrev_performance_02() {
+// PrefixMapStd pmap = new PrefixMapStd();
+// populate(pmap, 5);
+// FastAbbreviatingPrefixMap fmap = new FastAbbreviatingPrefixMap();
+// populate(fmap, 5);
+//
+// test_amalgamated_performance(pmap, fmap, 5, true);
+// }
/**
* Expect {@link FastAbbreviatingPrefixMap} to significantly outperform