/** initialise this personality with the bindings from _other_ */ public Personality( Personality<T> other ) { this(); this.add( other ); }
/** initialise this personality with the bindings from _other_ */ public Personality( Personality<T> other ) { this(); this.add( other ); }
public static void init(Personality<RDFNode> p) { p.add(TriplesMap.class, new SimpleImplementation(TriplesMapImpl::new)); p.add(LogicalTable.class, new SimpleImplementation(LogicalTableImpl::new)); p.add(PredicateObjectMap.class, new SimpleImplementation(PredicateObjectMapImpl::new)); p.add(GraphMap.class, new SimpleImplementation(GraphMapImpl::new)); p.add(SubjectMap.class, new SimpleImplementation(SubjectMapImpl::new)); p.add(PredicateMap.class, new SimpleImplementation(PredicateMapImpl::new)); p.add(ObjectMap.class, new SimpleImplementation(ObjectMapImpl::new)); p.add(TermMap.class, new SimpleImplementation(TermMapImpl::new)); } }
public static void init(Personality<RDFNode> p) { p.add(TriplesMap.class, new SimpleImplementation(TriplesMapImpl::new)); p.add(LogicalTable.class, new SimpleImplementation(LogicalTableImpl::new)); p.add(PredicateObjectMap.class, new SimpleImplementation(PredicateObjectMapImpl::new)); p.add(GraphMap.class, new SimpleImplementation(GraphMapImpl::new)); p.add(SubjectMap.class, new SimpleImplementation(SubjectMapImpl::new)); p.add(PredicateMap.class, new SimpleImplementation(PredicateMapImpl::new)); p.add(ObjectMap.class, new SimpleImplementation(ObjectMapImpl::new)); p.add(TermMap.class, new SimpleImplementation(TermMapImpl::new)); } }
public static void registerJenaResourceClassesUsingPackageScan(String basePackage, Personality<RDFNode> p, PrefixMapping pm) { Set<ClassInfo> classInfos; try { classInfos = ClassPath.from(Thread.currentThread().getContextClassLoader()).getTopLevelClassesRecursive(basePackage); } catch (IOException e) { throw new RuntimeException(e); } for(ClassInfo classInfo : classInfos) { Class<?> clazz = classInfo.load(); if(Resource.class.isAssignableFrom(clazz) && supportsProxying(clazz)) { @SuppressWarnings("unchecked") Class<? extends Resource> cls = (Class<? extends Resource>)clazz; logger.debug("Registering " + clazz); p.add(cls, new ProxyImplementation(MapperProxyUtils.createProxyFactory(cls, pm))); } } }
private static void init(Personality<RDFNode> p) { p.add(SHConstraintComponent.class, new SimpleImplementation(SH.ConstraintComponent.asNode(), SHConstraintComponentImpl.class)); p.add(SHJSConstraint.class, new SimpleImplementation(SH.JSConstraint.asNode(), SHJSConstraintImpl.class)); p.add(SHJSExecutable.class, new SimpleImplementation(SH.JSExecutable.asNode(), SHJSExecutableImpl.class)); p.add(SHJSFunction.class, new SimpleImplementation(SH.JSFunction.asNode(), SHJSFunctionImpl.class)); p.add(SHParameter.class, new SimpleImplementation(SH.Parameter.asNode(), SHParameterImpl.class)); p.add(SHParameterizable.class, new SimpleImplementation(SH.Parameterizable.asNode(), SHParameterizableImpl.class)); p.add(SHParameterizableInstance.class, new SimpleImplementation(RDFS.Resource.asNode(), SHParameterizableInstanceImpl.class)); p.add(SHParameterizableTarget.class, new SimpleImplementation(SH.Target.asNode(), SHParameterizableTargetImpl.class)); p.add(SHPropertyShape.class, new SimpleImplementation(SH.PropertyShape.asNode(), SHPropertyShapeImpl.class)); p.add(SHResult.class, new SimpleImplementation(SH.AbstractResult.asNode(), SHResultImpl.class)); p.add(SHRule.class, new SimpleImplementation(SH.Rule.asNode(), SHRuleImpl.class)); p.add(SHNodeShape.class, new SimpleImplementation(SH.NodeShape.asNode(), SHNodeShapeImpl.class)); p.add(SHSPARQLConstraint.class, new SimpleImplementation(SH.SPARQLConstraint.asNode(), SHSPARQLConstraintImpl.class)); p.add(SHSPARQLFunction.class, new SimpleImplementation(SH.SPARQLFunction.asNode(), SHSPARQLFunctionImpl.class)); p.add(SHSPARQLTarget.class, new SimpleImplementation(SH.SPARQLTarget.asNode(), SHSPARQLTargetImpl.class)); FunctionRegistry.get().put(DASH.isDeactivated.getURI(), IsDeactivatedFunction.class); FunctionRegistry.get().put(TOSH.hasShape.getURI(), HasShapeFunction.class); FunctionRegistry.get().put(TOSH.isInTargetOf.getURI(), IsInTargetOfFunction.class); FunctionRegistry.get().put("http://spinrdf.org/spif#checkRegexSyntax", CheckRegexSyntaxFunction.class); FunctionRegistry.get().put("http://spinrdf.org/spif#isValidForDatatype", IsValidForDatatypeFunction.class); FunctionRegistry.get().put("http://spinrdf.org/spif#isValidLangTag", IsValidLangTagFunction.class); PropertyFunctionRegistry.get().put(TOSH.evalExpr.getURI(), EvalExprPFunction.class); PropertyFunctionRegistry.get().put(TOSH.targetContains.getURI(), TargetContainsPFunction.class); }
private static void init(Personality<RDFNode> p) { p.add(SHConstraintComponent.class, new SimpleImplementation(SH.ConstraintComponent.asNode(), SHConstraintComponentImpl.class)); p.add(SHJSConstraint.class, new SimpleImplementation(SH.JSConstraint.asNode(), SHJSConstraintImpl.class)); p.add(SHJSExecutable.class, new SimpleImplementation(SH.JSExecutable.asNode(), SHJSExecutableImpl.class)); p.add(SHJSFunction.class, new SimpleImplementation(SH.JSFunction.asNode(), SHJSFunctionImpl.class)); p.add(SHParameter.class, new SimpleImplementation(SH.Parameter.asNode(), SHParameterImpl.class)); p.add(SHParameterizable.class, new SimpleImplementation(SH.Parameterizable.asNode(), SHParameterizableImpl.class)); p.add(SHParameterizableInstance.class, new SimpleImplementation(RDFS.Resource.asNode(), SHParameterizableInstanceImpl.class)); p.add(SHParameterizableTarget.class, new SimpleImplementation(SH.Target.asNode(), SHParameterizableTargetImpl.class)); p.add(SHPropertyShape.class, new SimpleImplementation(SH.PropertyShape.asNode(), SHPropertyShapeImpl.class)); p.add(SHResult.class, new SimpleImplementation(SH.AbstractResult.asNode(), SHResultImpl.class)); p.add(SHRule.class, new SimpleImplementation(SH.Rule.asNode(), SHRuleImpl.class)); p.add(SHNodeShape.class, new SimpleImplementation(SH.NodeShape.asNode(), SHNodeShapeImpl.class)); p.add(SHSPARQLConstraint.class, new SimpleImplementation(SH.SPARQLConstraint.asNode(), SHSPARQLConstraintImpl.class)); p.add(SHSPARQLFunction.class, new SimpleImplementation(SH.SPARQLFunction.asNode(), SHSPARQLFunctionImpl.class)); p.add(SHSPARQLTarget.class, new SimpleImplementation(SH.SPARQLTarget.asNode(), SHSPARQLTargetImpl.class)); FunctionRegistry.get().put(DASH.isDeactivated.getURI(), IsDeactivatedFunction.class); FunctionRegistry.get().put(TOSH.hasShape.getURI(), HasShapeFunction.class); FunctionRegistry.get().put(TOSH.isInTargetOf.getURI(), IsInTargetOfFunction.class); FunctionRegistry.get().put("http://spinrdf.org/spif#checkRegexSyntax", CheckRegexSyntaxFunction.class); FunctionRegistry.get().put("http://spinrdf.org/spif#isValidForDatatype", IsValidForDatatypeFunction.class); FunctionRegistry.get().put("http://spinrdf.org/spif#isValidLangTag", IsValidLangTagFunction.class); PropertyFunctionRegistry.get().put(TOSH.evalExpr.getURI(), EvalExprPFunction.class); PropertyFunctionRegistry.get().put(TOSH.values.getURI(), ValuesPFunction.class); PropertyFunctionRegistry.get().put(TOSH.targetContains.getURI(), TargetContainsPFunction.class); }
public void testSimple() { Graph g = Factory.createGraphMem(); Personality<RDFNode> ours = BuiltinPersonalities.model.copy().add( Example.class, Example.factory ); EnhGraph eg = new EnhGraph( g, ours ); Node n = NodeFactory.createURI( "spoo:bar" ); EnhNode eNode = new EnhNode( NodeFactory.createURI( "spoo:bar" ), eg ); EnhNode eBlank = new EnhNode( NodeFactory.createBlankNode(), eg ); assertTrue( "URI node can be an Example", eNode.supports( Example.class ) ); assertFalse( "Blank node cannot be an Example", eBlank.supports( Example.class ) ); }
public void testAlreadyLinkedViewException() { Graph g = Factory.createGraphMem(); Personality<RDFNode> ours = BuiltinPersonalities.model.copy().add( Example.class, Example.factory ); EnhGraph eg = new EnhGraph( g, ours ); Node n = NodeCreateUtils.create( "spoo:bar" ); EnhNode eNode = new Example( n, eg ); EnhNode multiplexed = new Example( n, eg ); multiplexed.as( Property.class ); eNode.viewAs( Example.class ); try { eNode.addView( multiplexed ); fail( "should raise an AlreadyLinkedViewException " ); } catch (AlreadyLinkedViewException e) {} }
public void testSimple() { Graph g = Factory.createGraphMem(); Personality<RDFNode> ours = BuiltinPersonalities.model.copy().add( Example.class, Example.factory ); EnhGraph eg = new EnhGraph( g, ours ); Node n = NodeFactory.createURI( "spoo:bar" ); EnhNode eNode = new EnhNode( NodeFactory.createURI( "spoo:bar" ), eg ); EnhNode eBlank = new EnhNode( NodeFactory.createBlankNode(), eg ); assertTrue( "URI node can be an Example", eNode.supports( Example.class ) ); assertFalse( "Blank node cannot be an Example", eBlank.supports( Example.class ) ); }
public void testAlreadyLinkedViewException() { Graph g = Factory.createGraphMem(); Personality<RDFNode> ours = BuiltinPersonalities.model.copy().add( Example.class, Example.factory ); EnhGraph eg = new EnhGraph( g, ours ); Node n = NodeCreateUtils.create( "spoo:bar" ); EnhNode eNode = new Example( n, eg ); EnhNode multiplexed = new Example( n, eg ); multiplexed.as( Property.class ); eNode.viewAs( Example.class ); try { eNode.addView( multiplexed ); fail( "should raise an AlreadyLinkedViewException " ); } catch (AlreadyLinkedViewException e) {} }