public void addExcludedFileName(String excludedFileName) { this.excludedFileNames.add(excludedFileName); if (this.verificationCodeNode != null && this.model != null) { Property p = model.getProperty(SpdxRdfConstants.SPDX_NAMESPACE, SpdxRdfConstants.PROP_VERIFICATIONCODE_IGNORED_FILES); this.verificationCodeResource.addProperty(p, excludedFileName); } }
public void setExcludedFileNames(String[] excludedFileNames) { this.excludedFileNames.clear(); if (this.verificationCodeNode != null && this.model != null) { // clear old list Property p = model.getProperty(SpdxRdfConstants.SPDX_NAMESPACE, SpdxRdfConstants.PROP_VERIFICATIONCODE_IGNORED_FILES); model.removeAll(this.verificationCodeResource, p, null); } for (int i = 0; i < excludedFileNames.length; i++) { addExcludedFileName(excludedFileNames[i]); } }
public void setExcludedFileNames(String[] excludedFileNames) { this.excludedFileNames.clear(); if (this.verificationCodeNode != null && this.model != null) { // clear old list Property p = model.getProperty(SpdxRdfConstants.SPDX_NAMESPACE, SpdxRdfConstants.PROP_VERIFICATIONCODE_IGNORED_FILES); model.removeAll(this.verificationCodeResource, p, null); } for (int i = 0; i < excludedFileNames.length; i++) { addExcludedFileName(excludedFileNames[i]); } }
/** * Remove all properties by the property name within the nameSpace from the subject node * @param node * @param propertyName * @throws InvalidSPDXAnalysisException */ private void removeProperties(Node subject, String nameSpace, String propertyName) throws InvalidSPDXAnalysisException { Property p = model.getProperty(nameSpace, propertyName); Resource s = getResource(subject); model.removeAll(s, p, null); }
public static boolean parseAskResult(final String resultURI) throws FileNotFoundException { if (resultURI.endsWith("srx")) return ResultsStAX.read(new FileInputStream(resultURI.substring(5)), null, null).getBooleanResult(); else if (resultURI.endsWith("ttl") || resultURI.endsWith("rdf")) return FileManager.get().loadModel(resultURI.substring(5)).getProperty(null, ResourceFactory.createProperty("http://www.w3.org/2001/sw/DataAccess/tests/result-set#boolean")).getBoolean(); else throw new OpenError("Unknown format."); }
public SPDXFile[] getFileReferences() throws InvalidSPDXAnalysisException { List<SPDXFile> alFiles = Lists.newArrayList(); Node p = model.getProperty(SPDX_NAMESPACE, PROP_SPDX_FILE_REFERENCE).asNode(); Triple m = Triple.createMatch(getSpdxDocNode(), p, null); ExtendedIterator<Triple> tripleIter = model.getGraph().find(m); while (tripleIter.hasNext()) { Triple t = tripleIter.next(); alFiles.add(new SPDXFile(this, t.getObject())); } SPDXFile[] retval = new SPDXFile[alFiles.size()]; return alFiles.toArray(retval); }
@Override public SecuredProperty getProperty(final String nameSpace, final String localName) throws ReadDeniedException, AuthenticationRequiredException { checkRead(); return SecuredPropertyImpl.getInstance(holder.getSecuredItem(), holder.getBaseItem().getProperty(nameSpace, localName)); }
@Override public SecuredProperty getProperty(final String uri) throws ReadDeniedException, AuthenticationRequiredException { checkRead(); return SecuredPropertyImpl.getInstance(holder.getSecuredItem(), holder.getBaseItem().getProperty(uri)); }
public void testGetPropertyOneArg() { final String uri = "http://aldabaran.hpl.hp.com/rdf/test4/a" + 130; final Property p = model.getProperty(uri); Assert.assertEquals(uri, p.getURI()); }
public void testGetPropertyTwoArgs() { final String ns = "http://aldabaran.hpl.hp.com/rdf/test4/a" + 140 + "/"; final Property p = model.getProperty(ns, "foo"); Assert.assertEquals(ns + "foo", p.getURI()); }
public void testGetPropertyTwoArgs() { final String ns = "http://aldabaran.hpl.hp.com/rdf/test4/a" + 140 + "/"; final Property p = model.getProperty(ns, "foo"); Assert.assertEquals(ns + "foo", p.getURI()); }
public void testGetPropertyOneArg() { final String uri = "http://aldabaran.hpl.hp.com/rdf/test4/a" + 130; final Property p = model.getProperty(uri); Assert.assertEquals(uri, p.getURI()); }
public List<SpdxPackage> findAllPackages() throws InvalidSPDXAnalysisException { Node rdfTypePredicate = model.getProperty(SpdxRdfConstants.RDF_NAMESPACE, SpdxRdfConstants.RDF_PROP_TYPE).asNode(); Node packageTypeObject = model.createResource(SPDX_NAMESPACE + CLASS_SPDX_PACKAGE).asNode(); Triple m = Triple.createMatch(null, rdfTypePredicate, packageTypeObject); List<SpdxPackage> retval = Lists.newArrayList(); ExtendedIterator<Triple> tripleIter = model.getGraph().find(m); while (tripleIter.hasNext()) { retval.add((SpdxPackage)SpdxElementFactory.createElementFromModel(this, tripleIter.next().getSubject())); } return retval; }
public List<SpdxPackage> findAllPackages() throws InvalidSPDXAnalysisException { Node rdfTypePredicate = model.getProperty(SpdxRdfConstants.RDF_NAMESPACE, SpdxRdfConstants.RDF_PROP_TYPE).asNode(); Node packageTypeObject = model.createResource(SPDX_NAMESPACE + CLASS_SPDX_PACKAGE).asNode(); Triple m = Triple.createMatch(null, rdfTypePredicate, packageTypeObject); List<SpdxPackage> retval = Lists.newArrayList(); ExtendedIterator<Triple> tripleIter = model.getGraph().find(m); while (tripleIter.hasNext()) { retval.add((SpdxPackage)SpdxElementFactory.createElementFromModel(this, tripleIter.next().getSubject())); } return retval; }
/** * @param id * @return true if the license ID is already in the model as an extracted license info * @throws InvalidSPDXAnalysisException */ protected boolean extractedLicenseExists(String id) throws InvalidSPDXAnalysisException { Node p = model.getProperty(SPDX_NAMESPACE, PROP_LICENSE_ID).asNode(); Node o = NodeFactory.createLiteral(id); Triple m = Triple.createMatch(null, p, o); ExtendedIterator<Triple> tripleIter = model.getGraph().find(m); return tripleIter.hasNext(); }
/** * Check a complex graph's transitive reduction. */ public void testTransitiveReduction() { Model test = FileManager.get().loadModel("testing/reasoners/bugs/subpropertyModel.n3"); Property dp = test.getProperty(TransitiveReasoner.directSubPropertyOf.getURI()); doTestTransitiveReduction(test, dp); }
public String getComment() { if (this.model != null && this.resource != null) { Node p = model.getProperty(SpdxRdfConstants.RDFS_NAMESPACE, SpdxRdfConstants.RDFS_PROP_COMMENT).asNode(); Triple m = Triple.createMatch(this.resource.asNode(), p, null); ExtendedIterator<Triple> tripleIter = model.getGraph().find(m); while (tripleIter.hasNext()) { this.comment = tripleIter.next().getObject().toString(false); } } return this.comment; }
/** * Check a complex graph's transitive reduction. */ public void testTransitiveReduction() { Model test = FileManager.get().loadModel("testing/reasoners/bugs/subpropertyModel.n3"); Property dp = test.getProperty(TransitiveReasoner.directSubPropertyOf.getURI()); doTestTransitiveReduction(test, dp); }
protected RDFList getListRoot( final Model m ) { final Resource root = m.getResource(TestList.NS + "root"); Assert.assertNotNull("Root resource should not be null", root); final Resource listHead = root.getRequiredProperty( m.getProperty(TestList.NS + "p")).getResource(); final RDFList l = listHead.as(RDFList.class); Assert.assertNotNull("as(RDFList) should not return null for root", l); return l; }
protected RDFList getListRoot( final Model m ) { final Resource root = m.getResource(TestList.NS + "root"); Assert.assertNotNull("Root resource should not be null", root); final Resource listHead = root.getRequiredProperty( m.getProperty(TestList.NS + "p")).getResource(); final RDFList l = listHead.as(RDFList.class); Assert.assertNotNull("as(RDFList) should not return null for root", l); return l; }