Skip to content

fix: QName constructor calls #191

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/main/java/org/swordapp/server/AtomStatement.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,18 +87,18 @@ public void writeTo(final Writer out) throws IOException {
if (deposit.getMediaType() != null) {
entry.setContent(new IRI(deposit.getUri()), deposit.getMediaType());
}
entry.addCategory(UriRegistry.SWORD_TERMS_NAMESPACE, UriRegistry.SWORD_ORIGINAL_DEPOSIT, "Original Deposit");
entry.addCategory(UriRegistry.SWORD_TERMS_NAMESPACE, UriRegistry.SWORD_ORIGINAL_DEPOSIT_URI, "Original Deposit");
if (deposit.getDepositedOn() != null) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
entry.addSimpleExtension(new QName(UriRegistry.SWORD_DEPOSITED_ON), sdf.format(deposit.getDepositedOn()));
entry.addSimpleExtension(UriRegistry.SWORD_DEPOSITED_ON, sdf.format(deposit.getDepositedOn()));
}

if (deposit.getDepositedOnBehalfOf() != null) {
entry.addSimpleExtension(new QName(UriRegistry.SWORD_DEPOSITED_ON_BEHALF_OF), deposit.getDepositedOnBehalfOf());
entry.addSimpleExtension(UriRegistry.SWORD_DEPOSITED_ON_BEHALF_OF, deposit.getDepositedOnBehalfOf());
}

if (deposit.getDepositedBy() != null) {
entry.addSimpleExtension(new QName(UriRegistry.SWORD_DEPOSITED_BY), deposit.getDepositedBy());
entry.addSimpleExtension(UriRegistry.SWORD_DEPOSITED_BY, deposit.getDepositedBy());
}

if (deposit.getPackaging() != null) {
Expand All @@ -110,7 +110,7 @@ public void writeTo(final Writer out) throws IOException {

// now at the state as a categories
for (Map.Entry<String, String> state : this.states.entrySet()) {
Category cat = feed.addCategory(UriRegistry.SWORD_STATE, state.getKey(), "State");
Category cat = feed.addCategory(UriRegistry.SWORD_STATE_URI, state.getKey(), "State");
if (state.getValue() != null) {
cat.setText(state.getValue());
}
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/org/swordapp/server/OREStatement.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,33 +54,33 @@ public void writeTo(final Writer out) throws IOException {
Resource deposit = model.createResource(od.getUri());
deposit.addProperty(RDF.type, model.createResource(UriRegistry.ORE_NAMESPACE + "AggregatedResource"));
if (od.getDepositedBy() != null) {
deposit.addLiteral(model.createProperty(UriRegistry.SWORD_DEPOSITED_BY), od.getDepositedBy());
deposit.addLiteral(model.createProperty(UriRegistry.SWORD_DEPOSITED_BY_URI), od.getDepositedBy());
}

if (od.getDepositedOnBehalfOf() != null) {
deposit.addLiteral(model.createProperty(UriRegistry.SWORD_DEPOSITED_ON_BEHALF_OF), od.getDepositedOnBehalfOf());
deposit.addLiteral(model.createProperty(UriRegistry.SWORD_DEPOSITED_ON_BEHALF_OF_URI), od.getDepositedOnBehalfOf());
}

if (od.getDepositedOn() != null) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
deposit.addLiteral(model.createProperty(UriRegistry.SWORD_DEPOSITED_ON), sdf.format(od.getDepositedOn()));
deposit.addLiteral(model.createProperty(UriRegistry.SWORD_DEPOSITED_ON_URI), sdf.format(od.getDepositedOn()));
}

for (String packaging : od.getPackaging()) {
deposit.addLiteral(model.createProperty(UriRegistry.SWORD_PACKAGING.toString()), packaging);
}

agg.addProperty(model.createProperty(UriRegistry.ORE_NAMESPACE + "aggregates"), deposit);
agg.addProperty(model.createProperty(UriRegistry.SWORD_ORIGINAL_DEPOSIT), deposit);
agg.addProperty(model.createProperty(UriRegistry.SWORD_ORIGINAL_DEPOSIT_URI), deposit);
}

// now add the state information
for (Map.Entry<String, String> state : this.states.entrySet()) {
Resource s = model.createResource(state.getKey());
if (state.getValue() != null) {
s.addProperty(model.createProperty(UriRegistry.SWORD_STATE_DESCRIPTION), state.getValue());
s.addProperty(model.createProperty(UriRegistry.SWORD_STATE_DESCRIPTION_URI), state.getValue());
}
agg.addProperty(model.createProperty(UriRegistry.SWORD_STATE), s);
agg.addProperty(model.createProperty(UriRegistry.SWORD_STATE_URI), s);
}

// write the model directly to the output
Expand Down
20 changes: 14 additions & 6 deletions src/main/java/org/swordapp/server/UriRegistry.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,20 @@ private UriRegistry() { }
public static final QName DC_ABSTRACT = new QName(DC_NAMESPACE, "abstract");

// URIs for the statement
public static final String SWORD_DEPOSITED_BY = SWORD_TERMS_NAMESPACE + "depositedBy";
public static final String SWORD_DEPOSITED_ON_BEHALF_OF = SWORD_TERMS_NAMESPACE + "depositedOnBehalfOf";
public static final String SWORD_DEPOSITED_ON = SWORD_TERMS_NAMESPACE + "depositedOn";
public static final String SWORD_ORIGINAL_DEPOSIT = SWORD_TERMS_NAMESPACE + "originalDeposit";
public static final String SWORD_STATE_DESCRIPTION = SWORD_TERMS_NAMESPACE + "stateDescription";
public static final String SWORD_STATE = SWORD_TERMS_NAMESPACE + "state";
public static final String SWORD_DEPOSITED_BY_URI = SWORD_TERMS_NAMESPACE + "depositedBy";
public static final String SWORD_DEPOSITED_ON_BEHALF_OF_URI = SWORD_TERMS_NAMESPACE + "depositedOnBehalfOf";
public static final String SWORD_DEPOSITED_ON_URI = SWORD_TERMS_NAMESPACE + "depositedOn";
public static final String SWORD_ORIGINAL_DEPOSIT_URI = SWORD_TERMS_NAMESPACE + "originalDeposit";
public static final String SWORD_STATE_DESCRIPTION_URI = SWORD_TERMS_NAMESPACE + "stateDescription";
public static final String SWORD_STATE_URI = SWORD_TERMS_NAMESPACE + "state";

// QNames for statement elements
public static final QName SWORD_DEPOSITED_BY = new QName(SWORD_TERMS_NAMESPACE, "depositedBy");
public static final QName SWORD_DEPOSITED_ON_BEHALF_OF = new QName(SWORD_TERMS_NAMESPACE, "depositedOnBehalfOf");
public static final QName SWORD_DEPOSITED_ON = new QName(SWORD_TERMS_NAMESPACE, "depositedOn");
public static final QName SWORD_ORIGINAL_DEPOSIT = new QName(SWORD_TERMS_NAMESPACE, "originalDeposit");
public static final QName SWORD_STATE_DESCRIPTION = new QName(SWORD_TERMS_NAMESPACE, "stateDescription");
public static final QName SWORD_STATE = new QName(SWORD_TERMS_NAMESPACE, "state");

// rel values
public static final String REL_STATEMENT = "http://purl.org/net/sword/terms/statement";
Expand Down
Loading