This list is closed, nobody may subscribe to it.
2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(139) |
Aug
(94) |
Sep
(232) |
Oct
(143) |
Nov
(138) |
Dec
(55) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2011 |
Jan
(127) |
Feb
(90) |
Mar
(101) |
Apr
(74) |
May
(148) |
Jun
(241) |
Jul
(169) |
Aug
(121) |
Sep
(157) |
Oct
(199) |
Nov
(281) |
Dec
(75) |
2012 |
Jan
(107) |
Feb
(122) |
Mar
(184) |
Apr
(73) |
May
(14) |
Jun
(49) |
Jul
(26) |
Aug
(103) |
Sep
(133) |
Oct
(61) |
Nov
(51) |
Dec
(55) |
2013 |
Jan
(59) |
Feb
(72) |
Mar
(99) |
Apr
(62) |
May
(92) |
Jun
(19) |
Jul
(31) |
Aug
(138) |
Sep
(47) |
Oct
(83) |
Nov
(95) |
Dec
(111) |
2014 |
Jan
(125) |
Feb
(60) |
Mar
(119) |
Apr
(136) |
May
(270) |
Jun
(83) |
Jul
(88) |
Aug
(30) |
Sep
(47) |
Oct
(27) |
Nov
(23) |
Dec
|
2015 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(3) |
Oct
|
Nov
|
Dec
|
2016 |
Jan
|
Feb
|
Mar
(4) |
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <tob...@us...> - 2014-08-08 00:33:52
|
Revision: 8609 http://sourceforge.net/p/bigdata/code/8609 Author: tobycraig Date: 2014-08-08 00:33:42 +0000 (Fri, 08 Aug 2014) Log Message: ----------- Added classes and IDs to elements on status HTML output Modified Paths: -------------- branches/BIGDATA_RELEASE_1_3_0/bigdata-sails/src/java/com/bigdata/rdf/sail/webapp/HAStatusServletUtil.java branches/BIGDATA_RELEASE_1_3_0/bigdata-sails/src/java/com/bigdata/rdf/sail/webapp/StatusServlet.java branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/css/style.css Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-sails/src/java/com/bigdata/rdf/sail/webapp/HAStatusServletUtil.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-sails/src/java/com/bigdata/rdf/sail/webapp/HAStatusServletUtil.java 2014-08-07 13:42:47 UTC (rev 8608) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-sails/src/java/com/bigdata/rdf/sail/webapp/HAStatusServletUtil.java 2014-08-08 00:33:42 UTC (rev 8609) @@ -204,52 +204,84 @@ // The quorum state if (quorumService == null) { - p.text("The local quorum service is not running.").node("br") - .close(); + p.text("The local quorum service is ") + .node("span").attr("id", "quorum-state").text("not running") + .close().text(".") + .node("br").close(); } else { - p.text("The quorum is " + (quorum.isQuorumMet() ? "" : "not") - + " met.").node("br").close(); + p.text("The quorum is ") + .node("span").attr("id", "quorum-state") + .text((quorum.isQuorumMet() ? "" : "not ") + "met") + .close().text(".") + .node("br").close(); - p.text("" + njoined + " out of " + quorum.replicationFactor() - + " services are joined.").node("br").close(); + p.node("span").attr("id", "njoined").text("" + njoined).close() + .text(" out of ") + .node("span").attr("id", "replication-factor") + .text("" + quorum.replicationFactor()).close() + .text(" services are joined.") + .node("br").close(); - p.text("quorumToken=" + quorumToken + ", lastValidToken=" - + lastValidToken).node("br").close(); + p.text("quorumToken=") + .node("span").attr("id", "quorum-token") + .text("" + quorumToken).close() + .text(", lastValidToken=") + .node("span").attr("id", "last-valid-token") + .text("" + lastValidToken).close() + .node("br").close(); - p.text("logicalServiceZPath=" - + quorumService.getLogicalServiceZPath()).node("br") - .close(); + p.text("logicalServiceZPath=") + .node("span").attr("id", "logical-service-z-path") + .text(quorumService.getLogicalServiceZPath()).close() + .node("br").close(); - p.text("PlatformStatsPlugIn=" - + (journal.getPlatformStatisticsCollector() == null ? "N/A" - : "Running")).node("br").close(); + p.text("PlatformStatsPlugIn=") + .node("span").attr("id", "platform-stats-plugin") + .text(journal.getPlatformStatisticsCollector() == null ? + "N/A" : "Running").close() + .node("br").close(); - p.text("GangliaPlugIn=" - + (journal.getGangliaService() == null ? "N/A" - : "Running")).node("br").close(); + p.text("GangliaPlugIn=") + .node("span").attr("id", "ganglia-plugin") + .text(journal.getGangliaService() == null ? "N/A" : + "Running").close() + .node("br").close(); // Note: This is the *local* value of getHAStatus(). // Note: The HAReady token reflects whether or not the service // is // joined. - p.text("HAStatus: " + quorumService.getService().getHAStatus() - + ", HAReadyToken=" + haReadyToken).node("br").close(); + p.text("HAStatus: ") + .node("span").attr("id", "ha-status") + .text("" + quorumService.getService().getHAStatus()).close() + .text(", HAReadyToken=") + .node("span").attr("id", "ha-ready-token") + .text("" + haReadyToken).close() + .node("br").close(); /* * Report on the Service. */ { - p.text("Service: serviceId=" + quorumService.getServiceId()) - .node("br").close(); - p.text("Service: pid=" + quorumService.getPID()).node("br") - .close(); - p.text("Service: path=" + quorumService.getServiceDir()) - .node("br").close(); - p.text("Service: proxy=" - + journal.getHAJournalServer().getProxy()) - .node("br").close(); + p.text("Service: serviceId=") + .node("span").attr("id", "service-id") + .text("" + quorumService.getServiceId()).close() + .node("br").close(); + p.text("Service: pid=") + .node("span").attr("id", "service-pid") + .text("" + quorumService.getPID()).close() + .node("br").close(); + p.text("Service: path=") + .node("span").attr("id", "service-path") + .text("" + quorumService.getServiceDir()).close() + .node("br").close(); + p.text("Service: proxy=") + .node("span").attr("id", "service-proxy") + .text("" + journal.getHAJournalServer().getProxy()) + .close() + .node("br").close(); } @@ -277,28 +309,33 @@ final boolean takeSnapshot = mgr .isReadyToSnapshot(snapshotPolicy .newSnapshotRequest()); - p.text("Service"// - + ": snapshotPolicy=" - + snapshotPolicy// - + ", shouldSnapshot=" - + takeSnapshot// + p.text("Service: snapshotPolicy=") + .node("span").attr("id", "snapshot-policy") + .text("" + snapshotPolicy).close() + .text(", shouldSnapshot=") + .node("span").attr("id", "take-snapshot") + .text("" + takeSnapshot).close() // + ", lastSnapshotCommitCounter=" // + sinceCommitCounter// // + ", HALogFileBytesOnDiskSinceLastSnapshot=" // + haLogBytesOnDiskSinceLastSnapshot// - ).node("br").close(); + .node("br").close(); } // restore policy. - p.text("Service: restorePolicy=" - + journal.getSnapshotManager().getRestorePolicy()) - .node("br").close(); + p.text("Service: restorePolicy=") + .node("span").attr("id", "restore-policy") + .text("" + journal.getSnapshotManager().getRestorePolicy()) + .close() + .node("br").close(); // HA Load Balancer. { - p.text("Service: LBSPolicy=" - + HALoadBalancerServlet.toString(req - .getServletContext())).node("br").close(); + p.text("Service: LBSPolicy=") + .node("span").attr("id", "lbs-policy") + .text(HALoadBalancerServlet.toString(req + .getServletContext())).close() + .node("br").close(); } // if(true) { // /* @@ -346,17 +383,30 @@ // // Ignore. // } final long fileSize = file == null ? 0L : file.length(); - p.text("HAJournal: file=" + file // - + ", commitCounter=" + commitCounter // - + ", nbytes=" + fileSize// - + (digestStr == null ? "" : ", md5=" + digestStr)// + p.text("HAJournal: file=") + .node("span").attr("id", "ha-journal-file") + .text("" + file).close() + .text(", commitCounter=") + .node("span").attr("id", "ha-journal-commit-counter") + .text("" + commitCounter).close() + .text(", nbytes=") + .node("span").attr("id", "ha-journal-nbytes") + .text("" + fileSize).close(); + if(digestStr != null) { + p.text(", md5=") + .node("span").attr("id", "ha-journal-md5") + .text(digestStr).close(); + } // + (releaseTime != -1L ? ", releaseTime=" // + RootBlockView.toString(releaseTime)// // : "")// - ).node("br").close(); + p.node("br").close(); + // Show the current root block. - if(debug) - current.node("pre", rb.toString()); + if(debug) { + current.node("span").attr("id", "root-block") + .text(rb.toString()).close(); + } } } @@ -396,20 +446,28 @@ .getProperty( com.bigdata.journal.Options.HALOG_COMPRESSOR, com.bigdata.journal.Options.DEFAULT_HALOG_COMPRESSOR); - p.text("HALogDir: nfiles=" - + nfiles - + ", nbytes=" - + nbytes - + ", path=" - + nexus.getHALogDir() - + ", compressorKey=" - + compressorKey - + ", lastHALogClosed=" - + (r == null ? "N/A" : CommitCounterUtility - .getCommitCounterStr(r.getCommitCounter())) - + ", liveLog=" - + (currentFile == null ? "N/A" : currentFile - .getName())).node("br").close(); + p.text("HALogDir: nfiles=") + .node("span").attr("id", "ha-log-dir-nfiles") + .text("" + nfiles).close() + .text(", nbytes=") + .node("span").attr("id", "ha-log-dir-nbytes") + .text("" + nbytes).close() + .text(", path=") + .node("span").attr("id", "ha-log-dir-path") + .text("" + nexus.getHALogDir()).close() + .text(", compressorKey=") + .node("span").attr("id", "ha-log-dir-compressor-key") + .text(compressorKey).close() + .text(", lastHALogClosed=") + .node("span").attr("id", "ha-log-dir-last-ha-log-closed") + .text((r == null ? "N/A" : CommitCounterUtility + .getCommitCounterStr(r.getCommitCounter()))) + .close() + .text(", liveLog=") + .node("span").attr("id", "ha-log-dir-live-log") + .text((currentFile == null ? "N/A" : + currentFile.getName())).close() + .node("br").close(); } if (digestEnum != null && (digestEnum == DigestEnum.All || digestEnum == DigestEnum.HALogs)) { @@ -446,14 +504,21 @@ } finally { r.close(); } - p.text("HALogFile: closingCommitCounter=" - + closingCommitCounter// - + ", file=" - + file// - + ", nbytes=" - + nbytes// - + (digestStr == null ? "" : ", md5=" - + digestStr)).node("br").close(); + p.text("HALogFile: closingCommitCounter=") + .node("span").attr("id", "ha-log-file-closing-commit-counter") + .text("" + closingCommitCounter).close() + .text(", file=") + .node("span").attr("id", "ha-log-file-file") + .text("" + file).close() + .text(", nbytes=") + .node("span").attr("id", "ha-log-file-nbytes") + .text("" + nbytes).close(); + if(digestStr != null) { + p.text(", md5=") + .node("span").attr("id", "ha-log-file-digest-str") + .text(digestStr).close(); + } + p.node("br").close(); } } } @@ -492,10 +557,16 @@ nbytes += sr.sizeOnDisk(); nfiles++; } - p.text("SnapshotDir: nfiles=" + nfiles + ", nbytes=" - + nbytes + ", path=" - + journal.getSnapshotManager().getSnapshotDir()) - .node("br").close(); + p.text("SnapshotDir: nfiles=") + .node("span").attr("id", "snapshot-dir-nfiles") + .text("" + nfiles).close() + .text(", nbytes=") + .node("span").attr("id", "snapshot-dir-nbytes") + .text("" + nbytes).close() + .text(", path=") + .node("span").attr("id", "snapshot-dir-path") + .text("" + journal.getSnapshotManager().getSnapshotDir()).close() + .node("br").close(); } if (true) { @@ -529,14 +600,22 @@ } } - p.text("SnapshotFile: commitTime=" - + RootBlockView.toString(rb.getLastCommitTime()) - + ", commitCounter=" - + rb.getCommitCounter() - + ", nbytes=" - + nbytes - + (digestStr == null ? "" : ", md5=" - + digestStr)).node("br").close(); + p.text("SnapshotFile: commitTime=") + .node("span").attr("id", "snapshot-file-commit-time") + .text(RootBlockView.toString(rb.getLastCommitTime())) + .close() + .text(", commitCounter=") + .node("span").attr("id", "snapshot-file-commit-counter") + .text("" + rb.getCommitCounter()).close() + .text(", nbytes=") + .node("span").attr("id", "snapshot-file-nbytes") + .text("" + nbytes).close(); + if(digestStr != null) { + p.text(", md5=") + .node("span").attr("id", "snapshot-file-md5") + .text(digestStr).close(); + } + p.node("br").close(); } @@ -588,8 +667,10 @@ p.close(); - if(debug) - current.node("pre", quorum.toString()); + if(debug) { + current.node("span").attr("id", "quorum").text(quorum.toString()) + .close(); + } } @@ -614,8 +695,8 @@ // Request RESTORE. if (haGlue.rebuildFromLeader(new HARemoteRebuildRequest()) != null) { - current.node("h2", - "Running Disaster Recovery for this service (REBUILD)."); + current.node("h2").attr("id", "rebuild") + .text("Running Disaster Recovery for this service (REBUILD)."); } @@ -650,7 +731,8 @@ { - final XMLBuilder.Node p = current.node("p"); + final XMLBuilder.Node ul = current.node("ul") + .attr("id", "quorum-services"); final UUID[] joined = quorum.getJoined(); @@ -677,6 +759,8 @@ } + final XMLBuilder.Node li = ul.node("li"); + /* * Do all RMIs to the remote service in a try/catch. This * allows us to catch problems with communications to the @@ -710,8 +794,10 @@ * Note error and continue with the next service. */ - p.text("Unable to reach service: " + remoteService) - .close(); + li.text("Unable to reach service: ") + .node("span").attr("class", "unreachable") + .text("" + remoteService).close() + .close(); log.error(ex, ex); @@ -738,24 +824,36 @@ + BigdataStatics.getContextPath(); // hyper link to NSS service. - p.node("a").attr("href", nssUrl).text(nssUrl).close(); + li.node("a").attr("class", "nss-url").attr("href", nssUrl) + .text(nssUrl).close(); // plus the other metadata. - p.text(" : "// - + (isLeader ? "leader" : (isFollower ? "follower" - : " is not joined"))// - + ", pipelineOrder=" - + (pipelineIndex == -1 ? "N/A" : pipelineIndex)// - + ", writePipelineAddr=" + writePipelineAddr// - + ", service=" + (isSelf ? "self" : "other")// - + ", extendedRunState=" + extendedRunState// - ).node("br").close(); + li.text(" : ") + .node("span").attr("class", "service-status") + .text((isLeader ? "leader" : (isFollower ? "follower" + : " is not joined"))).close() + .text(", pipelineOrder=") + .node("span").attr("class", "service-pipeline-order") + .text("" + (pipelineIndex == -1 ? "N/A" : pipelineIndex)) + .close() + .text(", writePipelineAddr=") + .node("span").attr("class", "service-write-pipeline-addr") + .text("" + writePipelineAddr).close() + .text(", service=") + .node("span").attr("class", "service-service") + .text((isSelf ? "self" : "other")).close() + .text(", extendedRunState=") + .node("span").attr("class", "service-extended-run-state") + .text(extendedRunState).close() + .node("br").close(); + + li.close(); } - p.close(); + ul.close(); } - + // DumpZookeeper { @@ -773,7 +871,8 @@ final XMLBuilder.Node p = current.node("p"); - p.text("ZooKeeper is not available.").close(); + p.text("ZooKeeper is not available.") + .attr("id", "zookeeper-unavailable").close(); } else { @@ -785,7 +884,7 @@ final PrintWriter out = new PrintWriter( resp.getOutputStream(), true/* autoFlush */); - out.print("<pre>\n"); + out.print("<span id=\"zookeeper\">\n"); try { @@ -808,7 +907,7 @@ } // close section. - out.print("\n</pre>"); + out.print("\n</span>"); // flush PrintWriter before resuming writes on Writer. out.flush(); Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-sails/src/java/com/bigdata/rdf/sail/webapp/StatusServlet.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-sails/src/java/com/bigdata/rdf/sail/webapp/StatusServlet.java 2014-08-07 13:42:47 UTC (rev 8608) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-sails/src/java/com/bigdata/rdf/sail/webapp/StatusServlet.java 2014-08-08 00:33:42 UTC (rev 8609) @@ -467,7 +467,7 @@ final PrintWriter out = new PrintWriter(resp.getOutputStream(), true/* autoFlush */); - out.print("<pre>\n"); + out.print("<pre id=\"journal-dump\">\n"); final DumpJournal dump = new DumpJournal( (Journal) getIndexManager()); @@ -508,12 +508,13 @@ dump.dumpJournal(out, namespaces, dumpHistory, dumpPages, dumpIndices, dumpTuples); + out.print("\n</pre>"); + // flush PrintStream before resuming writes on Writer. out.flush(); // close section. // section.close(); - out.print("\n</pre>"); } @@ -533,11 +534,16 @@ } - current.node("br", "Accepted query count=" - + getBigdataRDFContext().getQueryIdFactory().get()); + current.node("p").text("Accepted query count=") + .node("span").attr("id", "accepted-query-count") + .text("" +getBigdataRDFContext().getQueryIdFactory().get()) + .close() + .close(); - current.node("br", "Running query count=" - + getBigdataRDFContext().getQueries().size()); + current.node("p").text("Running query count=") + .node("span").attr("id", "running-query-count") + .text("" + getBigdataRDFContext().getQueries().size()).close() + .close(); // Offer a link to the "showQueries" page. { @@ -551,11 +557,12 @@ current.node("p").text("Show ") // - .node("a").attr("href", showQueriesURL).text("queries") + .node("a").attr("href", showQueriesURL) + .attr("id", "show-queries").text("queries").close() + .text(", ")// + .node("a").attr("href", showQueriesDetailsURL) + .attr("id", "show-query-details").text("query details") .close()// - .text(", ")// - .node("a").attr("href", showQueriesDetailsURL)// - .text("query details").close()// .text(".").close(); } @@ -566,12 +573,16 @@ .getNamespaces(getTimestamp(req)); current.node("h3", "Namespaces: "); + + XMLBuilder.Node ul = current.node("ul").attr("id", "namespaces"); for (String s : namespaces) { - current.node("p", s); + ul.node("li", s); } + + ul.close(); } @@ -621,7 +632,8 @@ // // } - current.node("pre", counterSet.toString()); + current.node("p").attr("id", "counter-set") + .text(counterSet.toString()).close(); } @@ -910,6 +922,7 @@ // Open <p>. current.node("p") + .attr("class", "update") // // .text("solutions=" + solutionsOut) // // @@ -917,9 +930,12 @@ // // // .text(", children=" + children.length) // - .text("elapsed=" + elapsedMillis + "ms") + .text("elapsed=").node("span") + .attr("class", "elapsed").text("" + elapsedMillis).close() + .text("ms") // .text(", ").node("a").attr("href", detailsURL) + .attr("class", "details-url") .text("details").close()// .close(); @@ -952,7 +968,8 @@ current.node("h2", "SPARQL"); - current.node("pre", queryString); + current.node("p").attr("class", "query-string") + .text(queryString).close(); } @@ -965,7 +982,8 @@ current.node("h2", "Parse Tree"); - current.node("pre", parseTree.dump("")); + current.node("p").attr("class", "parse-tree") + .text(parseTree.dump("")).close(); } @@ -976,7 +994,8 @@ current.node("h2", "Original AST"); - current.node("pre", originalAST.toString()); + current.node("p").attr("class", "original-ast") + .text(originalAST.toString()).close(); } @@ -1078,15 +1097,21 @@ current.node("p") // - .text("solutions=" + solutionsOut) + .text("solutions=").node("span").attr("class", "solutions") + .text(""+ solutionsOut).close() // - .text(", chunks=" + chunksOut) + .text(", chunks=").node("span").attr("class", "chunks") + .text(""+ chunksOut).close() // - .text(", children=" + children.length) + .text(", children=").node("span").attr("class", "children") + .text("" + children.length).close() // - .text(", elapsed=" + elapsedMillis + "ms") + .text(", elapsed=").node("span").attr("class", "elapsed") + .text("" + elapsedMillis).close() + .text("ms, ") // - .text(", ").node("a").attr("href", detailsURL) + .node("a").attr("href", detailsURL) + .attr("class", "details-url") .text("details").close()// .close(); @@ -1121,7 +1146,8 @@ current.node("h2", "SPARQL"); - current.node("pre", queryString); + current.node("p").attr("class", "query-string").text(queryString) + .close(); } @@ -1134,7 +1160,8 @@ current.node("h2", "Parse Tree"); - current.node("pre", parseTree.dump("")); + current.node("p").attr("class", "parse-tree") + .text(parseTree.dump("")).close(); } @@ -1145,7 +1172,8 @@ current.node("h2", "Original AST"); - current.node("pre", originalAST.toString()); + current.node("p").attr("class", "original-ast") + .text(originalAST.toString()).close(); } @@ -1156,7 +1184,8 @@ current.node("h2", "Optimized AST"); - current.node("pre", optimizedAST.toString()); + current.node("p").attr("class", "optimized-ast") + .text(optimizedAST.toString()).close(); } @@ -1167,8 +1196,8 @@ current.node("h2", "Query Plan"); - current.node("pre", BOpUtility - .toString(queryPlan)); + current.node("p").attr("class", "query-plan") + .text(BOpUtility.toString(queryPlan)).close(); } Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/css/style.css =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/css/style.css 2014-08-07 13:42:47 UTC (rev 8608) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/css/style.css 2014-08-08 00:33:42 UTC (rev 8609) @@ -347,6 +347,14 @@ box-sizing: border-box; } +#status-text { + word-break: break-all; +} + +#zookeeper, #counter-set { + white-space: pre; +} + /* workbench checks if we're in HA mode and shows health tab if we are */ #tab-selector a[data-target=health] { display: none; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mrp...@us...> - 2014-08-07 13:42:57
|
Revision: 8608 http://sourceforge.net/p/bigdata/code/8608 Author: mrpersonick Date: 2014-08-07 13:42:47 +0000 (Thu, 07 Aug 2014) Log Message: ----------- Fixed Blueprints CI errors related to Ticket# 998 commit Modified Paths: -------------- branches/BIGDATA_RELEASE_1_3_0/bigdata-blueprints/src/java/com/bigdata/blueprints/BigdataGraph.java branches/BIGDATA_RELEASE_1_3_0/bigdata-blueprints/src/test/com/bigdata/blueprints/AbstractTestBigdataGraph.java branches/BIGDATA_RELEASE_1_3_0/bigdata-blueprints/src/test/com/bigdata/blueprints/TestBigdataGraphEmbedded.java Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-blueprints/src/java/com/bigdata/blueprints/BigdataGraph.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-blueprints/src/java/com/bigdata/blueprints/BigdataGraph.java 2014-08-07 09:57:38 UTC (rev 8607) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-blueprints/src/java/com/bigdata/blueprints/BigdataGraph.java 2014-08-07 13:42:47 UTC (rev 8608) @@ -76,6 +76,11 @@ */ String LAX_EDGES = BigdataGraph.class.getName() + ".laxEdges"; + /** + * This is necessary to pass the test suites. + */ + String READ_FROM_WRITE_CONNECTION = BigdataGraph.class.getName() + ".readFromWriteConnection"; + } /** @@ -108,6 +113,11 @@ */ private final boolean laxEdges; + /** + * If true, read from the write connection. Necessary for the test suites. + */ + private final boolean readFromWriteConnection; + public BigdataGraph(final BlueprintsValueFactory factory) { this(factory, new Properties()); } @@ -117,7 +127,10 @@ this.factory = factory; - this.laxEdges = Boolean.valueOf(props.getProperty(Options.LAX_EDGES, "false")); + this.laxEdges = Boolean.valueOf(props.getProperty( + Options.LAX_EDGES, "false")); + this.readFromWriteConnection = Boolean.valueOf(props.getProperty( + Options.READ_FROM_WRITE_CONNECTION, "false")); this.TYPE = factory.getTypeURI(); this.VERTEX = factory.getVertexURI(); @@ -176,8 +189,11 @@ try { + final RepositoryConnection cxn = readFromWriteConnection ? + getWriteConnection() : getReadConnection(); + final RepositoryResult<Statement> result = - getReadConnection().getStatements(uri, prop, null, false); + cxn.getStatements(uri, prop, null, false); if (result.hasNext()) { @@ -297,8 +313,11 @@ try { - final RepositoryResult<Statement> result = - getReadConnection().getStatements(uri, null, null, false); + final RepositoryConnection cxn = readFromWriteConnection ? + getWriteConnection() : getReadConnection(); + + final RepositoryResult<Statement> result = + cxn.getStatements(uri, null, null, false); final Set<String> properties = new LinkedHashSet<String>(); @@ -619,8 +638,11 @@ final URI edge = factory.toEdgeURI(key.toString()); + final RepositoryConnection cxn = readFromWriteConnection ? + getWriteConnection() : getReadConnection(); + final RepositoryResult<Statement> result = - getWriteConnection().getStatements(null, edge, null, false); + cxn.getStatements(null, edge, null, false); if (result.hasNext()) { @@ -725,8 +747,11 @@ try { + final RepositoryConnection cxn = readFromWriteConnection ? + getWriteConnection() : getReadConnection(); + final org.openrdf.query.GraphQuery query = - getWriteConnection().prepareGraphQuery(QueryLanguage.SPARQL, queryStr); + cxn.prepareGraphQuery(QueryLanguage.SPARQL, queryStr); final GraphQueryResult stmts = query.evaluate(); @@ -752,8 +777,11 @@ try { + final RepositoryConnection cxn = readFromWriteConnection ? + getWriteConnection() : getReadConnection(); + final org.openrdf.query.GraphQuery query = - getWriteConnection().prepareGraphQuery(QueryLanguage.SPARQL, queryStr); + cxn.prepareGraphQuery(QueryLanguage.SPARQL, queryStr); final GraphQueryResult stmts = query.evaluate(); @@ -811,8 +839,11 @@ try { + final RepositoryConnection cxn = readFromWriteConnection ? + getWriteConnection() : getReadConnection(); + final org.openrdf.query.GraphQuery query = - getWriteConnection().prepareGraphQuery(QueryLanguage.SPARQL, queryStr); + cxn.prepareGraphQuery(QueryLanguage.SPARQL, queryStr); final GraphQueryResult stmts = query.evaluate(); @@ -882,7 +913,10 @@ try { - if (getWriteConnection().hasStatement(uri, TYPE, VERTEX, false)) { + final RepositoryConnection cxn = readFromWriteConnection ? + getWriteConnection() : getReadConnection(); + + if (cxn.hasStatement(uri, TYPE, VERTEX, false)) { return new BigdataVertex(uri, this); } @@ -908,8 +942,11 @@ try { + final RepositoryConnection cxn = readFromWriteConnection ? + getWriteConnection() : getReadConnection(); + final RepositoryResult<Statement> result = - getWriteConnection().getStatements(null, TYPE, VERTEX, false); + cxn.getStatements(null, TYPE, VERTEX, false); return new VertexIterable(result, true); @@ -935,8 +972,11 @@ try { + final RepositoryConnection cxn = readFromWriteConnection ? + getWriteConnection() : getReadConnection(); + final RepositoryResult<Statement> result = - getWriteConnection().getStatements(null, p, o, false); + cxn.getStatements(null, p, o, false); return new VertexIterable(result, true); @@ -1202,16 +1242,10 @@ */ public BigdataGraphlet project(final String queryStr) throws Exception { -// final String operation = -// QueryParserUtil.removeSPARQLQueryProlog(queryStr).toLowerCase(); -// -// if (!operation.startsWith("construct")) { -// throw new IllegalArgumentException("not a graph query"); -// } - try { - final RepositoryConnection cxn = getReadConnection(); + final RepositoryConnection cxn = readFromWriteConnection ? + getWriteConnection() : getReadConnection(); try { @@ -1249,16 +1283,10 @@ */ public BigdataSelection select(final String queryStr) throws Exception { -// final String operation = -// QueryParserUtil.removeSPARQLQueryProlog(queryStr).toLowerCase(); -// -// if (!operation.startsWith("select")) { -// throw new IllegalArgumentException("not a tuple query"); -// } - try { - final RepositoryConnection cxn = getReadConnection(); + final RepositoryConnection cxn = readFromWriteConnection ? + getWriteConnection() : getReadConnection(); try { Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-blueprints/src/test/com/bigdata/blueprints/AbstractTestBigdataGraph.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-blueprints/src/test/com/bigdata/blueprints/AbstractTestBigdataGraph.java 2014-08-07 09:57:38 UTC (rev 8607) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-blueprints/src/test/com/bigdata/blueprints/AbstractTestBigdataGraph.java 2014-08-07 13:42:47 UTC (rev 8608) @@ -89,6 +89,8 @@ props.setProperty(BigdataSail.Options.QUADS, "false"); props.setProperty(BigdataSail.Options.STATEMENT_IDENTIFIERS, "false"); + props.setProperty(BigdataGraph.Options.READ_FROM_WRITE_CONNECTION, "true"); + return props; } Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-blueprints/src/test/com/bigdata/blueprints/TestBigdataGraphEmbedded.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-blueprints/src/test/com/bigdata/blueprints/TestBigdataGraphEmbedded.java 2014-08-07 09:57:38 UTC (rev 8607) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-blueprints/src/test/com/bigdata/blueprints/TestBigdataGraphEmbedded.java 2014-08-07 13:42:47 UTC (rev 8608) @@ -24,28 +24,24 @@ import java.io.File; import java.lang.reflect.Method; -import java.util.ArrayList; import java.util.Arrays; -import java.util.Date; -import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -import java.util.concurrent.CountDownLatch; +import java.util.Properties; import org.apache.log4j.Logger; import com.bigdata.rdf.sail.BigdataSail; import com.bigdata.rdf.sail.BigdataSailRepository; +import com.bigdata.rdf.sail.BigdataSailRepositoryConnection; import com.tinkerpop.blueprints.Edge; import com.tinkerpop.blueprints.Element; import com.tinkerpop.blueprints.Graph; import com.tinkerpop.blueprints.TestSuite; -import com.tinkerpop.blueprints.TransactionalGraph; import com.tinkerpop.blueprints.TransactionalGraphTestSuite; import com.tinkerpop.blueprints.Vertex; import com.tinkerpop.blueprints.impls.GraphTest; -import com.tinkerpop.blueprints.util.io.MockSerializable; import com.tinkerpop.blueprints.util.io.graphml.GraphMLReader; /** @@ -83,114 +79,61 @@ //} -// public void testDataTypeValidationOnProperties() throws Exception { +// public void testAddVertexProperties() throws Exception { // final BigdataGraphTest test = new BigdataGraphTest(); // test.stopWatch(); // final BigdataTestSuite testSuite = new BigdataTestSuite(test); // try { -// testSuite.testDataTypeValidationOnProperties(); +// testSuite.testAddVertexProperties(); // } finally { // test.shutdown(); // } // // } + + private static class BigdataTestSuite extends TestSuite { public BigdataTestSuite(final BigdataGraphTest graphTest) { super(graphTest); } - public void testDataTypeValidationOnProperties() { - - final Graph graph = graphTest.generateGraph(); - if (graph.getFeatures().supportsElementProperties() && !graph.getFeatures().isWrapper) { - final Vertex vertexA = graph.addVertex(null); - final Vertex vertexB = graph.addVertex(null); - final Edge edge = graph.addEdge(null, vertexA, vertexB, graphTest.convertLabel("knows")); + public void testAddVertexProperties() throws Exception { + BigdataGraphEmbedded graph = (BigdataGraphEmbedded) graphTest.generateGraph(); + if (graph.getFeatures().supportsVertexProperties) { + Vertex v1 = graph.addVertex(graphTest.convertId("1")); + Vertex v2 = graph.addVertex(graphTest.convertId("2")); + +// graph.commit(); + + for (Vertex v : graph.getVertices()) { + System.err.println(v); + } - trySetProperty(vertexA, "keyString", "value", graph.getFeatures().supportsStringProperty); - trySetProperty(edge, "keyString", "value", graph.getFeatures().supportsStringProperty); + System.err.println("\n"+((BigdataSailRepositoryConnection) + graph.getWriteConnection()).getTripleStore().dumpStore()); + + if (graph.getFeatures().supportsStringProperty) { + v1.setProperty("key1", "value1"); + graph.commit(); + System.err.println("\n"+((BigdataSailRepositoryConnection) + graph.getWriteConnection()).getTripleStore().dumpStore()); + assertEquals("value1", v1.getProperty("key1")); + } - trySetProperty(vertexA, "keyInteger", 100, graph.getFeatures().supportsIntegerProperty); - trySetProperty(edge, "keyInteger", 100, graph.getFeatures().supportsIntegerProperty); + if (graph.getFeatures().supportsIntegerProperty) { + v1.setProperty("key2", 10); + v2.setProperty("key2", 20); - trySetProperty(vertexA, "keyLong", 10000L, graph.getFeatures().supportsLongProperty); - trySetProperty(edge, "keyLong", 10000L, graph.getFeatures().supportsLongProperty); + assertEquals(10, v1.getProperty("key2")); + assertEquals(20, v2.getProperty("key2")); + } - trySetProperty(vertexA, "keyDouble", 100.321d, graph.getFeatures().supportsDoubleProperty); - trySetProperty(edge, "keyDouble", 100.321d, graph.getFeatures().supportsDoubleProperty); - - trySetProperty(vertexA, "keyFloat", 100.321f, graph.getFeatures().supportsFloatProperty); - trySetProperty(edge, "keyFloat", 100.321f, graph.getFeatures().supportsFloatProperty); - - trySetProperty(vertexA, "keyBoolean", true, graph.getFeatures().supportsBooleanProperty); - trySetProperty(edge, "keyBoolean", true, graph.getFeatures().supportsBooleanProperty); - - System.err.println("supportsSerializableObjectProperty" + graph.getFeatures().supportsSerializableObjectProperty); - trySetProperty(vertexA, "keyDate", new Date(), graph.getFeatures().supportsSerializableObjectProperty); - trySetProperty(edge, "keyDate", new Date(), graph.getFeatures().supportsSerializableObjectProperty); - - final ArrayList<String> listA = new ArrayList<String>(); - listA.add("try1"); - listA.add("try2"); - - trySetProperty(vertexA, "keyListString", listA, graph.getFeatures().supportsUniformListProperty); - trySetProperty(edge, "keyListString", listA, graph.getFeatures().supportsUniformListProperty); - - - tryGetProperty(vertexA, "keyListString", listA, graph.getFeatures().supportsUniformListProperty); - tryGetProperty(edge, "keyListString", listA, graph.getFeatures().supportsUniformListProperty); - - - final ArrayList listB = new ArrayList(); - listB.add("try1"); - listB.add(2); - - trySetProperty(vertexA, "keyListMixed", listB, graph.getFeatures().supportsMixedListProperty); - trySetProperty(edge, "keyListMixed", listB, graph.getFeatures().supportsMixedListProperty); - - tryGetProperty(vertexA, "keyListString", listA, graph.getFeatures().supportsMixedListProperty); - tryGetProperty(edge, "keyListString", listA, graph.getFeatures().supportsMixedListProperty); - - - trySetProperty(vertexA, "keyArrayString", new String[]{"try1", "try2"}, graph.getFeatures().supportsPrimitiveArrayProperty); - trySetProperty(edge, "keyArrayString", new String[]{"try1", "try2"}, graph.getFeatures().supportsPrimitiveArrayProperty); - - trySetProperty(vertexA, "keyArrayInteger", new int[]{1, 2}, graph.getFeatures().supportsPrimitiveArrayProperty); - trySetProperty(edge, "keyArrayInteger", new int[]{1, 2}, graph.getFeatures().supportsPrimitiveArrayProperty); - - trySetProperty(vertexA, "keyArrayLong", new long[]{1000l, 2000l}, graph.getFeatures().supportsPrimitiveArrayProperty); - trySetProperty(edge, "keyArrayLong", new long[]{1000l, 2000l}, graph.getFeatures().supportsPrimitiveArrayProperty); - - trySetProperty(vertexA, "keyArrayFloat", new float[]{1000.321f, 2000.321f}, graph.getFeatures().supportsPrimitiveArrayProperty); - trySetProperty(edge, "keyArrayFloat", new float[]{1000.321f, 2000.321f}, graph.getFeatures().supportsPrimitiveArrayProperty); - - trySetProperty(vertexA, "keyArrayDouble", new double[]{1000.321d, 2000.321d}, graph.getFeatures().supportsPrimitiveArrayProperty); - trySetProperty(edge, "keyArrayDouble", new double[]{1000.321d, 2000.321d}, graph.getFeatures().supportsPrimitiveArrayProperty); - - trySetProperty(vertexA, "keyArrayBoolean", new boolean[]{false, true}, graph.getFeatures().supportsPrimitiveArrayProperty); - trySetProperty(edge, "keyArrayBoolean", new boolean[]{false, true}, graph.getFeatures().supportsPrimitiveArrayProperty); - - trySetProperty(vertexA, "keyArrayEmpty", new int[0], graph.getFeatures().supportsPrimitiveArrayProperty); - trySetProperty(edge, "keyArrayEmpty", new int[0], graph.getFeatures().supportsPrimitiveArrayProperty); - - final Map map = new HashMap(); - map.put("testString", "try"); - map.put("testInteger", "string"); - - trySetProperty(vertexA, "keyMap", map, graph.getFeatures().supportsMapProperty); - trySetProperty(edge, "keyMap", map, graph.getFeatures().supportsMapProperty); - - final MockSerializable mockSerializable = new MockSerializable(); - mockSerializable.setTestField("test"); - trySetProperty(vertexA, "keySerializable", mockSerializable, graph.getFeatures().supportsSerializableObjectProperty); - trySetProperty(edge, "keySerializable", mockSerializable, graph.getFeatures().supportsSerializableObjectProperty); - } - graph.shutdown(); } + private void trySetProperty(final Element element, final String key, final Object value, final boolean allowDataType) { boolean exceptionTossed = false; @@ -262,10 +205,12 @@ try { if (testGraphs.containsKey(key) == false) { - final BigdataSail testSail = getSail(); + final Properties props = getProperties(); + final BigdataSail testSail = getSail(props); testSail.initialize(); final BigdataSailRepository repo = new BigdataSailRepository(testSail); - final BigdataGraphEmbedded graph = new BigdataGraphEmbedded(repo) { + final BigdataGraphEmbedded graph = new BigdataGraphEmbedded( + repo, BigdataRDFFactory.INSTANCE, props) { /** * Test cases have weird semantics for shutdown. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mrp...@us...> - 2014-08-07 09:57:45
|
Revision: 8607 http://sourceforge.net/p/bigdata/code/8607 Author: mrpersonick Date: 2014-08-07 09:57:38 +0000 (Thu, 07 Aug 2014) Log Message: ----------- Ticket #1001: Create extensible mechanism for inline URIs Modified Paths: -------------- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/DTE.java Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/DTE.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/DTE.java 2014-08-07 09:40:06 UTC (rev 8606) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/DTE.java 2014-08-07 09:57:38 UTC (rev 8607) @@ -332,7 +332,11 @@ * etc. Also, the match will always be on the local name once we proof * the namespace. */ -// if (datatype == null) { + + if (datatype == null) { + return null; + } + if (datatype.equals(XSD.IPV4)) { /* * Note: This is a bit of a rough spot in the API. There is no This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mrp...@us...> - 2014-08-07 09:40:15
|
Revision: 8606 http://sourceforge.net/p/bigdata/code/8606 Author: mrpersonick Date: 2014-08-07 09:40:06 +0000 (Thu, 07 Aug 2014) Log Message: ----------- Ticket #1001: Create extensible mechanism for inline URIs Added Paths: ----------- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/MultipurposeIDHandler.java Added: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/MultipurposeIDHandler.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/MultipurposeIDHandler.java (rev 0) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/MultipurposeIDHandler.java 2014-08-07 09:40:06 UTC (rev 8606) @@ -0,0 +1,120 @@ +/** + +Copyright (C) SYSTAP, LLC 2006-Infinity. All rights reserved. + +Contact: + SYSTAP, LLC + 4501 Tower Road + Greensboro, NC 27410 + lic...@bi... + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 of the License. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +package com.bigdata.rdf.internal; + +import java.util.UUID; + +import com.bigdata.rdf.internal.impl.literal.AbstractLiteralIV; +import com.bigdata.rdf.internal.impl.literal.FullyInlineTypedLiteralIV; +import com.bigdata.rdf.internal.impl.literal.UUIDLiteralIV; +import com.bigdata.rdf.internal.impl.literal.XSDNumericIV; +import com.bigdata.rdf.internal.impl.uri.IPv4AddrIV; +import com.bigdata.rdf.model.BigdataLiteral; + +/** + * Inline URI handler for IDs of multiple types. + */ +public class MultipurposeIDHandler extends InlineURIHandler { + + /** + * Maximum length of string text to inline if the localName cannot be parsed + * into a UUID, Numeric, or IPv4 address. + */ + private final int maxTextLen; + + public MultipurposeIDHandler(final String namespace) { + this(namespace, Integer.MAX_VALUE); + } + + /** + * Supply the maximum length of string text to inline if the localName + * cannot be parsed into a UUID, Numeric, or IPv4 address. + */ + public MultipurposeIDHandler(final String namespace, final int maxTextLen) { + super(namespace); + this.maxTextLen = maxTextLen; + } + + @Override + @SuppressWarnings("rawtypes") + protected AbstractLiteralIV createInlineIV(final String localName) { + + try { + return new UUIDLiteralIV<>(UUID.fromString(localName)); + } catch (Exception ex) { + // ok, not a uuid + } + + try { + return new XSDNumericIV(Byte.parseByte(localName)); + } catch (Exception ex) { + // ok, not a byte + } + + try { + return new XSDNumericIV(Short.parseShort(localName)); + } catch (Exception ex) { + // ok, not a short + } + + try { + return new XSDNumericIV(Integer.parseInt(localName)); + } catch (Exception ex) { + // ok, not a int + } + + try { + return new XSDNumericIV(Long.parseLong(localName)); + } catch (Exception ex) { + // ok, not a long + } + + try { + return new XSDNumericIV(Float.parseFloat(localName)); + } catch (Exception ex) { + // ok, not a float + } + + try { + return new XSDNumericIV(Double.parseDouble(localName)); + } catch (Exception ex) { + // ok, not a double + } + + try { + return new IPv4AddrIV(localName); + } catch (Exception ex) { + // ok, not an ip address + } + + if (localName.length() < maxTextLen) { + // just use a UTF encoded string, this is expensive + return new FullyInlineTypedLiteralIV<BigdataLiteral>(localName); + } + + return null; + + } + +} Property changes on: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/MultipurposeIDHandler.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mrp...@us...> - 2014-08-07 09:03:07
|
Revision: 8605 http://sourceforge.net/p/bigdata/code/8605 Author: mrpersonick Date: 2014-08-07 09:02:59 +0000 (Thu, 07 Aug 2014) Log Message: ----------- Ticket #1001: Create extensible mechanism for inline URIs Modified Paths: -------------- branches/BIGDATA_RELEASE_1_3_0/bigdata-sails/src/test/com/bigdata/rdf/sail/TestInlineURIs.java Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-sails/src/test/com/bigdata/rdf/sail/TestInlineURIs.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-sails/src/test/com/bigdata/rdf/sail/TestInlineURIs.java 2014-08-07 08:50:25 UTC (rev 8604) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-sails/src/test/com/bigdata/rdf/sail/TestInlineURIs.java 2014-08-07 09:02:59 UTC (rev 8605) @@ -51,6 +51,7 @@ import com.bigdata.rdf.model.BigdataValueFactory; import com.bigdata.rdf.store.AbstractTripleStore; import com.bigdata.rdf.vocab.BaseVocabularyDecl; +import com.bigdata.rdf.vocab.DefaultBigdataVocabulary; import com.bigdata.rdf.vocab.RDFSVocabulary; /** @@ -379,7 +380,7 @@ public static final String CUSTOM_NAMESPACE = "application:id:"; - public static class CustomVocab extends RDFSVocabulary { + public static class CustomVocab extends DefaultBigdataVocabulary { public CustomVocab() { super(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mrp...@us...> - 2014-08-07 08:50:39
|
Revision: 8604 http://sourceforge.net/p/bigdata/code/8604 Author: mrpersonick Date: 2014-08-07 08:50:25 +0000 (Thu, 07 Aug 2014) Log Message: ----------- Ticket #1001: Create extensible mechanism for inline URIs Modified Paths: -------------- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/DTE.java branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/IVUtility.java branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/LexiconConfiguration.java branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/XSD.java branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/impl/AbstractIV.java branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/impl/uri/URIExtensionIV.java branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/lexicon/LexiconRelation.java branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/store/AbstractTripleStore.java branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/internal/HashCollisionUtility.java branches/BIGDATA_RELEASE_1_3_0/bigdata-sails/src/java/com/bigdata/rdf/sail/BigdataSailFactory.java branches/BIGDATA_RELEASE_1_3_0/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailEmbeddedFederationWithQuads.java branches/BIGDATA_RELEASE_1_3_0/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithQuads.java branches/BIGDATA_RELEASE_1_3_0/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithSids.java branches/BIGDATA_RELEASE_1_3_0/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithoutSids.java branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/WEB-INF/GraphStore.properties Added Paths: ----------- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/IInlineURIFactory.java branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/InlineIPv4URIHandler.java branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/InlineURIFactory.java branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/InlineURIHandler.java branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/InlineUUIDURIHandler.java branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/NoInlineURIFactory.java branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/impl/uri/IPv4AddrIV.java branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/vocab/BaseVocabularyDecl.java branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/vocab/DefaultBigdataVocabulary.java branches/BIGDATA_RELEASE_1_3_0/bigdata-sails/src/test/com/bigdata/rdf/sail/TestInlineURIs.java Removed Paths: ------------- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/impl/uri/IPAddrIV.java Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/DTE.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/DTE.java 2014-08-04 10:06:47 UTC (rev 8603) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/DTE.java 2014-08-07 08:50:25 UTC (rev 8604) @@ -332,11 +332,16 @@ * etc. Also, the match will always be on the local name once we proof * the namespace. */ - if (datatype == null) { +// if (datatype == null) { + if (datatype.equals(XSD.IPV4)) { /* * Note: This is a bit of a rough spot in the API. There is no * datatype associated with [Extension] since it is a place holder * for any an extension for any datatype. + * + * Right now I am hijacking Extension for IPv4. + * + * TODO FIXME */ return Extension; } Added: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/IInlineURIFactory.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/IInlineURIFactory.java (rev 0) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/IInlineURIFactory.java 2014-08-07 08:50:25 UTC (rev 8604) @@ -0,0 +1,53 @@ +/** + +Copyright (C) SYSTAP, LLC 2006-Infinity. All rights reserved. + +Contact: + SYSTAP, LLC + 4501 Tower Road + Greensboro, NC 27410 + lic...@bi... + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 of the License. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +package com.bigdata.rdf.internal; + +import org.openrdf.model.URI; + +import com.bigdata.rdf.internal.impl.uri.URIExtensionIV; +import com.bigdata.rdf.vocab.Vocabulary; + +/** + * This factory will create {@link URIExtensionIV}s using + * {@link InlineURIHandler} delegates. Handler delegates are registered with + * a namespace prefix that they can handle. These namespace prefixes must + * be defined in the vocabulary so that they can be properly inlined. The URI + * to be inlined will then be presented to each handler for conversion. The + * first registered handler to convert the URI wins. If no handler can handle + * the URI then no inline URI iv is created. + */ +public interface IInlineURIFactory { + + /** + * Give the handlers a chance to look up the vocab IV for their namespace + * prefixes. + */ + void init(final Vocabulary vocab); + + /** + * Create an inline URIExtensionIV for the supplied URI. + */ + URIExtensionIV<?> createInlineURIIV(final URI uri); + +} Property changes on: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/IInlineURIFactory.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/IVUtility.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/IVUtility.java 2014-08-04 10:06:47 UTC (rev 8603) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/IVUtility.java 2014-08-07 08:50:25 UTC (rev 8604) @@ -35,8 +35,6 @@ import java.io.IOException; import java.math.BigDecimal; import java.math.BigInteger; -import java.net.InetAddress; -import java.net.UnknownHostException; import java.util.LinkedList; import java.util.List; import java.util.UUID; @@ -68,7 +66,7 @@ import com.bigdata.rdf.internal.impl.literal.XSDUnsignedLongIV; import com.bigdata.rdf.internal.impl.literal.XSDUnsignedShortIV; import com.bigdata.rdf.internal.impl.uri.FullyInlineURIIV; -import com.bigdata.rdf.internal.impl.uri.IPAddrIV; +import com.bigdata.rdf.internal.impl.uri.IPv4AddrIV; import com.bigdata.rdf.internal.impl.uri.PartlyInlineURIIV; import com.bigdata.rdf.internal.impl.uri.URIExtensionIV; import com.bigdata.rdf.internal.impl.uri.VocabURIByteIV; @@ -525,8 +523,9 @@ o += namespaceIV.byteLength(); - final FullyInlineTypedLiteralIV<BigdataLiteral> localNameIV = (FullyInlineTypedLiteralIV<BigdataLiteral>) decodeFromOffset( - key, o); + final AbstractLiteralIV<BigdataLiteral, ?> localNameIV = + (AbstractLiteralIV<BigdataLiteral, ?>) decodeFromOffset( + key, o); final IV iv = new URIExtensionIV<BigdataURI>(localNameIV, namespaceIV); @@ -538,17 +537,18 @@ // The data type final DTE dte = AbstractIV.getDTE(flags); switch (dte) { - case XSDBoolean: { - /* - * TODO Using XSDBoolean so that we can know how to decode this thing - * as an IPAddrIV. We need to fix the Extension mechanism for URIs. - * Extension is already used above. - */ - final byte[] addr = new byte[5]; - System.arraycopy(key, o, addr, 0, 5); - final Inet4Address ip = new Inet4Address(addr); - return new IPAddrIV(ip); - } +// deprecated in favor of the extensible InlineURIFactory +// case XSDBoolean: { +// /* +// * TODO Using XSDBoolean so that we can know how to decode this thing +// * as an IPAddrIV. We need to fix the Extension mechanism for URIs. +// * Extension is already used above. +// */ +// final byte[] addr = new byte[5]; +// System.arraycopy(key, o, addr, 0, 5); +// final Inet4Address ip = new Inet4Address(addr); +// return new IPv4AddrIV(ip); +// } case XSDByte: { final byte x = key[o];//KeyBuilder.decodeByte(key[o]); return new VocabURIByteIV<BigdataURI>(x); @@ -706,6 +706,18 @@ } return decodeInlineUnicodeLiteral(key,o); } + case Extension: { + /* + * TODO Set up an extended DTE mechanism and check the byte after + * the flags for the extended DTE. Right now I am just hickacking + * Extension for IPv4. + */ + final byte[] addr = new byte[5]; + System.arraycopy(key, o, addr, 0, 5); + final Inet4Address ip = new Inet4Address(addr); + final AbstractLiteralIV iv = new IPv4AddrIV(ip); + return isExtension ? new LiteralExtensionIV(iv, datatype) : iv; + } default: throw new UnsupportedOperationException("dte=" + dte); } Added: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/InlineIPv4URIHandler.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/InlineIPv4URIHandler.java (rev 0) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/InlineIPv4URIHandler.java 2014-08-07 08:50:25 UTC (rev 8604) @@ -0,0 +1,61 @@ +/** + +Copyright (C) SYSTAP, LLC 2006-Infinity. All rights reserved. + +Contact: + SYSTAP, LLC + 4501 Tower Road + Greensboro, NC 27410 + lic...@bi... + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 of the License. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +package com.bigdata.rdf.internal; + +import com.bigdata.rdf.internal.impl.literal.AbstractLiteralIV; +import com.bigdata.rdf.internal.impl.uri.IPv4AddrIV; + +/** + * Inline URI handler for IPv4 host addresses. + */ +public class InlineIPv4URIHandler extends InlineURIHandler { + + /** + * Default URI namespace for inline IPv4 addresses. + */ + public static final String NAMESPACE = "urn:ipv4:"; + + public InlineIPv4URIHandler(final String namespace) { + super(namespace); + } + + @SuppressWarnings("rawtypes") + protected AbstractLiteralIV createInlineIV(final String localName) { + + if (localName == null) { + return null; + } + + try { + return new IPv4AddrIV(localName); + } catch (Exception ex) { + /* + * Could not parse localName into an IPv4. Fall through to TermIV. + */ + return null; + } + + } + +} Property changes on: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/InlineIPv4URIHandler.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/InlineURIFactory.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/InlineURIFactory.java (rev 0) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/InlineURIFactory.java 2014-08-07 08:50:25 UTC (rev 8604) @@ -0,0 +1,74 @@ +/** + +Copyright (C) SYSTAP, LLC 2006-Infinity. All rights reserved. + +Contact: + SYSTAP, LLC + 4501 Tower Road + Greensboro, NC 27410 + lic...@bi... + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 of the License. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +package com.bigdata.rdf.internal; + +import java.util.LinkedList; +import java.util.List; + +import org.openrdf.model.URI; + +import com.bigdata.rdf.internal.impl.uri.URIExtensionIV; +import com.bigdata.rdf.vocab.Vocabulary; + +/** + * Default implementation of {@link IInlineURIFactory} that comes pre-loaded + * with two handlers: IPv4 ({@link InlineIPv4URIHandler}) and UUID + * ({@link InlineUUIDURIHandler}. + */ +public class InlineURIFactory implements IInlineURIFactory { + + private final List<InlineURIHandler> handlers = + new LinkedList<InlineURIHandler>(); + + /** + * By default, handle IPv4 and UUID. + */ + public InlineURIFactory() { + addHandler(new InlineUUIDURIHandler(InlineUUIDURIHandler.NAMESPACE)); + addHandler(new InlineIPv4URIHandler(InlineIPv4URIHandler.NAMESPACE)); + } + + protected void addHandler(final InlineURIHandler handler) { + this.handlers.add(handler); + } + + public void init(final Vocabulary vocab) { + for (InlineURIHandler handler : handlers) { + handler.init(vocab); + } + } + + @Override + @SuppressWarnings({ "unchecked", "rawtypes" }) + public URIExtensionIV createInlineURIIV(URI uri) { + for (InlineURIHandler handler : handlers) { + final URIExtensionIV iv = handler.createInlineIV(uri); + if (iv != null) { + return iv; + } + } + return null; + } + +} Property changes on: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/InlineURIFactory.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/InlineURIHandler.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/InlineURIHandler.java (rev 0) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/InlineURIHandler.java 2014-08-07 08:50:25 UTC (rev 8604) @@ -0,0 +1,102 @@ +/** + +Copyright (C) SYSTAP, LLC 2006-Infinity. All rights reserved. + +Contact: + SYSTAP, LLC + 4501 Tower Road + Greensboro, NC 27410 + lic...@bi... + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 of the License. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +package com.bigdata.rdf.internal; + +import org.openrdf.model.URI; +import org.openrdf.model.impl.URIImpl; + +import com.bigdata.rdf.internal.impl.literal.AbstractLiteralIV; +import com.bigdata.rdf.internal.impl.uri.URIExtensionIV; +import com.bigdata.rdf.vocab.Vocabulary; + +/** + * Handler is mapped to a namespace prefix. When a URI is presented that + * matches the handler's namespace prefix, attempt to parse the remaining + * portion of the URI into an inline literal. The namespace prefix must be + * present in the vocabulary. The localName must be parseable into an inline + * literal. If either of these things is not true the URI will not be inlined. + */ +public abstract class InlineURIHandler { + + /** + * The namespace prefix. + */ + protected final String namespace; + + /** + * Namespace prefix length. + */ + protected final int len; + + /** + * The inline vocab IV for the namespace prefix. + */ + @SuppressWarnings("rawtypes") + protected transient IV namespaceIV; + + /** + * Create a handler for the supplied namespace prefix. + */ + public InlineURIHandler(final String namespace) { + this.namespace = namespace; + this.len = namespace.length(); + } + + /** + * Lookup the namespace IV from the vocabulary. + */ + public void init(final Vocabulary vocab) { + this.namespaceIV = vocab.get(new URIImpl(namespace)); + } + + @SuppressWarnings({ "rawtypes", "unchecked" }) + protected URIExtensionIV createInlineIV(final URI uri) { + + /* + * If the namspace prefix is not in the vocabulary we can't inline + * anything. + */ + if (namespaceIV == null) { + return null; + } + + if (uri.stringValue().startsWith(namespace)) { + final String localName = uri.stringValue().substring(len); + final AbstractLiteralIV localNameIV = createInlineIV(localName); + if (localNameIV != null) { + return new URIExtensionIV(localNameIV, namespaceIV); + } + } + + return null; + } + + /** + * Concrete subclasses are responsible for actually creating the inline + * literal IV for the localName. + */ + @SuppressWarnings("rawtypes") + protected abstract AbstractLiteralIV createInlineIV(final String localName); + +} Property changes on: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/InlineURIHandler.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/InlineUUIDURIHandler.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/InlineUUIDURIHandler.java (rev 0) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/InlineUUIDURIHandler.java 2014-08-07 08:50:25 UTC (rev 8604) @@ -0,0 +1,63 @@ +/** + +Copyright (C) SYSTAP, LLC 2006-Infinity. All rights reserved. + +Contact: + SYSTAP, LLC + 4501 Tower Road + Greensboro, NC 27410 + lic...@bi... + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 of the License. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +package com.bigdata.rdf.internal; + +import java.util.UUID; + +import com.bigdata.rdf.internal.impl.literal.AbstractLiteralIV; +import com.bigdata.rdf.internal.impl.literal.UUIDLiteralIV; + +/** + * Inline URI handler for UUIDs. + */ +public class InlineUUIDURIHandler extends InlineURIHandler { + + /** + * Default URI namespace for inline UUIDs. + */ + public static final String NAMESPACE = "urn:uuid:"; + + public InlineUUIDURIHandler(final String namespace) { + super(namespace); + } + + @SuppressWarnings("rawtypes") + protected AbstractLiteralIV createInlineIV(final String localName) { + + if (localName == null) { + return null; + } + + try { + return new UUIDLiteralIV(UUID.fromString(localName)); + } catch (IllegalArgumentException ex) { + /* + * Could not parse localName into a UUID. Fall through to TermIV. + */ + return null; + } + + } + +} Property changes on: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/InlineUUIDURIHandler.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/LexiconConfiguration.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/LexiconConfiguration.java 2014-08-04 10:06:47 UTC (rev 8603) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/LexiconConfiguration.java 2014-08-07 08:50:25 UTC (rev 8604) @@ -59,7 +59,7 @@ import com.bigdata.rdf.internal.impl.literal.XSDUnsignedLongIV; import com.bigdata.rdf.internal.impl.literal.XSDUnsignedShortIV; import com.bigdata.rdf.internal.impl.uri.FullyInlineURIIV; -import com.bigdata.rdf.internal.impl.uri.IPAddrIV; +import com.bigdata.rdf.internal.impl.uri.IPv4AddrIV; import com.bigdata.rdf.internal.impl.uri.URIExtensionIV; import com.bigdata.rdf.lexicon.LexiconKeyOrder; import com.bigdata.rdf.model.BigdataBNode; @@ -152,7 +152,7 @@ * @see AbstractTripleStore.Options#EXTENSION_FACTORY_CLASS */ private final IExtensionFactory xFactory; - + /** * @see AbstractTripleStore.Options#VOCABULARY_CLASS */ @@ -164,6 +164,11 @@ private final BigdataValueFactory valueFactory; /** + * The inline URI factory for the lexicon. + */ + private final IInlineURIFactory uriFactory; + + /** * Mapping from the {@link IV} for the datatype URI of a registered * extension to the {@link IExtension}. */ @@ -255,6 +260,9 @@ sb.append(", " + AbstractTripleStore.Options.VOCABULARY_CLASS + "=" + vocab.getClass().getName()); + sb.append(", " + AbstractTripleStore.Options.INLINE_URI_FACTORY_CLASS + "=" + + uriFactory.getClass().getName()); + sb.append("}"); return sb.toString(); @@ -273,7 +281,8 @@ final boolean rejectInvalidXSDValues, final IExtensionFactory xFactory,// final Vocabulary vocab, - final BigdataValueFactory valueFactory// + final BigdataValueFactory valueFactory,// + final IInlineURIFactory uriFactory ) { if (blobsThreshold < 0) @@ -299,6 +308,7 @@ this.xFactory = xFactory; this.vocab = vocab; this.valueFactory = valueFactory; + this.uriFactory = uriFactory; /* * Note: These collections are read-only so we do NOT need additional @@ -435,24 +445,35 @@ * @return The inline {@link IV} -or- <code>null</code> if the {@link URI} * can not be inlined into the statement indices. */ + @SuppressWarnings("unchecked") private IV<BigdataURI, ?> createInlineURIIV(final URI value) { - try { - - final String s = value.stringValue(); - - if (s.startsWith(IPAddrIV.NAMESPACE)) { - - return new IPAddrIV(s.substring(IPAddrIV.NAMESPACE_LEN)); - - } - - } catch (UnknownHostException ex) { - - log.warn("unknown host exception, will not inline: " + value); - - } - +// deprecated in favor of the extensible InlineURIFactory mechanism +// try { +// +// final String s = value.stringValue(); +// +// if (s.startsWith("ip:")) { +// return new IPAddrIV(s.substring(3)); +// } +// +// } catch (UnknownHostException ex) { +// +// log.warn("unknown host exception, will not inline: " + value); +// +// } + + /* + * See if there is a handler for inline URIs for this namespace. + */ + @SuppressWarnings("rawtypes") + final URIExtensionIV inline = uriFactory.createInlineURIIV(value); + if (inline != null) { + + return inline; + + } + if (maxInlineTextLength == 0) { return null; @@ -476,8 +497,9 @@ if (namespaceIV != null) { - final FullyInlineTypedLiteralIV<BigdataLiteral> localNameIV = new FullyInlineTypedLiteralIV<BigdataLiteral>( - localName); + final FullyInlineTypedLiteralIV<BigdataLiteral> localNameIV = + new FullyInlineTypedLiteralIV<BigdataLiteral>( + localName); return new URIExtensionIV<BigdataURI>(localNameIV, namespaceIV); @@ -659,11 +681,16 @@ // get the native DTE final DTE dte = DTE.valueOf(datatype); - if (dte == DTE.Extension || dte == null) { - /* - * Either a registered IExtension datatype or a datatype for which - * there is no native DTE support. - */ +// DTE.Extension being used for IPv4 now +// if (dte == DTE.Extension || dte == null) { +// /* +// * Either a registered IExtension datatype or a datatype for which +// * there is no native DTE support. +// */ +// return null; +// } + + if (dte == null) { return null; } @@ -712,6 +739,12 @@ return new XSDUnsignedIntIV<BigdataLiteral>(parseUnsignedInt(v)); case XSDUnsignedLong: return new XSDUnsignedLongIV<BigdataLiteral>(parseUnsignedLong(v)); + case Extension: + /* + * Hijacking DTE.Extension for IPv4. Throws UnknownHostException + * if not parseable as an IPv4. + */ + return new IPv4AddrIV<BigdataLiteral>(v); default: // Not handled. return null; @@ -735,7 +768,26 @@ return null; + } catch (UnknownHostException ex) { + + if (rejectInvalidXSDValues) { + + throw new RuntimeException(ex + ": value=" + v, ex); + + } + + /* + * Note: By falling through here, we wind up accepting the Value, + * but it gets handled as a TermId instead of being inlined. + */ + + if (log.isInfoEnabled()) + log.warn("Value does not validate against datatype: " + value); + + return null; + } + } @@ -931,6 +983,7 @@ case XSDInteger: case XSDDecimal: case UUID: + case Extension: // Extension being used for IPv4 return true; case XSDString: /* Added: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/NoInlineURIFactory.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/NoInlineURIFactory.java (rev 0) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/NoInlineURIFactory.java 2014-08-07 08:50:25 UTC (rev 8604) @@ -0,0 +1,49 @@ +/** + +Copyright (C) SYSTAP, LLC 2006-Infinity. All rights reserved. + +Contact: + SYSTAP, LLC + 4501 Tower Road + Greensboro, NC 27410 + lic...@bi... + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 of the License. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +package com.bigdata.rdf.internal; + +import org.openrdf.model.URI; + +import com.bigdata.rdf.internal.impl.uri.URIExtensionIV; +import com.bigdata.rdf.vocab.Vocabulary; + +/** + * Do-nothing inline URI factory used in the case where there is no vocabulary + * defined. + */ +public class NoInlineURIFactory implements IInlineURIFactory { + + public NoInlineURIFactory() { + } + + public void init(final Vocabulary vocab) { + } + + @Override + @SuppressWarnings({ "unchecked", "rawtypes" }) + public URIExtensionIV createInlineURIIV(URI uri) { + return null; + } + +} Property changes on: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/NoInlineURIFactory.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/XSD.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/XSD.java 2014-08-04 10:06:47 UTC (rev 8603) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/XSD.java 2014-08-07 08:50:25 UTC (rev 8604) @@ -72,6 +72,13 @@ */ static public final URI UUID = new URIImpl(NAMESPACE + "uuid"); + /** + * Not sure if there is a better solution for this. Perhaps XSSLT? + * + * http://www.codesynthesis.com/projects/xsstl/ + */ + static public final URI IPV4 = new URIImpl(NAMESPACE + "IPv4Address"); + // URI DATETIME = XMLSchema.DATETIME; } Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/impl/AbstractIV.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/impl/AbstractIV.java 2014-08-04 10:06:47 UTC (rev 8603) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/impl/AbstractIV.java 2014-08-07 08:50:25 UTC (rev 8604) @@ -680,7 +680,7 @@ // The namespaceIV (a Vocabulary item). IVUtility.encode(keyBuilder, extension.getExtensionIV()); - // The inline localName (Unicode data). + // The inline localName (any inline literal data). IVUtility.encode(keyBuilder, extension.getLocalNameIV()); return keyBuilder; @@ -857,6 +857,9 @@ .setByteLength(1/* flags */+ 1/* termCode */+ b.length); return keyBuilder; } +// case Extension: { + // handled by IPv4AddrIV.encode() +// } default: throw new AssertionError(toString()); } Deleted: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/impl/uri/IPAddrIV.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/impl/uri/IPAddrIV.java 2014-08-04 10:06:47 UTC (rev 8603) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/impl/uri/IPAddrIV.java 2014-08-07 08:50:25 UTC (rev 8604) @@ -1,374 +0,0 @@ -/** - -Copyright (C) SYSTAP, LLC 2006-2011. All rights reserved. - -Contact: - SYSTAP, LLC - 4501 Tower Road - Greensboro, NC 27410 - lic...@bi... - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; version 2 of the License. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -package com.bigdata.rdf.internal.impl.uri; - -import java.io.Externalizable; -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.io.ObjectStreamException; -import java.io.Serializable; -import java.net.UnknownHostException; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.openrdf.model.URI; -import org.openrdf.model.Value; - -import com.bigdata.btree.BytesUtil.UnsignedByteArrayComparator; -import com.bigdata.btree.keys.IKeyBuilder; -import com.bigdata.io.LongPacker; -import com.bigdata.rdf.internal.DTE; -import com.bigdata.rdf.internal.IV; -import com.bigdata.rdf.internal.Inet4Address; -import com.bigdata.rdf.internal.VTE; -import com.bigdata.rdf.internal.impl.AbstractInlineIV; -import com.bigdata.rdf.lexicon.LexiconRelation; -import com.bigdata.rdf.model.BigdataURI; - -/** - * Internal value representing an inline IP address. Uses the InetAddress - * class to represent the IP address and perform the translation to and from - * byte[], which is then used directly in the IV key (after the flags). - * <p> - * This internal value has a {@link VTE} of {@link VTE#URI}. - * <p> - * {@inheritDoc} - */ -public class IPAddrIV<V extends BigdataURI> extends AbstractInlineIV<V, Inet4Address> - implements Serializable, URI { - - /** - * - */ - private static final long serialVersionUID = 685148537376856907L; - -// private static final transient Logger log = Logger.getLogger(SidIV.class); - - public static final String NAMESPACE = "ip:/"; - - public static final int NAMESPACE_LEN = NAMESPACE.length(); - - /** - * The inline IP address. - */ - private final Inet4Address value; - - /** - * The cached string representation of this IP. - */ - private transient String hostAddress; - - /** - * The cached byte[] key for the encoding of this IV. - */ - private transient byte[] key; - - /** - * The cached materialized BigdataValue for this InetAddress. - */ - private transient V uri; - - public IV<V, Inet4Address> clone(final boolean clearCache) { - - final IPAddrIV<V> tmp = new IPAddrIV<V>(value);//, prefix); - - // Propagate the cached byte[] key. - tmp.key = key; - - // Propagate the cached BigdataValue. - tmp.uri = uri; - - if (!clearCache) { - - tmp.setValue(getValueCache()); - - } - - return tmp; - - } - - /** - * Ctor with internal value specified. - */ - public IPAddrIV(final Inet4Address value) {//, final byte prefix) { - - /* - * TODO Using XSDBoolean so that we can know how to decode this thing - * as an IPAddrIV. We need to fix the Extension mechanism for URIs. - */ - super(VTE.URI, DTE.XSDBoolean); - - this.value = value; - - } - - /* - * Somebody please fix this for the love of god. - */ - public static final Pattern pattern = - Pattern.compile("((?:[0-9]{1,3}\\.){3}[0-9]{1,3})((\\/)(([0-9]{1,2})))?"); - - /** - * Ctor with host address specified. - */ - public IPAddrIV(final String hostAddress) throws UnknownHostException { - - /* - * Note: XSDBoolean happens to be assigned the code value of 0, which is - * the value we we want when the data type enumeration will be ignored. - */ - super(VTE.URI, DTE.XSDBoolean); - - this.hostAddress = hostAddress; - - final Matcher matcher = pattern.matcher(hostAddress); - - final boolean matches = matcher.matches(); - - if (matches) { - - final String ip = matcher.group(1); - -// log.debug(ip); - - final String suffix = matcher.group(4); - -// log.debug(suffix); - - final String[] s; - if (suffix != null) { - - s = new String[5]; - System.arraycopy(ip.split("\\.", -1), 0, s, 0, 4); - s[4] = suffix; - - } else { - - s = ip.split("\\.", -1); - - } - - this.value = Inet4Address.textToAddr(s); - - } else { - - throw new IllegalArgumentException("not an IP: " + hostAddress); - -// log.debug("no match"); - - } - - } - - /** - * Returns the inline value. - */ - public Inet4Address getInlineValue() throws UnsupportedOperationException { - return value; - } - - /** - * Returns the URI representation of this IV. - */ - public V asValue(final LexiconRelation lex) { - if (uri == null) { - uri = (V) lex.getValueFactory().createURI(getNamespace(), getLocalName()); - uri.setIV(this); - } - return uri; - } - - /** - * Return the byte length for the byte[] encoded representation of this - * internal value. Depends on the byte length of the encoded inline value. - */ - public int byteLength() { - return 1 + key().length; - } - - public String toString() { - return "IP("+getLocalName()+")"; - } - - public int hashCode() { - return value.hashCode(); - } - -// /** -// * Implements {@link BNode#getID()}. -// * <p> -// * This implementation uses the {@link BigInteger} class to create a unique -// * blank node ID based on the <code>unsigned byte[]</code> key of the inline -// * {@link SPO}. -// */ -// @Override -// public String getID() { -//// // just use the hash code. can result in collisions -//// return String.valueOf(hashCode()); -// -// // create a big integer using the spo key. should result in unique ids -// final byte[] key = key(); -// final int signum = key.length > 0 ? 1 : 0; -// final BigInteger bi = new BigInteger(signum, key); -// return 's' + bi.toString(); -// } - - @Override - public String getNamespace() { - return NAMESPACE; - } - - @Override - public String getLocalName() { - if (hostAddress == null) { - hostAddress = value.toString(); - } - return hostAddress; - } - - /** - * Two {@link IPAddrIV} are equal if their InetAddresses are equal. - */ - public boolean equals(final Object o) { - if (this == o) - return true; - if (o instanceof IPAddrIV) { - final Inet4Address value2 = ((IPAddrIV<?>) o).value; - return value.equals(value2); - } - return false; - } - - public int _compareTo(IV o) { - - /* - * Note: This works, but it might be more expensive. - */ - return UnsignedByteArrayComparator.INSTANCE.compare(key(), ((IPAddrIV)o).key()); - - } - - /** - * Encode this internal value into the supplied key builder. Emits the - * flags, following by the encoded byte[] representing the spo, in SPO - * key order. - * <p> - * {@inheritDoc} - */ - @Override - public IKeyBuilder encode(final IKeyBuilder keyBuilder) { - - // First emit the flags byte. - keyBuilder.appendSigned(flags()); - - // Then append the InetAddress byte[] and the prefix. - keyBuilder.append(key()); - - return keyBuilder; - - } - - private byte[] key() { - - if (key == null) { - key = value.getBytes(); - } - - return key; - - } - - /** - * Object provides serialization for {@link IPAddrIV} via the write-replace - * and read-replace pattern. - */ - private static class IPAddrIVState implements Externalizable { - - private static final long serialVersionUID = -1L; - -// private byte flags; - private byte[] key; - - /** - * De-serialization constructor. - */ - public IPAddrIVState() { - - } - - private IPAddrIVState(final IPAddrIV iv) { -// this.flags = flags; - this.key = iv.key(); - } - - public void readExternal(ObjectInput in) throws IOException, - ClassNotFoundException { -// flags = in.readByte(); - final int nbytes = LongPacker.unpackInt(in); - key = new byte[nbytes]; - in.readFully(key); - } - - public void writeExternal(ObjectOutput out) throws IOException { -// out.writeByte(flags); - LongPacker.packLong(out, key.length); - out.write(key); - } - - private Object readResolve() throws ObjectStreamException { - return new Inet4Address(key); - } - - } - - private Object writeReplace() throws ObjectStreamException { - - return new IPAddrIVState(this); - - } - - /** - * Implements {@link Value#stringValue()}. - */ - @Override - public String stringValue() { - - return getLocalName(); - - } - - /** - * Does not need materialization to answer URI interface methods. - */ - @Override - public boolean needsMaterialization() { - - return false; - - } - - -} \ No newline at end of file Copied: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/impl/uri/IPv4AddrIV.java (from rev 8600, branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/impl/uri/IPAddrIV.java) =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/impl/uri/IPv4AddrIV.java (rev 0) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/impl/uri/IPv4AddrIV.java 2014-08-07 08:50:25 UTC (rev 8604) @@ -0,0 +1,378 @@ +/** + +Copyright (C) SYSTAP, LLC 2006-Infinity. All rights reserved. + +Contact: + SYSTAP, LLC + 4501 Tower Road + Greensboro, NC 27410 + lic...@bi... + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 of the License. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ +package com.bigdata.rdf.internal.impl.uri; + +import java.io.Externalizable; +import java.io.IOException; +import java.io.ObjectInput; +import java.io.ObjectOutput; +import java.io.ObjectStreamException; +import java.io.Serializable; +import java.net.UnknownHostException; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.apache.log4j.Logger; +import org.openrdf.model.Literal; + +import com.bigdata.btree.BytesUtil; +import com.bigdata.btree.BytesUtil.UnsignedByteArrayComparator; +import com.bigdata.btree.keys.IKeyBuilder; +import com.bigdata.io.LongPacker; +import com.bigdata.rdf.internal.DTE; +import com.bigdata.rdf.internal.IV; +import com.bigdata.rdf.internal.Inet4Address; +import com.bigdata.rdf.internal.VTE; +import com.bigdata.rdf.internal.XSD; +import com.bigdata.rdf.internal.impl.literal.AbstractLiteralIV; +import com.bigdata.rdf.lexicon.LexiconRelation; +import com.bigdata.rdf.model.BigdataLiteral; + +/** + * Internal value representing an inline IP address. Uses the InetAddress + * class to represent the IP address and perform the translation to and from + * byte[], which is then used directly in the IV key (after the flags). + * <p> + * This internal value has a {@link VTE} of {@link VTE#URI}. + * <p> + * {@inheritDoc} + */ +public class IPv4AddrIV<V extends BigdataLiteral> + extends AbstractLiteralIV<V, Inet4Address> + implements Serializable, Literal { + + /** + * + */ + private static final long serialVersionUID = 685148537376856907L; + + private static final transient Logger log = Logger.getLogger(IPv4AddrIV.class); + + /** + * The inline IP address. + */ + private final Inet4Address value; + + /** + * The cached string representation of this IP. + */ + private transient String hostAddress; + + /** + * The cached byte[] key for the encoding of this IV. + */ + private transient byte[] key; + + /** + * The cached materialized BigdataValue for this InetAddress. + */ + private transient V uri; + + public IV<V, Inet4Address> clone(final boolean clearCache) { + + final IPv4AddrIV<V> tmp = new IPv4AddrIV<V>(value);//, prefix); + + // Propagate the cached byte[] key. + tmp.key = key; + + // Propagate the cached BigdataValue. + tmp.uri = uri; + + if (!clearCache) { + + tmp.setValue(getValueCache()); + + } + + return tmp; + + } + + /** + * Ctor with internal value specified. + */ + public IPv4AddrIV(final Inet4Address value) {//, final byte prefix) { + + super(DTE.Extension); + + this.value = value; + + } + + /* + * Somebody please fix this for the love of god. + */ + public static final Pattern pattern = + Pattern.compile("((?:[0-9]{1,3}\\.){3}[0-9]{1,3})((\\/)(([0-9]{1,2})))?"); + + /** + * Ctor with host address specified. + */ + public IPv4AddrIV(final String hostAddress) throws UnknownHostException { + + super(DTE.Extension); + + this.hostAddress = hostAddress; + + final Matcher matcher = pattern.matcher(hostAddress); + + final boolean matches = matcher.matches(); + + if (matches) { + + final String ip = matcher.group(1); + + if (log.isDebugEnabled()) + log.debug(ip); + + final String suffix = matcher.group(4); + + if (log.isDebugEnabled()) + log.debug(suffix); + + final String[] s; + if (suffix != null) { + + s = new String[5]; + System.arraycopy(ip.split("\\.", -1), 0, s, 0, 4); + s[4] = suffix; + + } else { + + s = ip.split("\\.", -1); + + } + + this.value = Inet4Address.textToAddr(s); + + if (value == null) { + throw new UnknownHostException("not a valid IP: " + hostAddress); + } + + if (log.isDebugEnabled()) { + log.debug(value); + log.debug(byteLength()); + log.debug(BytesUtil.toString(key())); + } + + } else { + + throw new UnknownHostException("not a valid IP: " + hostAddress); + + } + + } + + /** + * Returns the inline value. + */ + public Inet4Address getInlineValue() throws UnsupportedOperationException { + return value; + } + + /** + * Returns the Literal representation of this IV. + */ + @SuppressWarnings("unchecked") + public V asValue(final LexiconRelation lex) { + if (uri == null) { + uri = (V) lex.getValueFactory().createLiteral(getLabel(), XSD.IPV4); + uri.setIV(this); + } + return uri; + } + + /** + * Return the byte length for the byte[] encoded representation of this + * internal value. Depends on the byte length of the encoded inline value. + */ + public int byteLength() { + return 1 + key().length; + } + + public String toString() { + return "IPv4("+getLabel()+")"; + } + + public int hashCode() { + return value.hashCode(); + } + +// /** +// * Implements {@link BNode#getID()}. +// * <p> +// * This implementation uses the {@link BigInteger} class to create a unique +// * blank node ID based on the <code>unsigned byte[]</code> key of the inline +// * {@link SPO}. +// */ +// @Override +// public String getID() { +//// // just use the hash code. can result in collisions +//// return String.valueOf(hashCode()); +// +// // create a big integer using the spo key. should result in unique ids +// final byte[] key = key(); +// final int signum = key.length > 0 ? 1 : 0; +// final BigInteger bi = new BigInteger(signum, key); +// return 's' + bi.toString(); +// } + +// @Override +// public String getNamespace() { +// return NAMESPACE; +// } +// +// @Override +// public String getLocalName() { +// if (hostAddress == null) { +// hostAddress = value.toString(); +// } +// return hostAddress; +// } + + @Override + public String getLabel() { + if (hostAddress == null) { + hostAddress = value.toString(); + } + return hostAddress; + } + + /** + * Two {@link IPv4AddrIV} are equal if their InetAddresses are equal. + */ + public boolean equals(final Object o) { + if (this == o) + return true; + if (o instanceof IPv4AddrIV) { + final Inet4Address value2 = ((IPv4AddrIV<?>) o).value; + return value.equals(value2); + } + return false; + } + + public int _compareTo(IV o) { + + /* + * Note: This works, but it might be more expensive. + */ + return UnsignedByteArrayComparator.INSTANCE.compare(key(), ((IPv4AddrIV)o).key()); + + } + + /** + * Encode this internal value into the supplied key builder. Emits the + * flags, following by the encoded byte[] representing the IPv4 address. + * <p> + * {@inheritDoc} + */ + @Override + public IKeyBuilder encode(final IKeyBuilder keyBuilder) { + + // First emit the flags byte. + keyBuilder.appendSigned(flags()); + + // Then append the InetAddress byte[] and the prefix. + keyBuilder.append(key()); + + return keyBuilder; + + } + + private byte[] key() { + + if (key == null) { + key = value.getBytes(); + } + + return key; + + } + + /** + * Object provides serialization for {@link IPv4AddrIV} via the write-replace + * and read-replace pattern. + */ + private static class IPAddrIVState implements Externalizable { + + private static final long serialVersionUID = -1L; + +// private byte flags; + private byte[] key; + + /** + * De-serialization constructor. + */ + public IPAddrIVState() { + + } + + private IPAddrIVState(final IPv4AddrIV iv) { +// this.flags = flags; + this.key = iv.key(); + } + + public void readExternal(ObjectInput in) throws IOException, + ClassNotFoundException { +// flags = in.readByte(); + final int nbytes = LongPacker.unpackInt(in); + key = new byte[nbytes]; + in.readFully(key); + } + + public void writeExternal(ObjectOutput out) throws IOException { +// out.writeByte(flags); + LongPacker.packLong(out, key.length); + out.write(key); + } + + private Object readResolve() throws ObjectStreamException { + return new Inet4Address(key); + } + + } + + private Object writeReplace() throws ObjectStreamException { + return new IPAddrIVState(this); + } + +// /** +// * Implements {@link Value#stringValue()}. +// */ +// @Override +// public String stringValue() { +// +// return getLocalName(); +// +// } + + /** + * Does not need materialization to answer URI interface methods. + */ + @Override + public boolean needsMaterialization() { + return false; + } + +} \ No newline at end of file Property changes on: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/impl/uri/IPv4AddrIV.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/impl/uri/URIExtensionIV.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/impl/uri/URIExtensionIV.java 2014-08-04 10:06:47 UTC (rev 8603) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/impl/uri/URIExtensionIV.java 2014-08-07 08:50:25 UTC (rev 8604) @@ -9,10 +9,10 @@ import com.bigdata.rdf.internal.impl.AbstractInlineExtensionIV; import com.bigdata.rdf.internal.impl.AbstractInlineIV; import com.bigdata.rdf.internal.impl.literal.AbstractLiteralIV; -import com.bigdata.rdf.internal.impl.literal.FullyInlineTypedLiteralIV; import com.bigdata.rdf.lexicon.LexiconRelation; import com.bigdata.rdf.model.BigdataLiteral; import com.bigdata.rdf.model.BigdataURI; +import com.bigdata.rdf.model.BigdataValueFactory; import com.bigdata.rdf.vocab.Vocabulary; /** @@ -44,7 +44,7 @@ /** * The localName. */ - private final FullyInlineTypedLiteralIV<BigdataLiteral> delegateIV; + private final AbstractLiteralIV<BigdataLiteral, ?> delegateIV; /** * {@inheritDoc} @@ -72,7 +72,7 @@ /** * - * @param localNameIV + * @param delegateIV * The {@link IV} which represents the localName. * @param namespaceIV * The {@link IV} which represents the namespace. This MUST be a @@ -80,10 +80,10 @@ */ @SuppressWarnings("unchecked") public URIExtensionIV( - final FullyInlineTypedLiteralIV<BigdataLiteral> localNameIV, + final AbstractLiteralIV<BigdataLiteral, ?> delegateIV, final IV<?,?> namespaceIV) { - super(VTE.URI, true/* extension */, localNameIV.getDTE()); + super(VTE.URI, true/* extension */, delegateIV.getDTE()); if (namespaceIV == null) throw new IllegalArgumentException(); @@ -91,32 +91,28 @@ if (!namespaceIV.isInline()) throw new IllegalArgumentException(); - this.delegateIV = localNameIV; + this.delegateIV = delegateIV; this.namespaceIV = (AbstractInlineIV<BigdataURI, ?>) namespaceIV; } /** - * Even though Literal extension IVs are fully inline (no data in the - * lexicon indices), we do need materialization to answer the openrdf - * Literal interface correctly. We cannot properly interpret what the - * delegate IV means without the materialized value. + * The namespace IV does need materialization, although it will not need + * to go to the index to get the value (it just needs access to the lexicon's + * vocabulary). */ public boolean needsMaterialization() { - return true; + return delegateIV.needsMaterialization() + || namespaceIV.needsMaterialization(); } public AbstractLiteralIV<BigdataLiteral, ?> getLocalNameIV() { - return delegateIV; - } public Object getInlineValue() { // TODO TEST - return new URIImpl(stringValue()); - } /** @@ -124,18 +120,14 @@ */ @Override public IV<BigdataURI, ?> getExtensionIV() { - return namespaceIV; - } /** * */ public int hashCode() {// TODO Inspect distribution. - return namespaceIV.hashCode() ^ delegateIV.hashCode(); - } public boolean equals(final Object o) { @@ -148,6 +140,10 @@ return false; } + public String toString() { + return this.namespaceIV.toString() + ":" + this.delegateIV.toString(); + } + @SuppressWarnings("rawtypes") public int _compareTo(final IV o) { @@ -183,12 +179,18 @@ if (v == null) { -// final BigdataValueFactory f = lex.getValueFactory(); + final BigdataValueFactory f = lex.getValueFactory(); - final ILexiconConfiguration config = lex.getLexiconConfiguration(); +// final ILexiconConfiguration config = lex.getLexiconConfiguration(); +// +// v = setValue((V) config.asValueFromVocab(this)); - v = setValue((V) config.asValueFromVocab(this)); - + final URI namespace = namespaceIV.asValue(lex); + + final String localName = delegateIV.getInlineValue().toString(); + + v = setValue((V) f.createURI(namespace.stringValue(), localName)); + v.setIV(this); } @@ -197,25 +199,23 @@ } + //////////////////////// + // OpenRDF URI methods + //////////////////////// + @Override public String stringValue() { - return getNamespace() + getLocalName(); - } @Override public String getNamespace() { - - return ((URI) namespaceIV.getInlineValue()).stringValue(); - + return namespaceIV.getValue().stringValue(); } @Override public String getLocalName() { - - return delegateIV.getLabel(); - + return delegateIV.getInlineValue().toString(); } } Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/lexicon/LexiconRelation.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/lexicon/LexiconRelation.java 2014-08-04 10:06:47 UTC (rev 8603) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/lexicon/LexiconRelation.java 2014-08-07 08:50:25 UTC (rev 8604) @@ -82,13 +82,16 @@ import com.bigdata.rawstore.Bytes; import com.bigdata.rdf.internal.IDatatypeURIResolver; import com.bigdata.rdf.internal.IExtensionFactory; +import com.bigdata.rdf.internal.IInlineURIFactory; import com.bigdata.rdf.internal.ILexiconConfiguration; import com.bigdata.rdf.internal.IV; import com.bigdata.rdf.internal.IVUtility; import com.bigdata.rdf.internal.LexiconConfiguration; import com.bigdata.rdf.internal.NoExtensionFactory; +import com.bigdata.rdf.internal.NoInlineURIFactory; import com.bigdata.rdf.internal.NoSuchVocabularyItem; import com.bigdata.rdf.internal.VTE; +import com.bigdata.rdf.internal.XSD; import com.bigdata.rdf.internal.impl.BlobIV; import com.bigdata.rdf.internal.impl.TermId; import com.bigdata.rdf.internal.impl.bnode.SidIV; @@ -271,6 +274,47 @@ } + @SuppressWarnings("unchecked") + protected Class<IInlineURIFactory> determineInlineURIFactoryClass() ... [truncated message content] |
From: <mrp...@us...> - 2014-08-04 10:06:50
|
Revision: 8603 http://sourceforge.net/p/bigdata/code/8603 Author: mrpersonick Date: 2014-08-04 10:06:47 +0000 (Mon, 04 Aug 2014) Log Message: ----------- Ticket #1000: Add configuration option to turn off bottom-up evaluation Modified Paths: -------------- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/eval/AST2BOpContext.java branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/optimizers/DefaultOptimizerList.java branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/store/AbstractTripleStore.java Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/eval/AST2BOpContext.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/eval/AST2BOpContext.java 2014-08-04 10:03:23 UTC (rev 8602) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/eval/AST2BOpContext.java 2014-08-04 10:06:47 UTC (rev 8603) @@ -409,7 +409,7 @@ this.db = db; - this.optimizers = new DefaultOptimizerList(); + this.optimizers = new DefaultOptimizerList(db.isBottomUpEvaluation()); this.idFactory = idFactory; Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/optimizers/DefaultOptimizerList.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/optimizers/DefaultOptimizerList.java 2014-08-04 10:03:23 UTC (rev 8602) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/optimizers/DefaultOptimizerList.java 2014-08-04 10:06:47 UTC (rev 8603) @@ -139,7 +139,11 @@ private static final long serialVersionUID = 1L; public DefaultOptimizerList() { + this(true); + } + public DefaultOptimizerList(final boolean bottomUpEvaluation) { + /** * Converts a BDS.SEARCH_IN_SEARCH function call (inside a filter) * into an IN filter using the full text index to determine the IN @@ -419,7 +423,9 @@ * Rewrites aspects of queries where bottom-up evaluation would produce * different results. */ - add(new ASTBottomUpOptimizer()); + if (bottomUpEvaluation) { + add(new ASTBottomUpOptimizer()); + } /** * Lifts a simple optional out of the child group. Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/store/AbstractTripleStore.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/store/AbstractTripleStore.java 2014-08-04 10:03:23 UTC (rev 8602) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/store/AbstractTripleStore.java 2014-08-04 10:06:47 UTC (rev 8603) @@ -123,6 +123,7 @@ import com.bigdata.rdf.rules.MatchRule; import com.bigdata.rdf.rules.RDFJoinNexusFactory; import com.bigdata.rdf.rules.RuleContextEnum; +import com.bigdata.rdf.sparql.ast.optimizers.ASTBottomUpOptimizer; import com.bigdata.rdf.spo.BulkCompleteConverter; import com.bigdata.rdf.spo.BulkFilterConverter; import com.bigdata.rdf.spo.ExplicitSPOFilter; @@ -316,6 +317,11 @@ final private boolean constrainXXXCShards; /** + * @see Options#BOTTOM_UP_EVALUATION + */ + final private boolean bottomUpEvaluation; + + /** * Return an instance of the class that is used to compute the closure of * the database. */ @@ -395,6 +401,15 @@ } /** + * @see Options#CONSTRAIN_XXXC_SHARDS + */ + final public boolean isBottomUpEvaluation() { + + return bottomUpEvaluation; + + } + + /** * The {@link BigdataValueFactoryImpl} for namespace of the * {@link LexiconRelation} associated with this {@link AbstractTripleStore}. * @@ -1182,7 +1197,17 @@ public static String DEFAULT_HISTORY_SERVICE_MIN_RELEASE_AGE = Long .toString(Long.MAX_VALUE); + + /** + * If this option is set to false, turn off the ASTBottomUpOptimizer. + * + * @see {@link ASTBottomUpOptimizer} + */ + public static String BOTTOM_UP_EVALUATION = AbstractTripleStore.class + .getName() + ".bottomUpEvaluation"; + public static String DEFAULT_BOTTOM_UP_EVALUATION = "true"; + } protected Class determineAxiomClass() { @@ -1405,6 +1430,10 @@ Options.CONSTRAIN_XXXC_SHARDS, Options.DEFAULT_CONSTRAIN_XXXC_SHARDS)); + this.bottomUpEvaluation = Boolean.valueOf(getProperty( + Options.BOTTOM_UP_EVALUATION, + Options.DEFAULT_BOTTOM_UP_EVALUATION)); + /* * Setup namespace mapping for serialization utility methods. * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mrp...@us...> - 2014-08-04 10:03:28
|
Revision: 8602 http://sourceforge.net/p/bigdata/code/8602 Author: mrpersonick Date: 2014-08-04 10:03:23 +0000 (Mon, 04 Aug 2014) Log Message: ----------- Ticket #999: Extend BigdataSailFactory to take arbitrary properties Modified Paths: -------------- branches/BIGDATA_RELEASE_1_3_0/bigdata-sails/src/java/com/bigdata/rdf/sail/BigdataSailFactory.java Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-sails/src/java/com/bigdata/rdf/sail/BigdataSailFactory.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-sails/src/java/com/bigdata/rdf/sail/BigdataSailFactory.java 2014-08-04 09:59:44 UTC (rev 8601) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-sails/src/java/com/bigdata/rdf/sail/BigdataSailFactory.java 2014-08-04 10:03:23 UTC (rev 8602) @@ -119,11 +119,22 @@ /** * Open an existing persistent bigdata instance. If a journal does + * not exist at the specified location then an exception will be thrown. + */ + public static BigdataSailRepository openRepository(final String file) { + + return new BigdataSailRepository(openSail(file, false)); + + } + + /** + * Open an existing persistent bigdata instance. If a journal does * not exist at the specified location and the boolean create flag is true * a journal will be created at that location with the default set of * options. */ - public static BigdataSailRepository openRepository(final String file, final boolean create) { + public static BigdataSailRepository openRepository(final String file, + final boolean create) { return new BigdataSailRepository(openSail(file, create)); @@ -131,6 +142,16 @@ /** * Open an existing persistent bigdata instance. If a journal does + * not exist at the specified location then an exception will be thrown. + */ + public static BigdataSail openSail(final String file) { + + return openSail(file, false); + + } + + /** + * Open an existing persistent bigdata instance. If a journal does * not exist at the specified location and the boolean create flag is true * a journal will be created at that location with the default set of * options. @@ -164,17 +185,28 @@ */ public static BigdataSailRepository createRepository(final Option... args) { - return new BigdataSailRepository(createSail(null, args)); + return createRepository(new Properties(), null, args); } /** + * Create a new bigdata instance using the specified options. Since no + * journal file is specified this must be an in-memory instance. + */ + public static BigdataSailRepository createRepository(final Properties props, + final Option... args) { + + return createRepository(props, null, args); + + } + + /** * Create a new bigdata instance using the specified options. */ public static BigdataSailRepository createRepository(final String file, final Option... args) { - return new BigdataSailRepository(createSail(file, args)); + return createRepository(new Properties(), file, args); } @@ -182,24 +214,46 @@ * Create a new bigdata instance using the specified options. Since no * journal file is specified this must be an in-memory instance. */ + public static BigdataSailRepository createRepository(final Properties props, + final String file, final Option... args) { + + return new BigdataSailRepository(createSail(props, file, args)); + + } + + /** + * Create a new bigdata instance using the specified options. Since no + * journal file is specified this must be an in-memory instance. + */ public static BigdataSail createSail(final Option... args) { - return createSail(null, args); + return createSail(new Properties(), null, args); } /** - * Create a new bigdata instance using the specified options. + * Create a new bigdata instance using the specified options. Since no + * journal file is specified this must be an in-memory instance. */ - public static BigdataSail createSail(final String file, + public static BigdataSail createSail(final String file, final Option... args) { + return createSail(new Properties(), null, args); + + } + + /** + * Create a new bigdata instance using the specified options. + */ + public static BigdataSail createSail(final Properties props, + final String file, final Option... args) { + final List<Option> options = args != null ? Arrays.asList(args) : new LinkedList<Option>(); checkArgs(file, options); - final Properties props = new Properties(); +// final Properties props = new Properties(); if (file != null) { props.setProperty(BigdataSail.Options.FILE, file); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mrp...@us...> - 2014-08-04 10:01:31
|
Revision: 8601 http://sourceforge.net/p/bigdata/code/8601 Author: mrpersonick Date: 2014-08-04 09:59:44 +0000 (Mon, 04 Aug 2014) Log Message: ----------- Ticket #998: SPARQL Update through BigdataGraph Modified Paths: -------------- branches/BIGDATA_RELEASE_1_3_0/bigdata-blueprints/src/java/com/bigdata/blueprints/BigdataGraph.java branches/BIGDATA_RELEASE_1_3_0/bigdata-blueprints/src/java/com/bigdata/blueprints/BigdataGraphBulkLoad.java branches/BIGDATA_RELEASE_1_3_0/bigdata-blueprints/src/java/com/bigdata/blueprints/BigdataGraphClient.java branches/BIGDATA_RELEASE_1_3_0/bigdata-blueprints/src/java/com/bigdata/blueprints/BigdataGraphEmbedded.java Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-blueprints/src/java/com/bigdata/blueprints/BigdataGraph.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-blueprints/src/java/com/bigdata/blueprints/BigdataGraph.java 2014-07-31 22:30:08 UTC (rev 8600) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-blueprints/src/java/com/bigdata/blueprints/BigdataGraph.java 2014-08-04 09:59:44 UTC (rev 8601) @@ -45,6 +45,7 @@ import org.openrdf.query.QueryLanguage; import org.openrdf.query.TupleQuery; import org.openrdf.query.TupleQueryResult; +import org.openrdf.query.Update; import org.openrdf.query.parser.QueryParserUtil; import org.openrdf.repository.RepositoryConnection; import org.openrdf.repository.RepositoryResult; @@ -153,7 +154,7 @@ * A read-only connection can be used for read operations without blocking * or being blocked by writers. */ - protected abstract RepositoryConnection getReadOnlyConnection() throws Exception; + protected abstract RepositoryConnection getReadConnection() throws Exception; /** * Return a single-valued property for an edge or vertex. @@ -176,7 +177,7 @@ try { final RepositoryResult<Statement> result = - getWriteConnection().getStatements(uri, prop, null, false); + getReadConnection().getStatements(uri, prop, null, false); if (result.hasNext()) { @@ -297,7 +298,7 @@ try { final RepositoryResult<Statement> result = - getWriteConnection().getStatements(uri, null, null, false); + getReadConnection().getStatements(uri, null, null, false); final Set<String> properties = new LinkedHashSet<String>(); @@ -1201,16 +1202,16 @@ */ public BigdataGraphlet project(final String queryStr) throws Exception { - final String operation = - QueryParserUtil.removeSPARQLQueryProlog(queryStr).toLowerCase(); - - if (!operation.startsWith("construct")) { - throw new IllegalArgumentException("not a graph query"); - } +// final String operation = +// QueryParserUtil.removeSPARQLQueryProlog(queryStr).toLowerCase(); +// +// if (!operation.startsWith("construct")) { +// throw new IllegalArgumentException("not a graph query"); +// } try { - final RepositoryConnection cxn = getReadOnlyConnection(); + final RepositoryConnection cxn = getReadConnection(); try { @@ -1248,16 +1249,16 @@ */ public BigdataSelection select(final String queryStr) throws Exception { - final String operation = - QueryParserUtil.removeSPARQLQueryProlog(queryStr).toLowerCase(); +// final String operation = +// QueryParserUtil.removeSPARQLQueryProlog(queryStr).toLowerCase(); +// +// if (!operation.startsWith("select")) { +// throw new IllegalArgumentException("not a tuple query"); +// } - if (!operation.startsWith("select")) { - throw new IllegalArgumentException("not a tuple query"); - } - try { - final RepositoryConnection cxn = getReadOnlyConnection(); + final RepositoryConnection cxn = getReadConnection(); try { @@ -1290,6 +1291,28 @@ } + /** + * Update graph using SPARQL Update. + */ + public void update(final String queryStr) throws Exception { + + try { + + final RepositoryConnection cxn = getWriteConnection(); + + final Update update = + cxn.prepareUpdate(QueryLanguage.SPARQL, queryStr); + + update.execute(); + + } catch (RuntimeException e) { + throw e; + } catch (Exception e) { + throw new RuntimeException(e); + } + + } + protected static final Features FEATURES = new Features(); @Override Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-blueprints/src/java/com/bigdata/blueprints/BigdataGraphBulkLoad.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-blueprints/src/java/com/bigdata/blueprints/BigdataGraphBulkLoad.java 2014-07-31 22:30:08 UTC (rev 8600) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-blueprints/src/java/com/bigdata/blueprints/BigdataGraphBulkLoad.java 2014-08-04 09:59:44 UTC (rev 8601) @@ -70,7 +70,7 @@ return cxn; } - protected RepositoryConnection getReadOnlyConnection() throws Exception { + protected RepositoryConnection getReadConnection() throws Exception { return cxn; } Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-blueprints/src/java/com/bigdata/blueprints/BigdataGraphClient.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-blueprints/src/java/com/bigdata/blueprints/BigdataGraphClient.java 2014-07-31 22:30:08 UTC (rev 8600) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-blueprints/src/java/com/bigdata/blueprints/BigdataGraphClient.java 2014-08-04 09:59:44 UTC (rev 8601) @@ -100,7 +100,7 @@ * Get a {@link BigdataSailRemoteRepositoryConnection}. No difference in * connection for remote clients. */ - protected BigdataSailRemoteRepositoryConnection getReadOnlyConnection() throws Exception { + protected BigdataSailRemoteRepositoryConnection getReadConnection() throws Exception { return getWriteConnection(); } Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-blueprints/src/java/com/bigdata/blueprints/BigdataGraphEmbedded.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-blueprints/src/java/com/bigdata/blueprints/BigdataGraphEmbedded.java 2014-07-31 22:30:08 UTC (rev 8600) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-blueprints/src/java/com/bigdata/blueprints/BigdataGraphEmbedded.java 2014-08-04 09:59:44 UTC (rev 8601) @@ -106,7 +106,7 @@ return cxn.get(); } - protected RepositoryConnection getReadOnlyConnection() throws Exception { + protected RepositoryConnection getReadConnection() throws Exception { return repo.getReadOnlyConnection(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tob...@us...> - 2014-07-31 22:30:21
|
Revision: 8600 http://sourceforge.net/p/bigdata/code/8600 Author: tobycraig Date: 2014-07-31 22:30:08 +0000 (Thu, 31 Jul 2014) Log Message: ----------- #996 - Save custom namespace shortcuts between sessions in browser local storage Modified Paths: -------------- branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-07-31 22:18:34 UTC (rev 8599) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-07-31 22:30:08 UTC (rev 8600) @@ -482,6 +482,7 @@ // add namespace & URI, and clear form & error message NAMESPACE_SHORTCUTS.Custom[ns] = uri; + saveCustomNamespaces(); $('#custom-namespace-modal p').html(''); $(this).siblings('input').val(''); populateNamespaceShortcuts(); @@ -510,10 +511,20 @@ if(confirm('Delete this namespace shortcut?')) { delete NAMESPACE_SHORTCUTS.Custom[$(this).data('ns')]; populateNamespaceShortcuts(); + saveCustomNamespaces(); } } +function saveCustomNamespaces() { + localStorage.customNamespaces = JSON.stringify(NAMESPACE_SHORTCUTS.Custom); +} +function loadCustomNamespaces() { + if(typeof localStorage.customNamespaces !== 'undefined') { + NAMESPACE_SHORTCUTS.Custom = JSON.parse(localStorage.customNamespaces); + } +} + /* Update */ function handleDragOver(cm, e) { @@ -1875,6 +1886,7 @@ showHealthTab(); // complete setup + loadCustomNamespaces(); populateNamespaceShortcuts(); createUpdateEditor(); createQueryEditor(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tob...@us...> - 2014-07-31 22:18:41
|
Revision: 8599 http://sourceforge.net/p/bigdata/code/8599 Author: tobycraig Date: 2014-07-31 22:18:34 +0000 (Thu, 31 Jul 2014) Log Message: ----------- #996 - Added support for creating custom namespace shortcuts Modified Paths: -------------- branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/index.html branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/index.html =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/index.html 2014-07-30 23:23:45 UTC (rev 8598) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/index.html 2014-07-31 22:18:34 UTC (rev 8599) @@ -182,6 +182,16 @@ </p> </div> + <div id="custom-namespace-modal" class="modal"> + <h1>Custom namespaces</h1> + <ul></ul> + <label for="custom-namespace-namespace">Namespace: </label><input type="text" id="custom-namespace-namespace"><br> + <label for="custom-namespace-uri">URI: </label><input type="text" id="custom-namespace-uri"><br> + <p></p> + <button id="add-custom-namespace">Add</button> + <button class="modal-cancel">Close</button> + </div> + <div class="tab" id="explore-tab"> <div class="box"> Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-07-30 23:23:45 UTC (rev 8598) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-07-31 22:18:34 UTC (rev 8599) @@ -95,7 +95,8 @@ 'foaf': 'http://xmlns.com/foaf/0.1/', 'schema': 'http://schema.org/', 'sioc': 'http://rdfs.org/sioc/ns#' - } + }, + 'Custom': {} }; // data export @@ -444,28 +445,72 @@ /* Namespace shortcuts */ -function createNamespaceShortcuts() { +function selectNamespace() { + var uri = this.value; + var tab = $(this).parents('.tab').attr('id').split('-')[0]; + var current = EDITORS[tab].getValue(); + + if(current.indexOf(uri) == -1) { + var ns = $(this).find(':selected').text(); + EDITORS[tab].setValue('prefix ' + ns + ': <' + uri + '>\n' + current); + } + + // reselect group label + this.selectedIndex = 0; +} + +function showCustomNamespacesModal() { + showModal('custom-namespace-modal'); +} + +function createNamespaceShortcut() { + var ns = $('#custom-namespace-namespace').val().trim(); + var uri = $('#custom-namespace-uri').val().trim(); + + // check namespace & URI are not empty, and namespace does not already exist + if(ns === '' || uri === '') { + return; + } + for(var category in NAMESPACE_SHORTCUTS) { + for(var oldNS in NAMESPACE_SHORTCUTS[category]) { + if(ns === oldNS) { + $('#custom-namespace-modal p').html(ns + ' is already in use for the URI ' + NAMESPACE_SHORTCUTS[category][ns]); + return; + } + } + } + + // add namespace & URI, and clear form & error message + NAMESPACE_SHORTCUTS.Custom[ns] = uri; + $('#custom-namespace-modal p').html(''); + $(this).siblings('input').val(''); + populateNamespaceShortcuts(); + $(this).siblings('.modal-cancel').click(); +} + +function populateNamespaceShortcuts() { + // add namespaces to dropdowns, and add namespaces to modal to allow deletion $('.namespace-shortcuts').html('Namespace shortcuts: '); + $('#custom-namespace-modal li').remove(); for(var category in NAMESPACE_SHORTCUTS) { var select = $('<select><option>' + category + '</option></select>').appendTo($('.namespace-shortcuts')); for(var ns in NAMESPACE_SHORTCUTS[category]) { select.append('<option value="' + NAMESPACE_SHORTCUTS[category][ns] + '">' + ns + '</option>'); + if(category === 'Custom') { + // add custom namespaces to list for editing + $('#custom-namespace-modal ul').append('<li>' + ns + ' (' + NAMESPACE_SHORTCUTS[category][ns] + ') <a href="#" data-ns="' + ns + '"">Delete</a>'); + } } } + var edit = $('<button>Edit</button>').appendTo($('.namespace-shortcuts')); +} - $('.namespace-shortcuts select').change(function() { - var uri = this.value; - var tab = $(this).parents('.tab').attr('id').split('-')[0]; - var current = EDITORS[tab].getValue(); - - if(current.indexOf(uri) == -1) { - var ns = $(this).find(':selected').text(); - EDITORS[tab].setValue('prefix ' + ns + ': <' + uri + '>\n' + current); - } - - // reselect group label - this.selectedIndex = 0; - }); +function deleteCustomNamespace(e) { + e.preventDefault(); + if(confirm('Delete this namespace shortcut?')) { + delete NAMESPACE_SHORTCUTS.Custom[$(this).data('ns')]; + populateNamespaceShortcuts(); + } } @@ -1776,6 +1821,11 @@ $('#tab-selector a[data-target=health], #health-refresh').click(getHealth); $('#tab-selector a[data-target=performance]').click(loadPerformance); + $('.namespace-shortcuts').on('change', 'select', selectNamespace); + $('#custom-namespace-modal ul').on('click', 'a', deleteCustomNamespace); + $('#add-custom-namespace').click(createNamespaceShortcut); + $('.namespace-shortcuts').on('click', 'button', showCustomNamespacesModal); + $('#new-namespace-mode').change(changeNamespaceMode); $('#namespace-create').submit(createNamespace); @@ -1825,11 +1875,11 @@ showHealthTab(); // complete setup - setupHandlers(); - createNamespaceShortcuts(); + populateNamespaceShortcuts(); createUpdateEditor(); createQueryEditor(); createExportOptions(); + setupHandlers(); // restore last used namespace, last explored URI and query history loadLastExplore(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tob...@us...> - 2014-07-30 23:23:53
|
Revision: 8598 http://sourceforge.net/p/bigdata/code/8598 Author: tobycraig Date: 2014-07-30 23:23:45 +0000 (Wed, 30 Jul 2014) Log Message: ----------- Improved query/update error message when HA deployment is not ready Modified Paths: -------------- branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-07-28 23:27:38 UTC (rev 8597) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-07-30 23:23:45 UTC (rev 8598) @@ -726,8 +726,11 @@ if(jqXHR.status === 0) { message += 'Could not contact server'; } else { - var response = $('<div>').append(jqXHR.responseText); - message += response.find('pre').text(); + if(response.find('pre').length == 0) { + message += response.text(); + } else { + message += response.find('pre').text(); + } highlightError(jqXHR.responseText, 'update'); } @@ -1130,7 +1133,11 @@ message += 'Could not contact server'; } else { var response = $('<div>').append(jqXHR.responseText); - message += response.find('pre').text(); + if(response.find('pre').length == 0) { + message += response.text(); + } else { + message += response.find('pre').text(); + } highlightError(jqXHR.responseText, 'query'); } $('#query-response').text(message); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tob...@us...> - 2014-07-28 23:27:41
|
Revision: 8597 http://sourceforge.net/p/bigdata/code/8597 Author: tobycraig Date: 2014-07-28 23:27:38 +0000 (Mon, 28 Jul 2014) Log Message: ----------- Fixed error highlighting on update panel Modified Paths: -------------- branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-07-28 23:05:24 UTC (rev 8596) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-07-28 23:27:38 UTC (rev 8597) @@ -1142,8 +1142,8 @@ // highlight character at error position var line = match[1] - 1; var character = match[2] - 1; - ERROR_LINE_MARKERS[pane] = EDITORS.query.doc.markText({line: line, ch: 0}, {line: line}, {className: 'error-line'}); - ERROR_CHARACTER_MARKERS[pane] = EDITORS.query.doc.markText({line: line, ch: character}, {line: line, ch: character + 1}, {className: 'error-character'}); + ERROR_LINE_MARKERS[pane] = EDITORS[pane].doc.markText({line: line, ch: 0}, {line: line}, {className: 'error-line'}); + ERROR_CHARACTER_MARKERS[pane] = EDITORS[pane].doc.markText({line: line, ch: character}, {line: line, ch: character + 1}, {className: 'error-character'}); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tob...@us...> - 2014-07-28 23:05:32
|
Revision: 8596 http://sourceforge.net/p/bigdata/code/8596 Author: tobycraig Date: 2014-07-28 23:05:24 +0000 (Mon, 28 Jul 2014) Log Message: ----------- Fixed bug submitting updates and changed error message Modified Paths: -------------- branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/index.html branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/index.html =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/index.html 2014-07-28 21:13:57 UTC (rev 8595) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/index.html 2014-07-28 23:05:24 UTC (rev 8596) @@ -74,7 +74,7 @@ </div> <div class="box" id="update-response"> - <pre></pre> + <span></span> <iframe name="update-response-container"></iframe> </div> Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-07-28 21:13:57 UTC (rev 8595) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-07-28 23:05:24 UTC (rev 8596) @@ -21,7 +21,7 @@ 'json': 'json', 'turtle': 'turtle' }; -var FILE_CONTENTS; +var FILE_CONTENTS = null; // file/update editor type handling // .xml is used for both RDF and TriX, assume it's RDF // We could check the parent element to see which it is @@ -639,7 +639,7 @@ var url = RW_URL_PREFIX + 'namespace/' + NAMESPACE + '/sparql'; var settings = { type: 'POST', - data: FILE_CONTENTS === null ? EDITORS.update.getValue() : FILE_CONTENTS, + data: FILE_CONTENTS == null ? EDITORS.update.getValue() : FILE_CONTENTS, success: updateResponseXML, error: updateResponseError }; @@ -661,7 +661,7 @@ form.submit(); $('#update-monitor-form').remove(); $('#update-response iframe, #update-clear-container').show(); - $('#update-response pre').hide(); + $('#update-response span').hide(); return; } settings.data = 'update=' + encodeURIComponent(settings.data); @@ -687,14 +687,14 @@ break; } - $('#update-response pre').show().html('Running update...'); + $('#update-response span').show().html('Running update...'); $.ajax(url, settings); } function clearUpdateOutput() { $('#update-response, #update-clear-container').hide(); - $('#update-response pre').text(''); + $('#update-response span').text(''); $('#update-response iframe').attr('src', 'about:blank'); } @@ -707,7 +707,7 @@ function updateResponseHTML(data) { $('#update-response, #update-clear-container').show(); $('#update-response iframe').attr('src', 'about:blank').hide(); - $('#update-response pre').html(data); + $('#update-response span').html(data); } function updateResponseXML(data) { @@ -715,14 +715,23 @@ var milliseconds = data.childNodes[0].attributes.milliseconds.value; $('#update-response, #update-clear-container').show(); $('#update-response iframe').attr('src', 'about:blank').hide(); - $('#update-response pre').text('Modified: ' + modified + '\nMilliseconds: ' + milliseconds); + $('#update-response span').text('Modified: ' + modified + '\nMilliseconds: ' + milliseconds); } function updateResponseError(jqXHR, textStatus, errorThrown) { $('#update-response, #update-clear-container').show(); $('#update-response iframe').attr('src', 'about:blank').hide(); - $('#update-response pre').text('Error! ' + textStatus + ' ' + jqXHR.statusText); - highlightError(jqXHR.statusText, 'update'); + + var message = 'ERROR: '; + if(jqXHR.status === 0) { + message += 'Could not contact server'; + } else { + var response = $('<div>').append(jqXHR.responseText); + message += response.find('pre').text(); + highlightError(jqXHR.responseText, 'update'); + } + + $('#update-response span').text(message); } @@ -787,7 +796,7 @@ localStorage['history.results.' + i] = $(el).find('.query-results').html(); localStorage['history.executionTime.' + i] = $(el).find('.query-execution-time').html(); }); - + localStorage.historyCount = $('#query-history tbody tr').length; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tob...@us...> - 2014-07-28 21:14:05
|
Revision: 8595 http://sourceforge.net/p/bigdata/code/8595 Author: tobycraig Date: 2014-07-28 21:13:57 +0000 (Mon, 28 Jul 2014) Log Message: ----------- Do not show history on load if it is empty Modified Paths: -------------- branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-07-28 21:12:35 UTC (rev 8594) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-07-28 21:13:57 UTC (rev 8595) @@ -1732,7 +1732,9 @@ addQueryHistoryRow(localStorage['history.time.' + i], localStorage['history.query.' + i], localStorage['history.results.' + i], localStorage['history.executionTime.' + i], false); } - $('#query-history').show(); + if(localStorage.historyCount > 0) { + $('#query-history').show(); + } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tob...@us...> - 2014-07-28 21:12:43
|
Revision: 8594 http://sourceforge.net/p/bigdata/code/8594 Author: tobycraig Date: 2014-07-28 21:12:35 +0000 (Mon, 28 Jul 2014) Log Message: ----------- Changed error message on query panel Modified Paths: -------------- branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-07-25 21:00:55 UTC (rev 8593) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-07-28 21:12:35 UTC (rev 8594) @@ -1116,8 +1116,15 @@ function queryResultsError(jqXHR, textStatus, errorThrown) { $('#query-response, #query-export-container').show(); - $('#query-response').text('Error! ' + textStatus + ' ' + jqXHR.responseText); - highlightError(jqXHR.responseText, 'query'); + var message = 'ERROR: '; + if(jqXHR.status === 0) { + message += 'Could not contact server'; + } else { + var response = $('<div>').append(jqXHR.responseText); + message += response.find('pre').text(); + highlightError(jqXHR.responseText, 'query'); + } + $('#query-response').text(message); } function highlightError(description, pane) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tob...@us...> - 2014-07-25 21:01:03
|
Revision: 8593 http://sourceforge.net/p/bigdata/code/8593 Author: tobycraig Date: 2014-07-25 21:00:55 +0000 (Fri, 25 Jul 2014) Log Message: ----------- Added query history storage between sessions Modified Paths: -------------- branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/index.html branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/index.html =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/index.html 2014-07-24 23:36:30 UTC (rev 8592) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/index.html 2014-07-25 21:00:55 UTC (rev 8593) @@ -152,6 +152,7 @@ </thead> <tbody></tbody> </table> + <button id="query-history-clear">Clear history</button> </div> <div id="query-export-container" class="box"> Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-07-24 23:36:30 UTC (rev 8592) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-07-25 21:00:55 UTC (rev 8593) @@ -759,14 +759,53 @@ EDITORS.query.focus(); } +function addQueryHistoryRow(time, query, results, executionTime) { + var row = $('<tr>').prependTo($('#query-history tbody')); + row.append('<td class="query-time">' + time + '</td>'); + var cell = $('<td class="query">').appendTo(row); + var a = $('<a href="#">').appendTo(cell); + a.text(query); + a.html(a.html().replace(/\n/g, '<br>')); + row.append('<td class="query-results">' + results + '</td>'); + row.append('<td class="query-execution-time">' + executionTime + '</td>'); + row.append('<td class="query-delete"><a href="#">X</a></td>'); +} + +function storeQueryHistory() { + // clear existing store + for(var i=0; i<localStorage.historyCount; i++) { + localStorage.removeItem('history.time.' + i); + localStorage.removeItem('history.query.' + i); + localStorage.removeItem('history.results.' + i); + localStorage.removeItem('history.executionTime.' + i); + } + + // output each current row + $('#query-history tbody tr').each(function(i, el) { + localStorage['history.time.' + i] = $(el).find('.query-time').html(); + localStorage['history.query.' + i] = $(el).find('.query a')[0].innerText; + localStorage['history.results.' + i] = $(el).find('.query-results').html(); + localStorage['history.executionTime.' + i] = $(el).find('.query-execution-time').html(); + }); + + localStorage.historyCount = $('#query-history tbody tr').length; +} + function deleteHistoryRow(e) { e.preventDefault(); $(this).parents('tr').remove(); if($('#query-history tbody tr').length === 0) { $('#query-history').hide(); } + storeQueryHistory(); } +function clearHistory(e) { + $('#query-history tbody tr').remove(); + $('#query-history').hide(); + storeQueryHistory(); +} + function submitQuery(e) { try { e.preventDefault(); @@ -798,18 +837,11 @@ }); if(!queryExists) { - // add this query to the history - var row = $('<tr>').prependTo($('#query-history tbody')); - row.append('<td class="query-time">' + new Date().toISOString() + '</td>'); - var cell = $('<td class="query">').appendTo(row); - var a = $('<a href="#">').appendTo(cell); - a.text(query); - a.html(a.html().replace(/\n/g, '<br>')); - row.append('<td class="query-results">...</td>'); - row.append('<td class="query-execution-time">...</td>'); - row.append('<td class="query-delete"><a href="#">X</a></td>'); + addQueryHistoryRow(new Date().toISOString(), query, '...', '...', true); } + storeQueryHistory(); + $('#query-history').show(); var url = RO_URL_PREFIX + 'namespace/' + NAMESPACE + '/sparql'; @@ -982,6 +1014,8 @@ } executionTime += ms + 'ms'; $('#query-history tbody tr:first td.query-execution-time').html(executionTime); + + storeQueryHistory(); } function showQueryResults(data) { @@ -1683,7 +1717,19 @@ } } +function loadQueryHistory() { + if(typeof localStorage.historyCount === 'undefined') { + localStorage.historyCount = 0; + } else { + for(var i=localStorage.historyCount - 1; i>=0; i--) { + addQueryHistoryRow(localStorage['history.time.' + i], localStorage['history.query.' + i], + localStorage['history.results.' + i], localStorage['history.executionTime.' + i], false); + } + $('#query-history').show(); + } +} + /* Startup functions */ function setupHandlers() { @@ -1727,6 +1773,7 @@ $('#query-details').change(handleDetails); $('#query-history').on('click', '.query a', loadHistory); $('#query-history').on('click', '.query-delete a', deleteHistoryRow); + $('#query-history-clear').click(clearHistory); $('#query-response-clear').click(clearQueryResponse); $('#query-export').click(showQueryExportModal); $('#query-download').click(queryExport); @@ -1759,9 +1806,10 @@ createQueryEditor(); createExportOptions(); - // restore last used namespace and explored URI + // restore last used namespace, last explored URI and query history loadLastExplore(); loadLastNamespace(); + loadQueryHistory(); } startup(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tob...@us...> - 2014-07-24 23:36:37
|
Revision: 8592 http://sourceforge.net/p/bigdata/code/8592 Author: tobycraig Date: 2014-07-24 23:36:30 +0000 (Thu, 24 Jul 2014) Log Message: ----------- Added load last explored URI upon startup Modified Paths: -------------- branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-07-24 05:53:45 UTC (rev 8591) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-07-24 23:36:30 UTC (rev 8592) @@ -259,14 +259,18 @@ $.ajax(settings); } -function useNamespace(name) { - if(!namespaceExists(name)) { +function useNamespace(name, leaveLast) { + if(!namespaceExists(name) || name === NAMESPACE) { return; } $('#current-namespace').html(name); NAMESPACE = name; getNamespaces(); - localStorage.lastNamespace = name; + // this is for loading the last explored URI, which might otherwise + // overwrite the last used namespace + if(!leaveLast) { + localStorage.lastNamespace = name; + } } function deleteNamespace(namespace) { @@ -1067,7 +1071,7 @@ $('#query-response a').click(function(e) { e.preventDefault(); - explore(this.textContent); + explore(NAMESPACE, this.textContent); }); } } @@ -1170,7 +1174,7 @@ // add matching bindings var table = $('#query-response table'); - var text, tdData; + var text, tdData, linkText; for(var i=start; i<end; i++) { var tr = $('<tr>'); for(var j=0; j<QUERY_RESULTS.head.vars.length; j++) { @@ -1389,22 +1393,22 @@ $('#explore-results a').click(function(e) { e.preventDefault(); var components = parseHash(this.hash); - exploreNamespacedURI(components[2], components[3]); + explore(components[2], components[3]); }); } -function exploreNamespacedURI(namespace, uri, nopush) { - useNamespace(namespace); - explore(uri, nopush); -} - -function explore(uri, nopush) { +function explore(namespace, uri, noPush, loadLast) { + useNamespace(namespace, loadLast); $('#explore-form input[type=text]').val(uri); $('#explore-form').submit(); - showTab('explore', true); - if(!nopush) { + if(!loadLast) { + showTab('explore', true); + } + if(!noPush) { history.pushState(null, null, '#explore:' + NAMESPACE + ':' + uri); } + localStorage.lastExploreNamespace = namespace; + localStorage.lastExploreURI = uri; } function parseHash(hash) { @@ -1420,8 +1424,8 @@ if(!hash) { $('#tab-selector a:first').click(); } else { - if(hash[1] == 'explore') { - exploreNamespacedURI(hash[2], hash[3], true); + if(hash[1] == 'explore' && typeof hash[2] !== 'undefined') { + explore(hash[2], hash[3], true); } else { $('a[data-target=' + hash[1] + ']').click(); } @@ -1673,7 +1677,13 @@ } } +function loadLastExplore() { + if(localStorage.lastExploreURI) { + explore(localStorage.lastExploreNamespace, localStorage.lastExploreURI, true, true); + } +} + /* Startup functions */ function setupHandlers() { @@ -1749,7 +1759,8 @@ createQueryEditor(); createExportOptions(); - // restore last used namespace + // restore last used namespace and explored URI + loadLastExplore(); loadLastNamespace(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tob...@us...> - 2014-07-24 05:53:54
|
Revision: 8591 http://sourceforge.net/p/bigdata/code/8591 Author: tobycraig Date: 2014-07-24 05:53:45 +0000 (Thu, 24 Jul 2014) Log Message: ----------- Fixed missing variable declaration Modified Paths: -------------- branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-07-24 02:45:38 UTC (rev 8590) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-07-24 05:53:45 UTC (rev 8591) @@ -1654,7 +1654,7 @@ // It is used to get around CodeMirror updating the default config object // passed to it with the values used, which are then applied to later uses // of the default config object. - dest = {}; + var dest = {}; for(var key in src) { dest[key] = src[key]; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tob...@us...> - 2014-07-24 02:45:51
|
Revision: 8590 http://sourceforge.net/p/bigdata/code/8590 Author: tobycraig Date: 2014-07-24 02:45:38 +0000 (Thu, 24 Jul 2014) Log Message: ----------- JSHint fixes Modified Paths: -------------- branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-07-23 23:10:27 UTC (rev 8589) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-07-24 02:45:38 UTC (rev 8590) @@ -1,9 +1,11 @@ $(function() { +'use strict'; + /* Global variables */ // LBS/non-LBS URL prefixes -var RW_URL_PREFIX, RO_URL_PREFIX +var RW_URL_PREFIX, RO_URL_PREFIX; // query/update editors var EDITORS = {}, ERROR_LINE_MARKERS = {}, ERROR_CHARACTER_MARKERS = {}; @@ -36,7 +38,7 @@ 'trix': 'trix', //'xml': 'trix', 'ttl': 'turtle' -}; +}; var RDF_CONTENT_TYPES = { 'n-quads': 'text/x-nquads', 'n-triples': 'text/plain', @@ -98,18 +100,18 @@ // data export var EXPORT_EXTENSIONS = { - "application/rdf+xml": ['RDF/XML', 'rdf', true], - "application/n-triples": ['N-Triples', 'nt', true], - "application/x-turtle": ['Turtle', 'ttl', true], - "text/rdf+n3": ['N3', 'n3', true], - "application/trix": ['TriX', 'trix', true], - "application/x-trig": ['TRIG', 'trig', true], - "text/x-nquads": ['NQUADS', 'nq', true], + 'application/rdf+xml': ['RDF/XML', 'rdf', true], + 'application/n-triples': ['N-Triples', 'nt', true], + 'application/x-turtle': ['Turtle', 'ttl', true], + 'text/rdf+n3': ['N3', 'n3', true], + 'application/trix': ['TriX', 'trix', true], + 'application/x-trig': ['TRIG', 'trig', true], + 'text/x-nquads': ['NQUADS', 'nq', true], - "text/csv": ['CSV', 'csv', false, exportCSV], - "application/sparql-results+json": ['JSON', 'json', false, exportJSON], - // "text/tab-separated-values": ['TSV', 'tsv', false, exportTSV], - "application/sparql-results+xml": ['XML', 'xml', false, exportXML] + 'text/csv': ['CSV', 'csv', false, exportCSV], + 'application/sparql-results+json': ['JSON', 'json', false, exportJSON], + // 'text/tab-separated-values': ['TSV', 'tsv', false, exportTSV], + 'application/sparql-results+xml': ['XML', 'xml', false, exportXML] }; @@ -117,7 +119,7 @@ function useLBS(state) { // allows passing in of boolean, or firing on checkbox change - if(typeof(state) != 'boolean') { + if(typeof state != 'boolean') { state = this.checked; } if(state) { @@ -152,7 +154,7 @@ if(!term) { return; } - var query = 'select ?s ?p ?o { ?o bds:search "' + term + '" . ?s ?p ?o . }' + var query = 'select ?s ?p ?o { ?o bds:search "' + term + '" . ?s ?p ?o . }'; EDITORS.query.setValue(query); $('#query-errors').hide(); $('#query-form').submit(); @@ -162,7 +164,7 @@ /* Tab selection */ -function clickTab(e) { +function clickTab() { showTab($(this).data('target')); } @@ -171,7 +173,7 @@ $('#' + tab + '-tab').show(); $('#tab-selector a').removeClass(); $('a[data-target=' + tab + ']').addClass('active'); - if(!nohash && window.location.hash.substring(1).indexOf(tab) != 0) { + if(!nohash && window.location.hash.substring(1).indexOf(tab) !== 0) { window.location.hash = tab; } if(EDITORS[tab]) { @@ -216,12 +218,11 @@ success: function(data) { $('#namespaces-list').empty(); var rdf = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'; - var namespaces = namespaces = data.getElementsByTagNameNS(rdf, 'Description') - for(var i=0; i<namespaces.length; i++) { - var title = namespaces[i].getElementsByTagName('title')[0].textContent; - var titleText = title == DEFAULT_NAMESPACE ? title + ' (default)' : title; - var url = namespaces[i].getElementsByTagName('sparqlEndpoint')[0].getAttributeNS(rdf, 'resource'); - var use; + var namespaces = data.getElementsByTagNameNS(rdf, 'Description'); + var i, title, titleText, use; + for(i=0; i<namespaces.length; i++) { + title = namespaces[i].getElementsByTagName('title')[0].textContent; + titleText = title == DEFAULT_NAMESPACE ? title + ' (default)' : title; if(title == NAMESPACE) { use = 'In use'; } else { @@ -250,7 +251,7 @@ cloneNamespace($(this).parents('tr').data('name')); $('#namespace-create-errors').html(''); }); - $('.namespace-service-description').click(function(e) { + $('.namespace-service-description').click(function() { return confirm('This can be an expensive operation. Proceed anyway?'); }); } @@ -265,7 +266,7 @@ $('#current-namespace').html(name); NAMESPACE = name; getNamespaces(); - localStorage['lastNamespace'] = name; + localStorage.lastNamespace = name; } function deleteNamespace(namespace) { @@ -277,7 +278,7 @@ if(confirm('Are you sure you want to delete the namespace ' + namespace + '?')) { if(namespace == NAMESPACE) { - // FIXME: what is the desired behaviour when deleting the current namespace? + useNamespace(DEFAULT_NAMESPACE); } var url = RW_URL_PREFIX + 'namespace/' + namespace; var settings = { @@ -343,11 +344,11 @@ } function namespaceExists(name) { - return $('#namespaces-list tr[data-name=' + name + ']').length != 0; + return $('#namespaces-list tr[data-name=' + name + ']').length !== 0; } function validateNamespaceOptions() { - var errors = []; + var errors = [], i; var name = $('#new-namespace-name').val().trim(); if(!name) { errors.push('Enter a name'); @@ -359,10 +360,10 @@ errors.push('Inference is incompatible with quads mode'); } $('#namespace-create-errors').html(''); - for(var i=0; i<errors.length; i++) { + for(i=0; i<errors.length; i++) { $('#namespace-create-errors').append('<li>' + errors[i] + '</li>'); } - return errors.length == 0; + return errors.length === 0; } function changeNamespaceMode() { @@ -408,7 +409,7 @@ // TODO: allow for other options to be specified var data = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>\n<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">\n<properties>\n'; - for(key in NAMESPACE_PARAMS) { + for(var key in NAMESPACE_PARAMS) { data += '<entry key="' + NAMESPACE_PARAMS[key] + '">' + params[key] + '</entry>\n'; } data += '</properties>'; @@ -500,16 +501,16 @@ alert('File too large, enter local path to file'); EDITORS.update.setValue('/path/to/' + f.name); setType('path'); - EDITORS.update.setOption('readOnly', false) + EDITORS.update.setOption('readOnly', false); $('#large-file-message, #clear-file').hide(); } else { var fr = new FileReader(); fr.onload = function(e) { if(f.size > 10240) { // do not use textarea - EDITORS.update.setOption('readOnly', true) + EDITORS.update.setOption('readOnly', true); $('#filename').html(f.name); - $('#large-file-message, #clear-file').show() + $('#large-file-message, #clear-file').show(); EDITORS.update.setValue(''); FILE_CONTENTS = e.target.result; } else { @@ -527,8 +528,8 @@ if(e) { e.preventDefault(); } - $('#update-box').prop('disabled', false) - $('#large-file-message, #clear-file').hide() + $('#update-box').prop('disabled', false); + $('#large-file-message, #clear-file').hide(); FILE_CONTENTS = null; } @@ -574,7 +575,7 @@ function handlePaste(e) { // if the input is currently empty, try to identify the pasted content var that = this; - if(this.value == '') { + if(this.value === '') { setTimeout(function() { setType(identify(that.value, true)); }, 10); } } @@ -627,17 +628,17 @@ try { e.preventDefault(); - } catch(e) {} + } catch(ex) {} $('#update-response').show(); var url = RW_URL_PREFIX + 'namespace/' + NAMESPACE + '/sparql'; var settings = { type: 'POST', - data: FILE_CONTENTS == null ? EDITORS.update.getValue() : FILE_CONTENTS, + data: FILE_CONTENTS === null ? EDITORS.update.getValue() : FILE_CONTENTS, success: updateResponseXML, error: updateResponseError - } + }; // determine action based on type switch($('#update-type').val()) { @@ -650,7 +651,7 @@ .append($('<input name="update">').val(settings.data)) .append('<input name="monitor" value="true">'); if($('#update-analytic').is(':checked')) { - form.append('<input name="analytic" value="true">') + form.append('<input name="analytic" value="true">'); } form.appendTo($('body')); form.submit(); @@ -706,8 +707,8 @@ } function updateResponseXML(data) { - var modified = data.childNodes[0].attributes['modified'].value; - var milliseconds = data.childNodes[0].attributes['milliseconds'].value; + var modified = data.childNodes[0].attributes.modified.value; + var milliseconds = data.childNodes[0].attributes.milliseconds.value; $('#update-response, #update-clear-container').show(); $('#update-response iframe').attr('src', 'about:blank').hide(); $('#update-response pre').text('Modified: ' + modified + '\nMilliseconds: ' + milliseconds); @@ -757,7 +758,7 @@ function deleteHistoryRow(e) { e.preventDefault(); $(this).parents('tr').remove(); - if($('#query-history tbody tr').length == 0) { + if($('#query-history tbody tr').length === 0) { $('#query-history').hide(); } } @@ -765,14 +766,14 @@ function submitQuery(e) { try { e.preventDefault(); - } catch(e) {} + } catch(ex) {} // transfer CodeMirror content to textarea EDITORS.query.save(); // do nothing if query is empty var query = $('#query-box').val(); - if(query.trim() == '') { + if(query.trim() === '') { return; } @@ -802,7 +803,7 @@ a.html(a.html().replace(/\n/g, '<br>')); row.append('<td class="query-results">...</td>'); row.append('<td class="query-execution-time">...</td>'); - row.append('<td class="query-delete"><a href="#">X</a></td>') + row.append('<td class="query-delete"><a href="#">X</a></td>'); } $('#query-history').show(); @@ -814,7 +815,7 @@ headers: { 'Accept': 'application/sparql-results+json, application/rdf+xml' }, success: showQueryResults, error: queryResultsError - } + }; $('#query-response').show().html('Query running...'); $('#query-pagination').hide(); @@ -864,7 +865,7 @@ function queryExport() { var dataType = $('#export-format').val(); var filename = $('#export-filename').val(); - if(filename == '') { + if(filename === '') { filename = 'export'; } filename += '.' + EXPORT_EXTENSIONS[dataType][1]; @@ -984,14 +985,15 @@ $('#query-export-rdf').hide(); $('#query-response, #query-pagination, #query-export-container').show(); var table = $('<table>').appendTo($('#query-response')); + var i, tr; if(this.dataTypes[1] == 'xml') { // RDF table.append($('<thead><tr><td>s</td><td>p</td><td>o</td></tr></thead>')); var rows = $(data).find('Description'); - for(var i=0; i<rows.length; i++) { + for(i=0; i<rows.length; i++) { // FIXME: are about and nodeID the only possible attributes here? var s = rows[i].attributes['rdf:about']; - if(typeof(s) == 'undefined') { + if(typeof s == 'undefined') { s = rows[i].attributes['rdf:nodeID']; } s = s.textContent; @@ -999,12 +1001,12 @@ var p = rows[i].children[j].tagName; var o = rows[i].children[j].attributes['rdf:resource']; // FIXME: is this the correct behaviour? - if(typeof(o) == 'undefined') { + if(typeof o == 'undefined') { o = rows[i].children[j].textContent; } else { o = o.textContent; } - var tr = $('<tr><td>' + (j == 0 ? s : '') + '</td><td>' + p + '</td><td>' + o + '</td>'); + tr = $('<tr><td>' + (j === 0 ? s : '') + '</td><td>' + p + '</td><td>' + o + '</td>'); table.append(tr); } } @@ -1014,7 +1016,7 @@ // save data for export and pagination QUERY_RESULTS = data; - if(typeof(data.boolean) != 'undefined') { + if(typeof data.boolean != 'undefined') { // ASK query table.append('<tr><td>' + data.boolean + '</td></tr>').addClass('boolean'); updateResultCountAndExecutionTime('' + data.boolean); @@ -1027,7 +1029,7 @@ isRDF = true; } else if(data.head.vars.length == 4 && data.head.vars[0] == 's' && data.head.vars[1] == 'p' && data.head.vars[2] == 'o' && data.head.vars[3] == 'c') { // see if c is used or not - for(var i=0; i<data.results.bindings.length; i++) { + for(i=0; i<data.results.bindings.length; i++) { if('c' in data.results.bindings[i]) { isRDF = false; break; @@ -1051,8 +1053,8 @@ // put query variables in table header var thead = $('<thead>').appendTo(table); - var tr = $('<tr>'); - for(var i=0; i<data.head.vars.length; i++) { + tr = $('<tr>'); + for(i=0; i<data.head.vars.length; i++) { tr.append('<th>' + data.head.vars[i] + '</th>'); } thead.append(tr); @@ -1130,7 +1132,7 @@ n = QUERY_RESULTS.results.bindings.length; } else { n = parseInt(n, 10); - if(typeof n != 'number' || n % 1 != 0 || n < 1 || n == PAGE_SIZE) { + if(typeof n != 'number' || n % 1 !== 0 || n < 1 || n === PAGE_SIZE) { return; } } @@ -1144,7 +1146,7 @@ function handlePageSelector(e) { if(e.which == 13) { var n = parseInt(this.value, 10); - if(typeof n != 'number' || n % 1 != 0 || n < 1 || n > TOTAL_PAGES) { + if(typeof n != 'number' || n % 1 !== 0 || n < 1 || n > TOTAL_PAGES) { this.value = CURRENT_PAGE; } else { showPage(n); @@ -1153,7 +1155,7 @@ } function showPage(n) { - if(typeof n != 'number' || n % 1 != 0 || n < 1 || n > TOTAL_PAGES) { + if(typeof n != 'number' || n % 1 !== 0 || n < 1 || n > TOTAL_PAGES) { return; } @@ -1168,27 +1170,28 @@ // add matching bindings var table = $('#query-response table'); + var text, tdData; for(var i=start; i<end; i++) { var tr = $('<tr>'); for(var j=0; j<QUERY_RESULTS.head.vars.length; j++) { if(QUERY_RESULTS.head.vars[j] in QUERY_RESULTS.results.bindings[i]) { var binding = QUERY_RESULTS.results.bindings[i][QUERY_RESULTS.head.vars[j]]; if(binding.type == 'sid') { - var text = getSID(binding); + text = getSID(binding); } else { - var text = binding.value; + text = binding.value; if(binding.type == 'uri') { text = abbreviate(text); } } linkText = escapeHTML(text).replace(/\n/g, '<br>'); if(binding.type == 'typed-literal') { - var tdData = ' class="literal" data-datatype="' + binding.datatype + '"'; + tdData = ' class="literal" data-datatype="' + binding.datatype + '"'; } else { if(binding.type == 'uri' || binding.type == 'sid') { text = '<a href="' + buildExploreHash(text) + '">' + linkText + '</a>'; } - var tdData = ' class="' + binding.type + '"'; + tdData = ' class="' + binding.type + '"'; if(binding['xml:lang']) { tdData += ' data-lang="' + binding['xml:lang'] + '"'; } @@ -1259,6 +1262,7 @@ var re = /<< *([^ ]+) +([^ ]+) +([^ ]+) *>>/; var vertex = !target.match(re); + // jshint multistr:true var vertexQuery = '\ select ?col1 ?col2 ?incoming (count(?star) as ?star) {\n\ bind (URI as ?explore ) .\n\ @@ -1303,10 +1307,11 @@ }\n\ group by ?col1 ?col2 ?incoming'; + var query; if(vertex) { - var query = vertexQuery.replace('URI', target); + query = vertexQuery.replace('URI', target); } else { - var query = edgeQuery.replace('SID', target); + query = edgeQuery.replace('SID', target); } var settings = { type: 'POST', @@ -1329,10 +1334,11 @@ // go through each binding, adding it to the appropriate table $.each(data.results.bindings, function(i, binding) { var cols = [binding.col1, binding.col2].map(function(col) { + var uri; if(col.type == 'sid') { - var uri = getSID(col); + uri = getSID(col); } else { - var uri = col.value; + uri = col.value; if(col.type == 'uri') { uri = abbreviate(uri); } @@ -1345,10 +1351,11 @@ }); var star = parseInt(binding.star.value); if(star > 0) { + var sid; if(binding.incoming.value == 'true') { - var sid = '<< <' + binding.col1.value + '> <' + binding.col2.value + '> ' + $('#explore-form input[type=text]').val() + ' >>'; + sid = '<< <' + binding.col1.value + '> <' + binding.col2.value + '> ' + $('#explore-form input[type=text]').val() + ' >>'; } else { - var sid = '<< ' + $('#explore-form input[type=text]').val() + ' <' + binding.col1.value + '> <' + binding.col2.value + '> >>'; + sid = '<< ' + $('#explore-form input[type=text]').val() + ' <' + binding.col1.value + '> <' + binding.col2.value + '> >>'; } star = '<a href="' + buildExploreHash(sid) + '"><< * (' + star + ') >></a>'; } else { @@ -1372,7 +1379,7 @@ var sections = {incoming: 'Incoming Links', outgoing: 'Outgoing Links', attributes: 'Attributes'}; for(var k in sections) { var id = '#explore-' + k; - if($(id + ' table tr').length == 0) { + if($(id + ' table tr').length === 0) { $(id).html('No ' + sections[k]); } else { $(id).prepend('<h1>' + sections[k] + '</h1>'); @@ -1480,10 +1487,11 @@ var sparqlContainer = form.next().next(); var sparql = sparqlContainer.html(); + var queryDetails; if(details) { - var queryDetails = $('<div>').append(sparqlContainer.nextUntil('h1')).html(); + queryDetails = $('<div>').append(sparqlContainer.nextUntil('h1')).html(); } else { - var queryDetails = '<a href="#">Details</a>'; + queryDetails = '<a href="#">Details</a>'; } // got all data, create a li for each query @@ -1567,7 +1575,7 @@ container.addClass('box health-' + health); container.appendTo($('#health-services')); } - }) + }); } function showHealthTab() { @@ -1589,7 +1597,7 @@ /* Performance */ function loadPerformance(path) { - if(typeof(path) == 'undefined') { + if(typeof path == 'undefined') { path = ''; } $.get(RO_URL_PREFIX + 'counters?' + path, function(data) { @@ -1604,13 +1612,13 @@ /* Utility functions */ function getSID(binding) { - return '<<\n ' + abbreviate(binding.value['s'].value) + '\n ' + abbreviate(binding.value['p'].value) + '\n ' + abbreviate(binding.value['o'].value) + '\n>>'; + return '<<\n ' + abbreviate(binding.value.s.value) + '\n ' + abbreviate(binding.value.p.value) + '\n ' + abbreviate(binding.value.o.value) + '\n>>'; } function abbreviate(uri) { for(var nsGroup in NAMESPACE_SHORTCUTS) { for(var ns in NAMESPACE_SHORTCUTS[nsGroup]) { - if(uri.indexOf(NAMESPACE_SHORTCUTS[nsGroup][ns]) == 0) { + if(uri.indexOf(NAMESPACE_SHORTCUTS[nsGroup][ns]) === 0) { return uri.replace(NAMESPACE_SHORTCUTS[nsGroup][ns], ns + ':'); } } @@ -1657,8 +1665,8 @@ /* Local storage functions */ function loadLastNamespace() { - if(localStorage['lastNamespace'] && namespaceExists(localStorage['lastNamespace'])) { - useNamespace(localStorage['lastNamespace']); + if(localStorage.lastNamespace && namespaceExists(localStorage.lastNamespace)) { + useNamespace(localStorage.lastNamespace); } else { // no previously selected namespace, or it doesn't exist - use the default useNamespace(DEFAULT_NAMESPACE); @@ -1670,6 +1678,7 @@ function setupHandlers() { // debug to access closure variables + // jshint debug:true $('html, textarea, select').bind('keydown', 'ctrl+d', function() { debugger; }); $('.use-lbs').change(useLBS); @@ -1707,7 +1716,7 @@ $('#query-explain').change(handleExplain); $('#query-details').change(handleDetails); $('#query-history').on('click', '.query a', loadHistory); - $('#query-history').on('click', '.query-delete a', deleteHistoryRow) + $('#query-history').on('click', '.query-delete a', deleteHistoryRow); $('#query-response-clear').click(clearQueryResponse); $('#query-export').click(showQueryExportModal); $('#query-download').click(queryExport); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tob...@us...> - 2014-07-23 23:10:31
|
Revision: 8589 http://sourceforge.net/p/bigdata/code/8589 Author: tobycraig Date: 2014-07-23 23:10:27 +0000 (Wed, 23 Jul 2014) Log Message: ----------- Made namespace/default namespace loading occur synchronously at startup, so there's no need to check later if it's complete Modified Paths: -------------- branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-07-23 16:08:47 UTC (rev 8588) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-07-23 23:10:27 UTC (rev 8589) @@ -58,7 +58,7 @@ var QUERY_RESULTS, PAGE_SIZE = 50, TOTAL_PAGES, CURRENT_PAGE; // namespaces -var DEFAULT_NAMESPACE, NAMESPACE, NAMESPACES_READY = false, DEFAULT_NAMESPACE_READY = false; +var DEFAULT_NAMESPACE, NAMESPACE; // namespace creation var NAMESPACE_PARAMS = { @@ -116,7 +116,7 @@ /* Load balancing */ function useLBS(state) { - // allows passing in of boolean, or firing on event + // allows passing in of boolean, or firing on checkbox change if(typeof(state) != 'boolean') { state = this.checked; } @@ -208,69 +208,56 @@ /* Namespaces */ -function getNamespaces() { - $.get(RO_URL_PREFIX + 'namespace?describe-each-named-graph=false', function(data) { - $('#namespaces-list').empty(); - var rdf = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'; - var namespaces = namespaces = data.getElementsByTagNameNS(rdf, 'Description') - for(var i=0; i<namespaces.length; i++) { - var title = namespaces[i].getElementsByTagName('title')[0].textContent; - var titleText = title == DEFAULT_NAMESPACE ? title + ' (default)' : title; - var url = namespaces[i].getElementsByTagName('sparqlEndpoint')[0].getAttributeNS(rdf, 'resource'); - var use; - if(title == NAMESPACE) { - use = 'In use'; - } else { - use = '<a href="#" class="use-namespace">Use</a>'; +function getNamespaces(synchronous) { + // synchronous mode is for startup only, and is false by default + var settings = { + async: !synchronous, + url: RO_URL_PREFIX + 'namespace?describe-each-named-graph=false', + success: function(data) { + $('#namespaces-list').empty(); + var rdf = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'; + var namespaces = namespaces = data.getElementsByTagNameNS(rdf, 'Description') + for(var i=0; i<namespaces.length; i++) { + var title = namespaces[i].getElementsByTagName('title')[0].textContent; + var titleText = title == DEFAULT_NAMESPACE ? title + ' (default)' : title; + var url = namespaces[i].getElementsByTagName('sparqlEndpoint')[0].getAttributeNS(rdf, 'resource'); + var use; + if(title == NAMESPACE) { + use = 'In use'; + } else { + use = '<a href="#" class="use-namespace">Use</a>'; + } + $('#namespaces-list').append('<tr data-name="' + title + '">><td>' + titleText + '</td><td>' + use + '</td><td><a href="#" class="delete-namespace">Delete</a></td><td><a href="#" class="namespace-properties">Properties</a></td><td><a href="#" class="clone-namespace">Clone</a></td><td><a href="' + RO_URL_PREFIX + 'namespace/' + title + '/sparql" class="namespace-service-description">Service Description</a></td></tr>'); } - $('#namespaces-list').append('<tr data-name="' + title + '">><td>' + titleText + '</td><td>' + use + '</td><td><a href="#" class="delete-namespace">Delete</a></td><td><a href="#" class="namespace-properties">Properties</a></td><td><a href="#" class="clone-namespace">Clone</a></td><td><a href="' + RO_URL_PREFIX + 'namespace/' + title + '/sparql" class="namespace-service-description">Service Description</a></td></tr>'); + $('.use-namespace').click(function(e) { + e.preventDefault(); + useNamespace($(this).parents('tr').data('name')); + }); + $('.delete-namespace').click(function(e) { + e.preventDefault(); + deleteNamespace($(this).parents('tr').data('name')); + }); + $('.namespace-properties').click(function(e) { + e.preventDefault(); + getNamespaceProperties($(this).parents('tr').data('name')); + }); + $('.namespace-properties-java').click(function(e) { + e.preventDefault(); + getNamespaceProperties($(this).parents('tr').data('name'), 'java'); + }); + $('.clone-namespace').click(function(e) { + e.preventDefault(); + cloneNamespace($(this).parents('tr').data('name')); + $('#namespace-create-errors').html(''); + }); + $('.namespace-service-description').click(function(e) { + return confirm('This can be an expensive operation. Proceed anyway?'); + }); } - $('.use-namespace').click(function(e) { - e.preventDefault(); - useNamespace($(this).parents('tr').data('name')); - }); - $('.delete-namespace').click(function(e) { - e.preventDefault(); - deleteNamespace($(this).parents('tr').data('name')); - }); - $('.namespace-properties').click(function(e) { - e.preventDefault(); - getNamespaceProperties($(this).parents('tr').data('name')); - }); - $('.namespace-properties-java').click(function(e) { - e.preventDefault(); - getNamespaceProperties($(this).parents('tr').data('name'), 'java'); - }); - $('.clone-namespace').click(function(e) { - e.preventDefault(); - cloneNamespace($(this).parents('tr').data('name')); - $('#namespace-create-errors').html(''); - }); - $('.namespace-service-description').click(function(e) { - return confirm('This can be an expensive operation. Proceed anyway?'); - }); - NAMESPACES_READY = true; - }); + }; + $.ajax(settings); } -// waits for namespaces to be loaded, then tries to use the supplied namespace -function selectNamespace(name) { - if(!NAMESPACES_READY) { - setTimeout(function() { selectNamespace(name); }, 10); - } else { - useNamespace(name); - } -} - -// waits for default namespace to be loaded, then uses it -function selectDefaultNamespace() { - if(!DEFAULT_NAMESPACE_READY) { - setTimeout(function() { selectDefaultNamespace(); }, 10); - } else { - selectNamespace(DEFAULT_NAMESPACE); - } -} - function useNamespace(name) { if(!namespaceExists(name)) { return; @@ -437,12 +424,16 @@ } function getDefaultNamespace() { - $.get(RO_URL_PREFIX + 'namespace?describe-each-named-graph=false&describe-default-namespace=true', function(data) { - // Chrome does not work with rdf\:Description, so look for Description too - var defaultDataset = $(data).find('rdf\\:Description, Description'); - DEFAULT_NAMESPACE = defaultDataset.find('title')[0].textContent; - DEFAULT_NAMESPACE_READY = true; - }); + var settings = { + async: false, + url: RO_URL_PREFIX + 'namespace?describe-each-named-graph=false&describe-default-namespace=true', + success: function(data) { + // Chrome does not work with rdf\:Description, so look for Description too + var defaultDataset = $(data).find('rdf\\:Description, Description'); + DEFAULT_NAMESPACE = defaultDataset.find('title')[0].textContent; + } + }; + $.ajax(settings); } @@ -1396,12 +1387,8 @@ } function exploreNamespacedURI(namespace, uri, nopush) { - if(!NAMESPACES_READY) { - setTimeout(function() { exploreNamespacedURI(namespace, uri, nopush); }, 10); - } else { - selectNamespace(namespace); - explore(uri, nopush); - } + useNamespace(namespace); + explore(uri, nopush); } function explore(uri, nopush) { @@ -1584,13 +1571,18 @@ } function showHealthTab() { - $.get('/status?health', function(data) { - if(data.deployment == 'HA') { - $('#tab-selector a[data-target=health]').show(); - } else { - $('#tab-selector a[data-target=health]').remove(); + var settings = { + async: false, + url: '/status?health', + success: function(data) { + if(data.deployment == 'HA') { + $('#tab-selector a[data-target=health]').show(); + } else { + $('#tab-selector a[data-target=health]').remove(); + } } - }); + }; + $.ajax(settings); } @@ -1665,11 +1657,11 @@ /* Local storage functions */ function loadLastNamespace() { - if(localStorage['lastNamespace']) { - selectNamespace(localStorage['lastNamespace']); + if(localStorage['lastNamespace'] && namespaceExists(localStorage['lastNamespace'])) { + useNamespace(localStorage['lastNamespace']); } else { // no previously selected namespace, or it doesn't exist - use the default - selectDefaultNamespace(); + useNamespace(DEFAULT_NAMESPACE); } } @@ -1735,24 +1727,20 @@ } function startup() { - setupHandlers(); - + // load namespaces, default namespace, HA status useLBS(true); - + getNamespaces(true); + getDefaultNamespace(); showHealthTab(); - getNamespaces(); - - getDefaultNamespace(); - + // complete setup + setupHandlers(); createNamespaceShortcuts(); - createUpdateEditor(); - createQueryEditor(); - createExportOptions(); + // restore last used namespace loadLastNamespace(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2014-07-23 16:09:00
|
Revision: 8588 http://sourceforge.net/p/bigdata/code/8588 Author: martyncutcher Date: 2014-07-23 16:08:47 +0000 (Wed, 23 Jul 2014) Log Message: ----------- close branch Modified Paths: -------------- branches/BIGDATA_MGC_SMALL_SLOTS/bigdata/src/java/com/bigdata/io/writecache/BufferedWrite.java branches/BIGDATA_MGC_SMALL_SLOTS/bigdata/src/java/com/bigdata/io/writecache/IBufferedWriter.java branches/BIGDATA_MGC_SMALL_SLOTS/bigdata/src/java/com/bigdata/io/writecache/WriteCacheCounters.java branches/BIGDATA_MGC_SMALL_SLOTS/bigdata/src/java/com/bigdata/rwstore/RWStore.java branches/BIGDATA_MGC_SMALL_SLOTS/bigdata-perf/bsbm3/RWStore.properties branches/BIGDATA_MGC_SMALL_SLOTS/bigdata-perf/bsbm3/build.properties branches/BIGDATA_MGC_SMALL_SLOTS/bigdata-perf/lubm/build.properties Modified: branches/BIGDATA_MGC_SMALL_SLOTS/bigdata/src/java/com/bigdata/io/writecache/BufferedWrite.java =================================================================== --- branches/BIGDATA_MGC_SMALL_SLOTS/bigdata/src/java/com/bigdata/io/writecache/BufferedWrite.java 2014-07-22 23:03:15 UTC (rev 8587) +++ branches/BIGDATA_MGC_SMALL_SLOTS/bigdata/src/java/com/bigdata/io/writecache/BufferedWrite.java 2014-07-23 16:08:47 UTC (rev 8588) @@ -36,6 +36,7 @@ import com.bigdata.io.FileChannelUtility; import com.bigdata.io.IBufferAccess; import com.bigdata.io.IReopenChannel; +import com.bigdata.rwstore.RWStore; /** * The BufferedWrite merges/elides sorted scattered writes to minimize IO @@ -89,12 +90,7 @@ */ private long m_endAddr = 0; - /* - * Counters. - */ - private final CAT m_dataBytes = new CAT(); - private final CAT m_dataWrites = new CAT(); - private final CAT m_fileWrites = new CAT(); + private final RWStore.StoreCounters<?> m_storeCounters; public BufferedWrite(final IBufferedWriter store) throws InterruptedException { @@ -103,6 +99,8 @@ m_store = store; + m_storeCounters = m_store.getStoreCounters(); + m_data.set( DirectBufferPool.INSTANCE.acquire() ); } @@ -163,7 +161,7 @@ public int write(final long offset, final ByteBuffer data, final IReopenChannel<FileChannel> opener) throws IOException { - m_dataWrites.increment(); + m_storeCounters.bufferDataWrites++; final int data_len = data.remaining(); final int slot_len = m_store.getSlotSize(data_len); @@ -240,12 +238,12 @@ } // increment by the amount of data currently in the buffer. - m_dataBytes.add( m_data.position() ); + m_storeCounters.bufferDataBytes += m_data.position(); // write out the data in the buffer onto the backing channel. m_data.flip(); final int nwrites = FileChannelUtility.writeAll(opener, m_data, m_startAddr); - m_fileWrites.add(nwrites); + m_storeCounters.bufferFileWrites += nwrites; reset(); @@ -281,33 +279,19 @@ public String getStats(final StringBuffer buf, final boolean reset) { - final String ret = "BufferedWrites, data: " + m_dataWrites + ", file: " + m_fileWrites + ", bytes: " + m_dataBytes; + final String ret = "BufferedWrites, data: " + m_storeCounters.bufferDataWrites + ", file: " + m_storeCounters.bufferFileWrites + ", bytes: " + m_storeCounters.bufferDataBytes; if (buf != null) { buf.append(ret + "\n"); } if (reset) { - m_dataBytes.set(0L); - m_fileWrites.set(0L); - m_dataWrites.set(0L); + m_storeCounters.bufferFileWrites = 0; + m_storeCounters.bufferDataWrites = 0; + m_storeCounters.bufferDataBytes = 0; } return ret; - } + } - public void addCounters(final CounterSet cs) { - cs.addCounter("ndataWrites", new Instrument<Long>() { - public void sample() { - setValue(m_dataWrites.get()); - } - }); - - cs.addCounter("nfileWrites", new Instrument<Long>() { - public void sample() { - setValue(m_fileWrites.get()); - } - }); - } - } Modified: branches/BIGDATA_MGC_SMALL_SLOTS/bigdata/src/java/com/bigdata/io/writecache/IBufferedWriter.java =================================================================== --- branches/BIGDATA_MGC_SMALL_SLOTS/bigdata/src/java/com/bigdata/io/writecache/IBufferedWriter.java 2014-07-22 23:03:15 UTC (rev 8587) +++ branches/BIGDATA_MGC_SMALL_SLOTS/bigdata/src/java/com/bigdata/io/writecache/IBufferedWriter.java 2014-07-23 16:08:47 UTC (rev 8588) @@ -1,7 +1,11 @@ package com.bigdata.io.writecache; +import com.bigdata.rwstore.RWStore; + public interface IBufferedWriter { int getSlotSize(int data_len); + RWStore.StoreCounters<?> getStoreCounters(); + } Modified: branches/BIGDATA_MGC_SMALL_SLOTS/bigdata/src/java/com/bigdata/io/writecache/WriteCacheCounters.java =================================================================== --- branches/BIGDATA_MGC_SMALL_SLOTS/bigdata/src/java/com/bigdata/io/writecache/WriteCacheCounters.java 2014-07-22 23:03:15 UTC (rev 8587) +++ branches/BIGDATA_MGC_SMALL_SLOTS/bigdata/src/java/com/bigdata/io/writecache/WriteCacheCounters.java 2014-07-23 16:08:47 UTC (rev 8588) @@ -183,9 +183,6 @@ } }); - // BufferedWrite counters - - return root; } // getCounters() Modified: branches/BIGDATA_MGC_SMALL_SLOTS/bigdata/src/java/com/bigdata/rwstore/RWStore.java =================================================================== --- branches/BIGDATA_MGC_SMALL_SLOTS/bigdata/src/java/com/bigdata/rwstore/RWStore.java 2014-07-22 23:03:15 UTC (rev 8587) +++ branches/BIGDATA_MGC_SMALL_SLOTS/bigdata/src/java/com/bigdata/rwstore/RWStore.java 2014-07-23 16:08:47 UTC (rev 8588) @@ -67,6 +67,7 @@ import com.bigdata.btree.ITupleIterator; import com.bigdata.btree.IndexMetadata; import com.bigdata.cache.ConcurrentWeakValueCache; +import com.bigdata.counters.CAT; import com.bigdata.counters.CounterSet; import com.bigdata.counters.Instrument; import com.bigdata.counters.striped.StripedCounters; @@ -857,7 +858,7 @@ m_fd = fileMetadata.file; // initialize striped performance counters for this store. - this.storeCounters.set(new StoreCounters(this, 10/* batchSize */)); + this.storeCounters.set(new StoreCounters(10/* batchSize */)); final IRootBlockView m_rb = fileMetadata.rootBlock; @@ -2685,9 +2686,6 @@ final long pa = physicalAddress(addr); if (pa == 0L) { - // aid to debug - physicalAddress(addr); - throw new IllegalStateException( "No physical address found for " + addr); } @@ -3636,7 +3634,7 @@ final int cSmallSlotThreshold = 4096; // debug test - int cSmallSlot = 1024; // debug test + int cSmallSlot = 1024; // @see from Options#SMALL_SLOT_TYPE /** * Each "metaBit" is a file region @@ -5517,39 +5515,33 @@ */ public volatile long nwriteRootBlock; - private final RWStore m_store; + /** + * buffer counters + */ + public volatile long bufferDataBytes; + public volatile long bufferDataWrites; + public volatile long bufferFileWrites; /** * {@inheritDoc} */ public StoreCounters() { - super(); - - m_store = null; + super(); } - public StoreCounters(final RWStore store) { - super(); - - m_store = store; - } - - /** + /** * {@inheritDoc} */ - public StoreCounters(final RWStore store, final int batchSize) { + public StoreCounters(final int batchSize) { super(batchSize); - m_store = store; } /** * {@inheritDoc} */ - public StoreCounters(final RWStore store, final int nstripes, final int batchSize) { + public StoreCounters(final int nstripes, final int batchSize) { super(nstripes, batchSize); - - m_store = store; } @Override @@ -5659,12 +5651,6 @@ } }); - root.addCounter("ndiskRead", new Instrument<Long>() { - public void sample() { - setValue(ndiskRead); - } - }); - root.addCounter("bytesRead", new Instrument<Long>() { public void sample() { setValue(bytesRead); @@ -5741,11 +5727,20 @@ } // IRawStore // BufferedWriter - final BufferedWrite buffer = m_store.m_bufferedWrite; - if (buffer != null) { - buffer.addCounters(root.makePath("buffer")); - } + final CounterSet bc = root.makePath("buffer"); + + bc.addCounter("ndataWrites", new Instrument<Long>() { + public void sample() { + setValue(bufferDataWrites); + } + }); + bc.addCounter("nfileWrites", new Instrument<Long>() { + public void sample() { + setValue(bufferFileWrites); + } + }); + // disk statistics { final CounterSet disk = root.makePath("disk"); Modified: branches/BIGDATA_MGC_SMALL_SLOTS/bigdata-perf/bsbm3/RWStore.properties =================================================================== --- branches/BIGDATA_MGC_SMALL_SLOTS/bigdata-perf/bsbm3/RWStore.properties 2014-07-22 23:03:15 UTC (rev 8587) +++ branches/BIGDATA_MGC_SMALL_SLOTS/bigdata-perf/bsbm3/RWStore.properties 2014-07-23 16:08:47 UTC (rev 8588) @@ -10,8 +10,9 @@ # Disk is the worm store. DiskRW is the read/write store. com.bigdata.journal.AbstractJournal.bufferMode=DiskRW -com.bigdata.btree.writeRetentionQueue.capacity=40000 -com.bigdata.btree.BTree.branchingFactor=128 +com.bigdata.btree.BTree.branchingFactor=1024 +com.bigdata.rwstore.RWStore.smallSlotType=1024 +com.bigdata.btree.writeRetentionQueue.capacity=4000 # Override branching factors for BSBM 100M to target 8k pages. #com.bigdata.namespace.BSBM_27850.lex.TERM2ID.com.bigdata.btree.BTree.branchingFactor=256 @@ -49,16 +50,17 @@ #com.bigdata.namespace.BSBM_284826.spo.OSP.com.bigdata.btree.BTree.branchingFactor=512 # Override branching factors for BSBM 200M to target 8k pages. -com.bigdata.namespace.BSBM_566496.lex.TERM2ID.com.bigdata.btree.BTree.branchingFactor=800 -com.bigdata.namespace.BSBM_566496.lex.ID2TERM.com.bigdata.btree.BTree.branchingFactor=800 -com.bigdata.namespace.BSBM_566496.lex.BLOBS.com.bigdata.btree.BTree.branchingFactor=400 -com.bigdata.namespace.BSBM_566496.spo.POS.com.bigdata.btree.BTree.branchingFactor=1024 -com.bigdata.namespace.BSBM_566496.spo.SPO.com.bigdata.btree.BTree.branchingFactor=1024 -com.bigdata.namespace.BSBM_566496.spo.OSP.com.bigdata.btree.BTree.branchingFactor=1024 +#com.bigdata.namespace.BSBM_566496.lex.TERM2ID.com.bigdata.btree.BTree.branchingFactor=800 +#com.bigdata.namespace.BSBM_566496.lex.ID2TERM.com.bigdata.btree.BTree.branchingFactor=800 +#com.bigdata.namespace.BSBM_566496.lex.BLOBS.com.bigdata.btree.BTree.branchingFactor=400 +com.bigdata.namespace.BSBM_566496.spo.POS.com.bigdata.btree.BTree.branchingFactor=512 +#com.bigdata.namespace.BSBM_566496.spo.SPO.com.bigdata.btree.BTree.branchingFactor=1024 +com.bigdata.namespace.BSBM_566496.spo.OSP.com.bigdata.btree.BTree.branchingFactor=512 # Override the #of write cache buffers. # com.bigdata.journal.AbstractJournal.writeCacheBufferCount=12 -com.bigdata.journal.AbstractJournal.writeCacheBufferCount=800 +com.bigdata.journal.AbstractJournal.writeCacheBufferCount=400 +com.bigdata.journal.AbstractJournal.readCacheBufferCount=400 # Note: You must override the buffer capacity in build.xml on the # "run-load" target, but this would give you 10M write cache buffers Modified: branches/BIGDATA_MGC_SMALL_SLOTS/bigdata-perf/bsbm3/build.properties =================================================================== --- branches/BIGDATA_MGC_SMALL_SLOTS/bigdata-perf/bsbm3/build.properties 2014-07-22 23:03:15 UTC (rev 8587) +++ branches/BIGDATA_MGC_SMALL_SLOTS/bigdata-perf/bsbm3/build.properties 2014-07-23 16:08:47 UTC (rev 8588) @@ -87,7 +87,10 @@ #bsbm.journalFile=${bsbm.baseDir}/bsbm_${bsbm.pc}/bigdata-bsbm.${journalMode}.jnl # Note: This is on the large volume. #bsbm.journalFile=/Volumes/NonSSD/bsbm/bsbm3_${bsbm.pc}/bigdata-bsbm.${journalMode}.jnl -bsbm.journalFile=/bsbm/bsbm3_${bsbm.pc}/bigdata-bsbm.${journalMode}.jnl +#bsbm.journalFile=/Volumes/SSDData/bigdata-perf/data/bsbm/bigdata-bsbm_${bsbm.pc}.${journalMode}.jnl +#bsbm.journalFile=/Volumes/SSDData/bigdata-perf/data/bsbm/bigdata-bsbm-64-256.RW.jnl +bsbm.journalFile=/bsbm/bigdata-bsbm-512-1024.RW.jnl +#bsbm.journalFile=/bsbm/bsbm3_${bsbm.pc}/bigdata-bsbm.${journalMode}.jnl # Windows 2008 Server: SSD. #bsbm.journalFile=e:/data/bsbm/bsbm_${bsbm.pc}/bigdata-bsbm.${journalMode}.jnl # Windows 2008 Server: SAS. @@ -138,5 +141,5 @@ ## -Dcom.bigdata.LRUNexus.percentHeap=.1 # all jvm args for query. -queryJvmArgs=-server -Xmx${bsbm.maxMem} -showversion ${gcopts} ${gcdebug} ${profiler} ${cache} -Dlog4j.configuration=file:log4j.properties +queryJvmArgs=-server -Xms${bsbm.maxMem} -Xmx${bsbm.maxMem} -showversion ${gcopts} ${gcdebug} ${profiler} ${cache} -Dlog4j.configuration=file:log4j.properties # -Dlog4j.debug Modified: branches/BIGDATA_MGC_SMALL_SLOTS/bigdata-perf/lubm/build.properties =================================================================== --- branches/BIGDATA_MGC_SMALL_SLOTS/bigdata-perf/lubm/build.properties 2014-07-22 23:03:15 UTC (rev 8587) +++ branches/BIGDATA_MGC_SMALL_SLOTS/bigdata-perf/lubm/build.properties 2014-07-23 16:08:47 UTC (rev 8588) @@ -75,7 +75,7 @@ #lubm.journalFile=/Volumes/NonSSD/lubm/lubm3_${lubm.pc}/bigdata-lubm.${journalMode}.jnl # standard load -lubm.journalFile=/Volumes/SSDData/bigdata-perf/data/lubm/${lubm.pc}/bigdata-lubm-small-readcache-512-1024.RW.jnl +lubm.journalFile=/Volumes/SSDData/bigdata-perf/data/lubm/${lubm.pc}/bigdata-lubm-small-enabled-64-256.RW.jnl # Use this to override journal copied to NonSSD volume #lubm.journalFile=/Volumes/NonSSD/lubm/bigdata-lubm-512-1024.RW.jnl This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tob...@us...> - 2014-07-22 23:03:19
|
Revision: 8587 http://sourceforge.net/p/bigdata/code/8587 Author: tobycraig Date: 2014-07-22 23:03:15 +0000 (Tue, 22 Jul 2014) Log Message: ----------- Workbench now remembers last used namespace between sessions Modified Paths: -------------- branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-07-22 18:16:22 UTC (rev 8586) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-07-22 23:03:15 UTC (rev 8587) @@ -58,7 +58,7 @@ var QUERY_RESULTS, PAGE_SIZE = 50, TOTAL_PAGES, CURRENT_PAGE; // namespaces -var DEFAULT_NAMESPACE, NAMESPACE, NAMESPACES_READY; +var DEFAULT_NAMESPACE, NAMESPACE, NAMESPACES_READY = false, DEFAULT_NAMESPACE_READY = false; // namespace creation var NAMESPACE_PARAMS = { @@ -253,19 +253,32 @@ }); } +// waits for namespaces to be loaded, then tries to use the supplied namespace function selectNamespace(name) { - // for programmatically selecting a namespace with just its name if(!NAMESPACES_READY) { setTimeout(function() { selectNamespace(name); }, 10); } else { - $('#namespaces-list tr[data-name=' + name + '] a.use-namespace').click(); + useNamespace(name); } } +// waits for default namespace to be loaded, then uses it +function selectDefaultNamespace() { + if(!DEFAULT_NAMESPACE_READY) { + setTimeout(function() { selectDefaultNamespace(); }, 10); + } else { + selectNamespace(DEFAULT_NAMESPACE); + } +} + function useNamespace(name) { + if(!namespaceExists(name)) { + return; + } $('#current-namespace').html(name); NAMESPACE = name; getNamespaces(); + localStorage['lastNamespace'] = name; } function deleteNamespace(namespace) { @@ -342,13 +355,17 @@ }); } +function namespaceExists(name) { + return $('#namespaces-list tr[data-name=' + name + ']').length != 0; +} + function validateNamespaceOptions() { var errors = []; var name = $('#new-namespace-name').val().trim(); if(!name) { errors.push('Enter a name'); } - if($('#namespaces-list tr[data-name=' + name + ']').length != 0) { + if(namespaceExists(name)) { errors.push('Name already in use'); } if($('#new-namespace-mode').val() == 'quads' && $('#new-namespace-inference').is(':checked')) { @@ -424,8 +441,7 @@ // Chrome does not work with rdf\:Description, so look for Description too var defaultDataset = $(data).find('rdf\\:Description, Description'); DEFAULT_NAMESPACE = defaultDataset.find('title')[0].textContent; - var url = defaultDataset.find('sparqlEndpoint')[0].attributes['rdf:resource'].textContent; - useNamespace(DEFAULT_NAMESPACE); + DEFAULT_NAMESPACE_READY = true; }); } @@ -1646,6 +1662,18 @@ } +/* Local storage functions */ + +function loadLastNamespace() { + if(localStorage['lastNamespace']) { + selectNamespace(localStorage['lastNamespace']); + } else { + // no previously selected namespace, or it doesn't exist - use the default + selectDefaultNamespace(); + } +} + + /* Startup functions */ function setupHandlers() { @@ -1713,6 +1741,8 @@ showHealthTab(); + getNamespaces(); + getDefaultNamespace(); createNamespaceShortcuts(); @@ -1722,6 +1752,8 @@ createQueryEditor(); createExportOptions(); + + loadLastNamespace(); } startup(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tob...@us...> - 2014-07-22 18:16:26
|
Revision: 8586 http://sourceforge.net/p/bigdata/code/8586 Author: tobycraig Date: 2014-07-22 18:16:22 +0000 (Tue, 22 Jul 2014) Log Message: ----------- Adjusted datatype and language rendering Modified Paths: -------------- branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/css/style.css branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/css/style.css =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/css/style.css 2014-07-22 17:10:08 UTC (rev 8585) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/css/style.css 2014-07-22 18:16:22 UTC (rev 8586) @@ -327,11 +327,6 @@ border: 1px solid #e1e1e1; } -.datatype, .language { - font-style: italic; - color: grey; -} - #query-history .query { white-space: pre; } Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-07-22 17:10:08 UTC (rev 8585) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-07-22 18:16:22 UTC (rev 8586) @@ -1087,20 +1087,26 @@ function showDatatypes() { if(this.checked) { $('#query-response td[data-datatype]').each(function(i, el) { - $(this).html($(this).html() + ' <span class="datatype">' + $(this).data('datatype').split('#')[1] + '</span>'); + $(this).html('"' + $(this).html() + '"<span class="datatype">^^' + abbreviate($(this).data('datatype')) + '</span>'); }); } else { - $('#query-response table .datatype').remove(); + $('#query-response table td[data-datatype]').each(function(i, el) { + $(this).find('.datatype').remove(); + $(this).html($(this).html().slice(1, -1)); + }); } } function showLanguages() { if(this.checked) { $('#query-response td[data-lang]').each(function(i, el) { - $(this).html($(this).html() + ' <span class="language">' + $(this).data('lang') + '</span>'); + $(this).html('"' + $(this).html() + '"<span class="language">@' + $(this).data('lang') + '</span>'); }); } else { - $('#query-response table .language').remove(); + $('#query-response table td[data-lang]').each(function(i, el) { + $(this).find('.language').remove(); + $(this).html($(this).html().slice(1, -1)); + }); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tob...@us...> - 2014-07-22 17:10:18
|
Revision: 8585 http://sourceforge.net/p/bigdata/code/8585 Author: tobycraig Date: 2014-07-22 17:10:08 +0000 (Tue, 22 Jul 2014) Log Message: ----------- Added show datatype/language checkboxes to query results Modified Paths: -------------- branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/css/style.css branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/index.html branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/css/style.css =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/css/style.css 2014-07-22 00:33:17 UTC (rev 8584) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/css/style.css 2014-07-22 17:10:08 UTC (rev 8585) @@ -327,6 +327,11 @@ border: 1px solid #e1e1e1; } +.datatype, .language { + font-style: italic; + color: grey; +} + #query-history .query { white-space: pre; } Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/index.html =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/index.html 2014-07-22 00:33:17 UTC (rev 8584) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/index.html 2014-07-22 17:10:08 UTC (rev 8585) @@ -130,6 +130,10 @@ Page <input type="text" id="current-page"> of <span id="result-pages"></span> <button id="next-page">▶</button> </div> + <div id="query-datatypes"> + <input type="checkbox" id="show-datatypes"> <label for="show-datatypes">Show datatypes</label> + <input type="checkbox" id="show-languages"> <label for="show-languages">Show languages</label> + </div> </div> <div id="query-explanation" class="box"> Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-07-22 00:33:17 UTC (rev 8584) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-07-22 17:10:08 UTC (rev 8585) @@ -1084,7 +1084,27 @@ } } +function showDatatypes() { + if(this.checked) { + $('#query-response td[data-datatype]').each(function(i, el) { + $(this).html($(this).html() + ' <span class="datatype">' + $(this).data('datatype').split('#')[1] + '</span>'); + }); + } else { + $('#query-response table .datatype').remove(); + } +} +function showLanguages() { + if(this.checked) { + $('#query-response td[data-lang]').each(function(i, el) { + $(this).html($(this).html() + ' <span class="language">' + $(this).data('lang') + '</span>'); + }); + } else { + $('#query-response table .language').remove(); + } +} + + /* Query result pagination */ function setNumberOfPages() { @@ -1670,6 +1690,8 @@ $('#previous-page').click(function() { showPage(CURRENT_PAGE - 1); }); $('#next-page').click(function() { showPage(CURRENT_PAGE + 1); }); $('#current-page').keyup(handlePageSelector); + $('#show-datatypes').click(showDatatypes); + $('#show-languages').click(showLanguages); $('#explore-form').submit(exploreSubmit); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |