Skip to content

Commit

Permalink
Merge branch 'master' into gh-1387
Browse files Browse the repository at this point in the history
  • Loading branch information
Aklakan committed Jun 30, 2022
2 parents 6d906c4 + 7c0b207 commit 03a7f98
Show file tree
Hide file tree
Showing 29 changed files with 753 additions and 322 deletions.
22 changes: 11 additions & 11 deletions .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

name: "Bug Report"
description: "File a bug report"
title: "[Bug]: "
labels: ["bug"]
body:
- type: markdown
Expand All @@ -20,19 +19,20 @@ body:
id: what-happened
attributes:
label: What happened?
description: Also tell us, what did you expect to happen?
description: What did you expect to happen?
placeholder: Tell us what happened.
validations:
required: true
- type: checkboxes
id: operating-systems
attributes:
label: Which environment is running?
options:
- label: macOS
- label: Windows
- label: Linux
- label: other
## (2022-06) Github treats checkboxes as "tasks"
## - type: checkboxes
## id: operating-systems
## attributes:
## label: Which environment is running?
## options:
## - label: macOS
## - label: Windows
## - label: Linux
## - label: other
- type: textarea
id: output
attributes:
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ body:
- type: textarea
id: suggestion
attributes:
label: Suggestion
label: Feature
placeholder: Tell us about the suggestion.
validations:
required: true
Expand Down
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
GitHub issue resolved: #
GitHub issue resolved #

Pull request Description:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@
public class JsonArray extends JsonValue implements List<JsonValue>
{
private List<JsonValue> array = new ArrayList<>() ;


public JsonArray() {}

@Override
public boolean isArray() { return true ; }

@Override
public JsonArray getAsArray() { return this ; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@
public class JsonObject extends JsonValue
{
private final Map<String, JsonValue> map = new LinkedHashMap<>() ;


public JsonObject() {}

@Override
public boolean isObject() { return true ; }
@Override
public JsonObject getAsObject() { return this ; }

@Override
public void visit(JsonVisitor visitor)
{ visitor.visit(this) ; }
Expand All @@ -47,14 +49,14 @@ public boolean equals(Object other) {
return false ;
return map.equals(((JsonObject)other).map) ;
}

public void clear()
{ map.clear() ; }

public boolean hasKey(Object key) {
return map.containsKey(key) ;
}

public Set<String> keys() {
return map.keySet() ;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,14 +349,16 @@ protected Op compileElementUnion(ElementUnion el) {
}

protected Op compileElementNotExists(Op current, ElementNotExists elt2) {
Op op = compile(elt2.getElement()); // "compile", not "compileElement" -- do simplifcation
Expr expr = new E_NotExists(elt2, op);
Element subElt = elt2.getElement();
Op op = compile(subElt); // "compile", not "compileElement" -- do simplifcation
Expr expr = new E_NotExists(subElt, op);
return OpFilter.filter(expr, current);
}

protected Op compileElementExists(Op current, ElementExists elt2) {
Op op = compile(elt2.getElement()); // "compile", not "compileElement" -- do simplification
Expr expr = new E_Exists(elt2, op);
Element subElt = elt2.getElement();
Op op = compile(subElt); // "compile", not "compileElement" -- do simplification
Expr expr = new E_Exists(subElt, op);
return OpFilter.filter(expr, current);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,93 +27,72 @@
import org.apache.jena.sparql.util.Context ;

/** Rewrite to replace a property function property with the call to the property function implementation */
public class TransformPropertyFunction extends TransformCopy
{
private final Context context ;
private final boolean doingMagicProperties ;
private final PropertyFunctionRegistry registry ;

/** Apply the property function transformation.
* <p>
* The {@code context} provide the place to find the property function registry.
* A custom one canbe supplied using
* {@link ARQConstants#registryPropertyFunctions}
* <p>
* See {@link PropertyFunctionRegistry#chooseRegistry} for the full decision process.
* <p>
* In addition, {@link ARQ#enablePropertyFunctions} must be true (this is the default).
public class TransformPropertyFunction extends TransformCopy {
private final Context context;
private final boolean doingPropertyFunctions;
private final PropertyFunctionRegistry registry;

/**
* Apply the property function transformation.
* <p>
* The {@code context} provides the place to find the property function registry.
* A custom one can be supplied using
* {@link ARQConstants#registryPropertyFunctions}
* <p>
* See {@link PropertyFunctionRegistry#chooseRegistry} for the full decision
* process.
* <p>
* If {@link ARQ#enablePropertyFunctions} is false, then property functions are
* not enabled and remain as plain triples. For example, this is set false by "strict mode"
*/
public static Op transform(Op op, Context context) {
Transform t = new TransformPropertyFunction(context) ;
return Transformer.transform(t, op) ;
Transform t = new TransformPropertyFunction(context);
return Transformer.transform(t, op);
}

public TransformPropertyFunction(Context context)
{
this.context = context ;
doingMagicProperties = context.isTrue(ARQ.enablePropertyFunctions) ;
registry = PropertyFunctionRegistry.chooseRegistry(context) ;

public TransformPropertyFunction(Context context) {
this.context = context;
registry = PropertyFunctionRegistry.chooseRegistry(context);
doingPropertyFunctions = ( registry != null ) && context.isTrueOrUndef(ARQ.enablePropertyFunctions);
}

@Override
public Op transform(OpTriple opTriple)
{
if ( ! doingMagicProperties )
return opTriple ;

Op x = transform(opTriple.asBGP()) ;
if ( ! ( x instanceof OpBGP ) )
return x ;
public Op transform(OpTriple opTriple) {
if ( !doingPropertyFunctions )
return opTriple;

Op x = transform(opTriple.asBGP());
if ( !(x instanceof OpBGP) )
return x;

if ( opTriple.equivalent((OpBGP)x) )
return opTriple ;
return x ;

return opTriple;
return x;
}

@Override
public Op transform(OpBGP opBGP)
{
if ( ! doingMagicProperties )
return opBGP ;

return PropertyFunctionGenerator.buildPropertyFunctions(registry, opBGP, context) ;
public Op transform(OpBGP opBGP) {
if ( !doingPropertyFunctions )
return opBGP;
return PropertyFunctionGenerator.buildPropertyFunctions(registry, opBGP, context);
}

// Normally, property functionprocessing is done before quad conversion
// we could convert back to OpGraph and so handle quads

// For the moment, leave in old mode.


// Property function processing is done before quad conversion
// To change that, implement:

// @Override
// public Op transform(OpQuad opQuad)
// {
// if ( ! doingMagicProperties )
// return super.transform(opQuad) ; ;
// check(opQuad.getQuad().getPredicate()) ;
// return super.transform(opQuad) ;
// public Op transform(OpQuad opQuad) {
// if ( ! doingPropertyFunctions )
// return super.transform(opQuad);
// ...
//
// }
//
// private void check(Node p)
// {
// if ( p.isURI() )
// {
// if ( registry.manages(p.getURI()) )
// Log.warn(this, "Property function in quad: "+p) ;
// }
// }
//
//
// @Override
// public Op transform(OpQuadPattern opQuadPattern)
// {
// if ( ! doingMagicProperties )
// return super.transform(opQuadPattern) ; ;
//
// for ( Triple t : opQuadPattern.getBasicPattern().getList() )
// check(t.getPredicate()) ;
//
// return super.transform(opQuadPattern) ;
// public Op transform(OpQuadPattern opQuadPattern) {
// if ( ! doingPropertyFunctions )
// return super.transform(opQuadPattern);
// ...
// }

}

0 comments on commit 03a7f98

Please sign in to comment.