use of com.inova8.pathql.processor.PathPatternException in project com.inova8.intelligentgraph by peterjohnlawrence.
the class IntelligentGraphConnection method getPaths.
/**
* Gets the paths.
*
* @param thingresource the thingresource
* @param pathQLValue the path QL value
* @param contexts the contexts
* @return the paths
* @throws PathPatternException the path pattern exception
*/
private CloseableIteration<? extends IntelligentStatement, SailException> getPaths(Resource thingresource, String pathQLValue, Value obj, Resource... contexts) throws PathPatternException {
IntelligentGraphRepository source = IntelligentGraphRepository.create(this);
String pathQL = pathQLValue;
PathElement pathElement = PathParser.parsePathPattern(source.getRepositoryContext(), pathQL);
Thing thing = null;
if (thingresource != null) {
thing = Thing.create(source, thingresource, null);
pathElement.getSourceVariable().setValue(thing.getValue());
}
return getThingPaths(source, thing, pathElement, contexts);
}
use of com.inova8.pathql.processor.PathPatternException in project com.inova8.intelligentgraph by peterjohnlawrence.
the class IntelligentGraphConnection method addFact.
/**
* Adds the fact.
*
* @param thingresource the thingresource
* @param pathQL the path QL
* @param value the value
* @param contexts the contexts
* @throws RecognitionException the recognition exception
* @throws PathPatternException the path pattern exception
*/
private void addFact(Resource thingresource, String pathQL, Value value, Resource... contexts) throws RecognitionException, PathPatternException {
IntelligentGraphRepository source = IntelligentGraphRepository.create(this);
Thing thing = Thing.create(source, thingresource, null);
PredicateElement predicateElement = (PredicateElement) PathParser.parsePathPattern(source.getRepositoryContext(), pathQL);
predicateElement.getSourceVariable().setValue(thing.getValue());
if (predicateElement.getIsReified()) {
ReificationType reificationType = source.getRepositoryContext().getReificationTypes().get(predicateElement.getReification().stringValue());
if (reificationType != null) {
IRI reification = iri(reificationType.getReificationType().stringValue() + "/" + thing.getIRI().hashCode() + "." + predicateElement.getPredicate().hashCode() + "." + value.hashCode());
super.addStatement(reification, RDF.TYPE, predicateElement.getReification(), contexts);
super.addStatement(reification, reificationType.getReificationSubject(), thing.getIRI(), contexts);
super.addStatement(reification, reificationType.getReificationPredicate(), predicateElement.getPredicate(), contexts);
super.addStatement(reification, reificationType.getReificationObject(), value, contexts);
} else {
logger.error("Reified type not supported:" + predicateElement.toString());
}
} else {
IRI propertyIri = predicateElement.getPredicate();
super.addStatement(thing.getIRI(), propertyIri, value, contexts);
checkReificationsChanged(propertyIri);
}
}
use of com.inova8.pathql.processor.PathPatternException in project com.inova8.intelligentgraph by peterjohnlawrence.
the class Local_MultiGraphAddGetFact_Tests method addGraph2.
/**
* Adds the graph 2.
*
* @return the thing
* @throws RecognitionException the recognition exception
* @throws PathPatternException the path pattern exception
*/
// }
@SuppressWarnings("unused")
private Thing addGraph2() throws RecognitionException, PathPatternException {
source.removeGraph("<http://inova8.com/calc2graph/testGraph2>");
Graph graph = source.addGraph("<http://inova8.com/calc2graph/testGraph2>");
Thing myCountry = graph.getThing(":Country");
myCountry.addFact(":sales", "1");
myCountry.addFact(":sales", "2");
myCountry.addFact(":sales", "3");
myCountry.addFact(":sales", "4");
myCountry.addFact(":sales", "5");
// myCountry.addFact(":sales", "60");
return myCountry;
}
use of com.inova8.pathql.processor.PathPatternException in project com.inova8.intelligentgraph by peterjohnlawrence.
the class Local_MultiGraphAddGetFact_Tests method addGraph4.
/**
* Adds the graph 4.
*
* @return the thing
* @throws RecognitionException the recognition exception
* @throws PathPatternException the path pattern exception
*/
@SuppressWarnings("unused")
private Thing addGraph4() throws RecognitionException, PathPatternException {
source.removeGraph("<http://inova8.com/calc2graph/testGraph4>");
Graph graph = source.addGraph("<http://inova8.com/calc2graph/testGraph4>");
Thing myCountry = graph.getThing(":Country");
myCountry.addFact(":sales", "100");
myCountry.addFact(":sales", "200");
myCountry.addFact(":sales", "300");
myCountry.addFact(":sales", "400");
myCountry.addFact(":sales", "500");
return myCountry;
}
use of com.inova8.pathql.processor.PathPatternException in project com.inova8.intelligentgraph by peterjohnlawrence.
the class Local_SPARQL_Tests method addGraph4.
/**
* Adds the graph 4.
*
* @return the thing
* @throws RecognitionException the recognition exception
* @throws PathPatternException the path pattern exception
*/
private Thing addGraph4() throws RecognitionException, PathPatternException {
source.removeGraph("<http://inova8.com/calc2graph/testGraph4>");
Graph graph = source.addGraph("<http://inova8.com/calc2graph/testGraph4>");
Thing myCountry = graph.getThing(":Country");
myCountry.addFact(":sales", "100");
myCountry.addFact(":sales", "200");
myCountry.addFact(":sales", "300");
myCountry.addFact(":sales", "400");
myCountry.addFact(":sales", "500");
return myCountry;
}
Aggregations