/** * {@inheritDoc} */ @Override public boolean contains(Statement s) { return super.object.contains(s); }
/** * {@inheritDoc} */ @Override public boolean contains(Resource s, Property p) { return super.object.contains(s, p); }
/** * {@inheritDoc} */ @Override public boolean contains(Resource s, Property p, RDFNode o) { return super.object.contains(s, p, o); }
/** * {@inheritDoc} */ @Override public boolean contains(Resource s, Property p, String o) { return super.object.contains(s, p, o); }
/** * {@inheritDoc} */ @Override public boolean contains(Resource s, Property p, String o, String l) { return super.object.contains(s, p, o, l); }
public boolean contains(Resource s, Property p, String o) { return model.contains(s, p, o); }
public boolean contains(Statement s) { return model.contains(s); }
/** Answer the subset of <code>classes</code> which have no superclass in <code>m</code>. */ private static Set<Resource> selectRootClasses( Model m, Set<RDFNode> classes ) { Set<Resource> roots = new HashSet<Resource>(); for (Iterator<RDFNode> it = classes.iterator(); it.hasNext();) { Resource type = (Resource) it.next(); if (!m.contains( type, RDFS.subClassOf, (RDFNode) null ) ) roots.add( type ); } return roots; }
public boolean supportsProperty(Property property) { Model caps = getReasonerCapabilities(); if( caps == null ) return false; return caps.contains(null, ReasonerVocabulary.supportsP, property); }
private boolean wantReification(Statement s, Resource ref) { if (s == null || ref == null || ref.isAnon() || prettyWriter.sReification) return false; if (!(isLocalReference(ref))) return false; Statement reify[] = reification(s); int i; for (i = 0; i < reify.length; i++) if (doneSet.contains(reify[i]) || (!model.contains(reify[i]))) return false; // Some of reification already done. return true; // Reification rule helps. }
private List<Resource> findRoots() { List<Resource> roots = new ArrayList<Resource>(); for (ResIterator i = model.listSubjects(); i.hasNext(); ) { Resource r = i.next(); if (r.isAnon() && model.contains(null, null, r)) continue; roots.add(r); } return roots; }
/** * Determine whether the given property is recognized and treated specially * by this reasoner. This is a convenience packaging of a special case of getCapabilities. * @param property the property which we want to ask the reasoner about, given as a Node since * this is part of the SPI rather than API * @return true if the given property is handled specially by the reasoner. */ @Override public boolean supportsProperty(Property property) { if (factory == null) return false; Model caps = factory.getCapabilities(); Resource root = caps.getResource(factory.getURI()); return caps.contains(root, ReasonerVocabulary.supportsP, property); }
/** * Determine whether the given property is recognized and treated specially * by this reasoner. This is a convenience packaging of a special case of getCapabilities. * @param property the property which we want to ask the reasoner about, given as a Node since * this is part of the SPI rather than API * @return true if the given property is handled specially by the reasoner. */ @Override public boolean supportsProperty(Property property) { if (factory == null) return false; Model caps = factory.getCapabilities(); Resource root = caps.getResource(factory.getURI()); return caps.contains(root, ReasonerVocabulary.supportsP, property); }
private void buildOneResource(Resource root) { buildVariables(root) ; int count = buildPreprocess(root) ; if ( root.getModel().contains(null, ResultSetGraphVocab.index, (RDFNode)null) ) buildRowsOrdered(root, count) ; else buildRows(root) ; }
private void buildOneResource(Resource root) { buildVariables(root) ; int count = buildPreprocess(root) ; if ( root.getModel().contains(null, ResultSetGraphVocab.index, (RDFNode)null) ) buildRowsOrdered(root, count) ; else buildRows(root) ; }
private ATermList createList(Resource r) { if(r.equals(RDF.nil)) return ATermUtils.EMPTY_LIST; else if(!rawModel.contains(r, RDF.first)) { System.err.println("Invalid list structure: List " + r + " does not have a rdf:first property. Ignoring rest of the list."); return ATermUtils.EMPTY_LIST; } ATerm first = node2term(rawModel.getProperty(r, RDF.first).getObject()); Resource rest = rawModel.getProperty(r, RDF.rest).getResource(); return ATermUtils.makeList(first, createList(rest)); } // createList
private void assertHas( Model obtained, String ... lines ) { Model wanted = modelFrom( lines ); for (Statement s: wanted.listStatements().toList()) if (!obtained.contains( s )) fail("missing required statement: " + s ); }
private void assertHasnt( Model obtained, String ... lines ) { Model wanted = modelFrom( lines ); for (Statement s: wanted.listStatements().toList()) if (obtained.contains( s )) fail("has prohibited statement: " + s ); }
private boolean hasMembershipTriples(Model containerModel) { Resource container = containerModel.getResource(directContainer); Resource membershipResource = container.getPropertyResourceValue(containerModel.createProperty(LDP.membershipResource.stringValue())); Resource hasMemberRelation = container.getPropertyResourceValue(containerModel.createProperty(LDP.hasMemberRelation.stringValue())); assertNotNull(membershipResource, MSG_MBRRES_NOTFOUND); // First verify the membership triples exist if (hasMemberRelation != null) { return membershipResource.hasProperty(containerModel.createProperty(hasMemberRelation.getURI())); } // Not if membership triple is not of form: (container, membership predicate, member), it may be the inverse. Resource isMemberOfRelation = container.getPropertyResourceValue(containerModel.createProperty(LDP.isMemberOfRelation.stringValue())); return containerModel.contains(null, containerModel.createProperty(isMemberOfRelation.getURI()), membershipResource); }
@Test public void testTermbindsIncludesMetaproperties() throws URISyntaxException { Integer totalResults = null; Resource thisMetaPage = createMetadata(false, totalResults); for (Property p: expectedTermboundProperties) { Model model = thisMetaPage.getModel(); if (!model.contains(null, API.property, p)) { fail("term bindings should include " + model.shortForm(p.getURI())); } } }