forked from apache/jena
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
140 changed files
with
484 additions
and
415 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
Licensed to the Apache Software Foundation (ASF) under one or more | ||
contributor license agreements. See the NOTICE file distributed with | ||
this work for additional information regarding copyright ownership. | ||
The ASF licenses this file to You under the Apache License, Version 2.0 | ||
(the "License"); you may not use this file except in compliance with | ||
the License. You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
|
||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.apache.jena</groupId> | ||
<artifactId>jena-parent</artifactId> | ||
<version>16-SNAPSHOT</version> | ||
<relativePath>../jena-parent</relativePath> | ||
</parent> | ||
|
||
<name>Apache Jena - Command line tools</name> | ||
<artifactId>jena-cmds</artifactId> | ||
<version>3.1.0-SNAPSHOT</version> | ||
|
||
<description>Command line tools</description> | ||
|
||
<packaging>jar</packaging> | ||
|
||
<url>http://jena.apache.org/</url> | ||
|
||
<repositories> | ||
<repository> | ||
<id>apache.snapshots</id> | ||
<name>Apache Snapshot Repository</name> | ||
<url>http://repository.apache.org/snapshots</url> | ||
<releases> | ||
<enabled>false</enabled> | ||
</releases> | ||
</repository> | ||
</repositories> | ||
|
||
<organization> | ||
<name>Apache Jena</name> | ||
<url>http://jena.apache.org/</url> | ||
</organization> | ||
|
||
<licenses> | ||
<license> | ||
<name>Apache 2.0 License</name> | ||
<url>http://www.apache.org/licenses/LICENSE-2.0</url> | ||
</license> | ||
</licenses> | ||
|
||
<properties> | ||
<maven.build.timestamp.format>yyyy-MM-dd'T'HH:mm:ssZ</maven.build.timestamp.format> | ||
<build.time.xsd>${maven.build.timestamp}</build.time.xsd> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.apache.jena</groupId> | ||
<artifactId>apache-jena-libs</artifactId> | ||
<version>3.1.0-SNAPSHOT</version> | ||
<type>pom</type> | ||
</dependency> | ||
|
||
<!-- Command Logging --> | ||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-api</artifactId> | ||
<version>${ver.slf4j}</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-log4j12</artifactId> | ||
<version>${ver.slf4j}</version> | ||
</dependency> | ||
|
||
<!-- Testing --> | ||
|
||
<dependency> | ||
<groupId>org.apache.jena</groupId> | ||
<artifactId>jena-arq</artifactId> | ||
<version>3.1.0-SNAPSHOT</version> | ||
<classifier>tests</classifier> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.apache.jena</groupId> | ||
<artifactId>jena-core</artifactId> | ||
<version>3.1.0-SNAPSHOT</version> | ||
<classifier>tests</classifier> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.apache.jena</groupId> | ||
<artifactId>jena-base</artifactId> | ||
<version>3.1.0-SNAPSHOT</version> | ||
<classifier>tests</classifier> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
</dependencies> | ||
|
||
</project> |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package tdb; | ||
|
||
import java.util.Arrays ; | ||
import java.util.List ; | ||
import java.util.Objects ; | ||
|
||
import jena.cmd.ArgDecl; | ||
import jena.cmd.CmdException; | ||
import jena.cmd.CmdGeneral; | ||
import org.apache.jena.atlas.lib.FileOps ; | ||
import org.apache.jena.atlas.logging.LogCtl ; | ||
import org.apache.jena.riot.Lang ; | ||
import org.apache.jena.riot.RDFLanguages ; | ||
import org.apache.jena.system.JenaSystem ; | ||
import org.apache.jena.tdb.base.file.Location ; | ||
import org.apache.jena.tdb.setup.DatasetBuilderStd ; | ||
import org.apache.jena.tdb.store.bulkloader2.ProcNodeTableBuilder ; | ||
import tdb.cmdline.CmdTDB ; | ||
|
||
/** Build node table - write triples/quads as text file */ | ||
public class CmdNodeTableBuilder extends CmdGeneral | ||
{ | ||
static { LogCtl.setLog4j() ; } | ||
static { JenaSystem.init(); } | ||
|
||
|
||
private static ArgDecl argLocation = new ArgDecl(ArgDecl.HasValue, "loc", "location") ; | ||
private static ArgDecl argTriplesOut = new ArgDecl(ArgDecl.HasValue, "triples") ; | ||
private static ArgDecl argQuadsOut = new ArgDecl(ArgDecl.HasValue, "quads") ; | ||
private static ArgDecl argNoStats = new ArgDecl(ArgDecl.NoValue, "nostats") ; | ||
|
||
private String locationString ; | ||
private String dataFileTriples ; | ||
private String dataFileQuads ; | ||
private List<String> datafiles ; | ||
private Location location ; | ||
private boolean collectStats = true ; | ||
|
||
public static void main(String...argv) | ||
{ | ||
System.err.println("CmdNodeTableBuilder"); | ||
CmdTDB.init() ; | ||
DatasetBuilderStd.setOptimizerWarningFlag(false) ; | ||
new CmdNodeTableBuilder(argv).mainRun() ; | ||
} | ||
|
||
public CmdNodeTableBuilder(String...argv) | ||
{ | ||
super(argv) ; | ||
super.add(argLocation, "--loc", "Location") ; | ||
super.add(argTriplesOut, "--triples", "Output file for triples") ; | ||
super.add(argQuadsOut, "--quads", "Output file for quads") ; | ||
super.add(argNoStats, "--nostats", "Don't collect stats") ; | ||
} | ||
|
||
@Override | ||
protected void processModulesAndArgs() | ||
{ | ||
if ( !super.contains(argLocation) ) throw new CmdException("Required: --loc DIR") ; | ||
// if ( !super.contains(argTriplesOut) ) throw new CmdException("Required: --triples FILE") ; | ||
// if ( !super.contains(argQuadsOut) ) throw new CmdException("Required: --quads FILE") ; | ||
|
||
locationString = super.getValue(argLocation) ; | ||
location = Location.create(locationString) ; | ||
|
||
dataFileTriples = super.getValue(argTriplesOut) ; | ||
if ( dataFileTriples == null ) | ||
dataFileTriples = location.getPath("triples", "tmp") ; | ||
|
||
dataFileQuads = super.getValue(argQuadsOut) ; | ||
if ( dataFileQuads == null ) | ||
dataFileQuads = location.getPath("quads", "tmp") ; | ||
|
||
if ( Objects.equals(dataFileTriples, dataFileQuads) ) | ||
cmdError("Triples and Quads work files are the same") ; | ||
|
||
if ( super.contains(argNoStats) ) | ||
collectStats = false ; | ||
|
||
//datafiles = getPositionalOrStdin() ; | ||
datafiles = getPositional() ; | ||
if ( datafiles.isEmpty() ) | ||
datafiles = Arrays.asList("-") ; | ||
|
||
// ---- Checking. | ||
for( String filename : datafiles) | ||
{ | ||
Lang lang = RDFLanguages.filenameToLang(filename, RDFLanguages.NQUADS) ; | ||
if ( lang == null ) | ||
// Does not happen due to default above. | ||
cmdError("File suffix not recognized: " +filename) ; | ||
if ( ! filename.equals("-") && ! FileOps.exists(filename) ) | ||
cmdError("File does not exist: "+filename) ; | ||
} | ||
} | ||
|
||
@Override | ||
protected void exec() | ||
{ | ||
ProcNodeTableBuilder.execInner(location, dataFileTriples, dataFileQuads, datafiles, collectStats); | ||
} | ||
|
||
@Override | ||
protected String getSummary() | ||
{ | ||
return getCommandName()+" --loc=DIR [--triples=tmpFile1] [--quads=tmpFile2] FILE ..." ; | ||
} | ||
|
||
@Override | ||
protected String getCommandName() | ||
{ | ||
return this.getClass().getName() ; | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.