/** * @deprecated since 4.0. Use {@link #objectLiteral(Model)} instead. */ @Deprecated public static Literal anyObjectLiteral(Model m) { return objectLiteral(m).orElse(null); }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (o instanceof Model) { Model model = (Model)o; return Models.isomorphic(this, model); } return false; }
/** * @deprecated since 4.0. Use {@link #objectResource(Model)} instead. */ @Deprecated public static Resource anyObjectResource(Model m) { return objectResource(m).orElse(null); }
/** * Compares two RDF models, and returns <tt>true</tt> if the first model is a subset of the second model, * using graph isomorphism to map statements between models. */ public static boolean isSubset(Iterable<? extends Statement> model1, Iterable<? extends Statement> model2) { // Filter duplicates Model set1 = toModel(model1); Model set2 = toModel(model2); return isSubset(set1, set2); }
@Override public void parse(Model model, Resource implNode) throws RepositoryConfigException { super.parse(model, implNode); try { Models.objectIRI(model.filter(implNode, REPOSITORYURL, null)).ifPresent( iri -> setURL(iri.stringValue())); Models.objectLiteral(model.filter(implNode, USERNAME, null)).ifPresent( username -> setUsername(username.getLabel())); Models.objectLiteral(model.filter(implNode, PASSWORD, null)).ifPresent( password -> setPassword(password.getLabel())); } catch (ModelException e) { throw new RepositoryConfigException(e.getMessage(), e); } } }
public void parse(Model model, Resource repositoryNode) throws RepositoryConfigException { try { Models.objectLiteral(model.filter(repositoryNode, REPOSITORYID, null)).ifPresent( lit -> setID(lit.getLabel())); Models.objectLiteral(model.filter(repositoryNode, RDFS.LABEL, null)).ifPresent( lit -> setTitle(lit.getLabel())); Models.objectResource(model.filter(repositoryNode, REPOSITORYIMPL, null)).ifPresent( res -> setRepositoryImplConfig(AbstractRepositoryImplConfig.create(model, res))); } catch (ModelException e) { throw new RepositoryConfigException(e.getMessage(), e); } }
setTablespace(tablespaceValue.get().stringValue()); } else { Optional<Resource> delegate = Models.subject(graph.filter(null, SailConfigSchema.DELEGATE, implNode)); Optional<Resource> sailImpl = Models.subject(graph.filter(null, SailRepositorySchema.SAILIMPL, delegate.isPresent() ? delegate.get(): implNode)); if (sailImpl.isPresent()) { Optional<Resource> repoImpl = Models.subject(graph.filter(null, RepositoryConfigSchema.REPOSITORYIMPL, sailImpl.get())); if (repoImpl.isPresent()) { Optional<Literal> idValue = Models.objectLiteral(graph.filter(repoImpl.get(), RepositoryConfigSchema.REPOSITORYID, null)); if (idValue.isPresent()) { setTablespace(idValue.get().stringValue());
/** * @deprecated since 4.0. Use {@link #objectIRI(Model)} instead. */ @Deprecated public static URI anyObjectURI(Model m) { return objectIRI(m).orElse(null); }
/** * @deprecated since 4.0. Use {@link #subject(Model)} instead. */ @Deprecated public static Resource anySubject(Model m) { return subject(m).orElse(null); }
/** * Compares the models of the default context of two repositories and returns true if rep1 is a subset of * rep2. Note that the method pulls the entire default context of both repositories into main memory. Use * with caution. */ public static boolean isSubset(Repository rep1, Repository rep2) throws RepositoryException { Set<Statement> model1, model2; try (RepositoryConnection con1 = rep1.getConnection()) { model1 = Iterations.asSet(con1.getStatements(null, null, null, true)); } try (RepositoryConnection con2 = rep2.getConnection()) { model2 = Iterations.asSet(con2.getStatements(null, null, null, true)); } return Models.isSubset(model1, model2); }
@Override public void parse(Model model, Resource implNode) throws RepositoryConfigException { super.parse(model, implNode); try { Models.objectIRI(model.filter(implNode, REPOSITORYURL, null)).ifPresent( iri -> setURL(iri.stringValue())); Models.objectLiteral(model.filter(implNode, USERNAME, null)).ifPresent( username -> setUsername(username.getLabel())); Models.objectLiteral(model.filter(implNode, PASSWORD, null)).ifPresent( password -> setPassword(password.getLabel())); } catch (ModelException e) { throw new RepositoryConfigException(e.getMessage(), e); } } }
public void parse(Model model, Resource repositoryNode) throws RepositoryConfigException { try { Models.objectLiteral(model.filter(repositoryNode, REPOSITORYID, null)).ifPresent( lit -> setID(lit.getLabel())); Models.objectLiteral(model.filter(repositoryNode, RDFS.LABEL, null)).ifPresent( lit -> setTitle(lit.getLabel())); Models.objectResource(model.filter(repositoryNode, REPOSITORYIMPL, null)).ifPresent( res -> setRepositoryImplConfig(AbstractRepositoryImplConfig.create(model, res))); } catch (ModelException e) { throw new RepositoryConfigException(e.getMessage(), e); } }
/** * @deprecated since 4.0. Use {@link #objectIRI(Model)} instead. */ @Deprecated public static URI anyObjectURI(Model m) { return objectIRI(m).orElse(null); }
/** * Compares two RDF models, and returns <tt>true</tt> if the first model is a subset of the second model, * using graph isomorphism to map statements between models. */ public static boolean isSubset(Iterable<? extends Statement> model1, Iterable<? extends Statement> model2) { // Filter duplicates Model set1 = toModel(model1); Model set2 = toModel(model2); return isSubset(set1, set2); }
/** * @deprecated since 4.0. Use {@link #subject(Model)} instead. */ @Deprecated public static Resource anySubject(Model m) { return subject(m).orElse(null); }
/** * Compares the models of the default context of two repositories and returns true if rep1 is a subset of * rep2. Note that the method pulls the entire default context of both repositories into main memory. Use * with caution. */ public static boolean isSubset(Repository rep1, Repository rep2) throws RepositoryException { Set<Statement> model1, model2; RepositoryConnection con1 = rep1.getConnection(); try { model1 = Iterations.asSet(con1.getStatements(null, null, null, true)); } finally { con1.close(); } RepositoryConnection con2 = rep2.getConnection(); try { model2 = Iterations.asSet(con2.getStatements(null, null, null, true)); } finally { con2.close(); } return Models.isSubset(model1, model2); }
/** * @deprecated since 4.0. Use {@link #objectLiteral(Model)} instead. */ @Deprecated public static Literal anyObjectLiteral(Model m) { return objectLiteral(m).orElse(null); }
@Override public void parse(Model model, Resource implNode) throws RepositoryConfigException { super.parse(model, implNode); try { Models.objectIRI(model.filter(implNode, REPOSITORYURL, null)).ifPresent( iri -> setURL(iri.stringValue())); Models.objectLiteral(model.filter(implNode, USERNAME, null)).ifPresent( username -> setUsername(username.getLabel())); Models.objectLiteral(model.filter(implNode, PASSWORD, null)).ifPresent( password -> setPassword(password.getLabel())); } catch (ModelException e) { throw new RepositoryConfigException(e.getMessage(), e); } } }
Optional<Literal> language = Models.objectLiteral(m.filter(implNode, QUERY_LANGUAGE, null)); Optional<Resource> object = Models.objectResource(m.filter(implNode, RULE_QUERY, null)); if (object.isPresent()) { Models.objectLiteral(m.filter(object.get(), SP.TEXT_PROPERTY, null)).ifPresent( lit -> setRuleQuery(lit.stringValue())); object = Models.objectResource(m.filter(implNode, MATCHER_QUERY, null)); if (object.isPresent()) { Models.objectLiteral(m.filter(object.get(), SP.TEXT_PROPERTY, null)).ifPresent( lit -> setMatcherQuery(lit.stringValue()));
@Override public boolean equals(Object o) { if (this == o) { return true; } if (o instanceof Model) { Model model = (Model)o; return Models.isomorphic(this, model); } return false; }