Skip to content
This repository has been archived by the owner on Jan 3, 2019. It is now read-only.

Commit

Permalink
Added licenses, fixed Checkstyle bs
Browse files Browse the repository at this point in the history
  • Loading branch information
ajs6f committed Jul 10, 2013
1 parent 235683b commit ac09cd7
Show file tree
Hide file tree
Showing 6 changed files with 115 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -7,7 +7,7 @@
<version>4.0.0-alpha-2-SNAPSHOT</version>
</parent>
<artifactId>fcrepo-triplegenerators-tei</artifactId>
<packaging>war</packaging>

<name>Fedora TEI triple generator.</name>
<description>Generates RDF triples from TEI documents.</description>

Expand Down
@@ -1,9 +1,25 @@
/**
* Copyright 2013 DuraSpace, Inc.
*
* Licensed 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 org.fcrepo.triplegenerators.tei;

import static com.hp.hpl.jena.rdf.model.ModelFactory.createDefaultModel;
import static org.slf4j.LoggerFactory.getLogger;

import java.net.URISyntaxException;

import org.apache.any23.extractor.ExtractionContext;
import org.apache.any23.writer.TripleHandler;
import org.apache.any23.writer.TripleHandlerException;
Expand All @@ -12,7 +28,6 @@
import org.openrdf.model.Value;
import org.slf4j.Logger;

import com.hp.hpl.jena.graph.Triple;
import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.RDFNode;
import com.hp.hpl.jena.rdf.model.Statement;
Expand All @@ -29,7 +44,7 @@
public class ModelTripleHandler implements TripleHandler, AutoCloseable {

/**
* A {@link Model} of {@link Triple}s we are collecting.
* A {@link Model} of triples we are collecting.
*/
protected final Model model = createDefaultModel();

Expand Down Expand Up @@ -149,6 +164,9 @@ public void closeContext(final ExtractionContext ec)
throws TripleHandlerException {
}

/**
* Clears the internal {@link Model}.
*/
public void reset() {
model.removeAll();
}
Expand Down
@@ -1,3 +1,18 @@
/**
* Copyright 2013 DuraSpace, Inc.
*
* Licensed 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 org.fcrepo.triplegenerators.tei;

Expand Down Expand Up @@ -37,6 +52,10 @@
import com.hp.hpl.jena.sparql.core.DatasetImpl;


/**
* @author ajs6f
* @date Jul 10, 2013
*/
public class TeiTripleGenerator {

private static Transformer addIdsXform;
Expand All @@ -47,6 +66,11 @@ public class TeiTripleGenerator {

private static final Logger LOGGER = getLogger(TeiTripleGenerator.class);

/**
* @throws TransformerConfigurationException
* @throws TransformerFactoryConfigurationError
* @throws IOException
*/
public TeiTripleGenerator() throws TransformerConfigurationException,
TransformerFactoryConfigurationError, IOException {
// initialize XSLT
Expand All @@ -69,6 +93,15 @@ public TeiTripleGenerator() throws TransformerConfigurationException,
}
}

/**
* @param teiLocation
* @return A {@link Dataset} with extracted triples.
* @throws IOException
* @throws TransformerConfigurationException
* @throws TransformerException
* @throws ExtractionException
* @throws TripleHandlerException
*/
public Dataset getTriples(@HeaderParam("Content-Location")
final URL teiLocation) throws IOException,
TransformerConfigurationException, TransformerException,
Expand All @@ -79,6 +112,15 @@ public Dataset getTriples(@HeaderParam("Content-Location")
}
}

/**
* @param resource
* @return A {@link Dataset} with extracted triples.
* @throws TransformerConfigurationException
* @throws IOException
* @throws TransformerException
* @throws ExtractionException
* @throws TripleHandlerException
*/
public Dataset getTriples(final InputStream resource)
throws TransformerConfigurationException, IOException,
TransformerException, ExtractionException, TripleHandlerException {
Expand All @@ -103,6 +145,13 @@ public Dataset getTriples(final InputStream resource)
}
}

/**
* @param resource
* @return A {@link Result} of RDF/XML
* @throws IOException
* @throws TransformerConfigurationException
* @throws TransformerException
*/
protected StreamResult createRDFXML(final InputStream resource)
throws IOException, TransformerConfigurationException,
TransformerException {
Expand Down
@@ -1,3 +1,18 @@
/**
* Copyright 2013 DuraSpace, Inc.
*
* Licensed 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 org.fcrepo.triplegenerators.tei.xslt;

Expand Down
@@ -1,3 +1,18 @@
/**
* Copyright 2013 DuraSpace, Inc.
*
* Licensed 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 org.fcrepo.triplegenerators.tei;


Expand Down
@@ -1,3 +1,18 @@
/**
* Copyright 2013 DuraSpace, Inc.
*
* Licensed 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 org.fcrepo.triplegenerators.tei;

import static org.junit.Assert.assertFalse;
Expand Down

0 comments on commit ac09cd7

Please sign in to comment.