org.apache.jena.rdf.model.Model Java Examples
The following examples show how to use
org.apache.jena.rdf.model.Model.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SPDXCreatorInformation.java From tools with Apache License 2.0 | 6 votes |
public Resource createResource(Model model) { this.model = model; Resource type = model.createResource(SpdxRdfConstants.SPDX_NAMESPACE + SpdxRdfConstants.CLASS_SPDX_CREATION_INFO); Resource r = model.createResource(type); if (creators != null && creators.length > 0) { Property nameProperty = model.createProperty(SpdxRdfConstants.SPDX_NAMESPACE, SpdxRdfConstants.PROP_CREATION_CREATOR); for (int i = 0; i < creators.length; i++) { r.addProperty(nameProperty, this.creators[i]); } } if (this.comment != null) { Property commentProperty = model.createProperty(SpdxRdfConstants.RDFS_NAMESPACE, SpdxRdfConstants.RDFS_PROP_COMMENT); r.addProperty(commentProperty, this.comment); } // creation date if (this.createdDate != null) { Property createdDateProperty = model.createProperty(SpdxRdfConstants.SPDX_NAMESPACE, SpdxRdfConstants.PROP_CREATION_CREATED); r.addProperty(createdDateProperty, this.createdDate); } this.creatorNode = r.asNode(); this.creatorResource = r; return r; }
Example #2
Source File: TestSPDXDocument.java From tools with Apache License 2.0 | 6 votes |
@Test public void testDataLicense() throws InvalidSPDXAnalysisException, InvalidLicenseStringException { Model model = ModelFactory.createDefaultModel(); SPDXDocument doc = new SPDXDocument(model); String testDocUri = "https://olex.openlogic.com/spdxdoc/package_versions/download/4832?path=openlogic/zlib/1.2.3/zlib-1.2.3-all-src.zip&package_version_id=1082"; doc.createSpdxAnalysis(testDocUri); // check default SpdxListedLicense dataLicense = doc.getDataLicense(); assertEquals(org.spdx.rdfparser.SpdxRdfConstants.SPDX_DATA_LICENSE_ID, dataLicense.getLicenseId()); // check set correct license AnyLicenseInfo cc0License = LicenseInfoFactory.parseSPDXLicenseString(org.spdx.rdfparser.SpdxRdfConstants.SPDX_DATA_LICENSE_ID); doc.setDataLicense((SpdxListedLicense)cc0License); dataLicense = doc.getDataLicense(); assertEquals(org.spdx.rdfparser.SpdxRdfConstants.SPDX_DATA_LICENSE_ID, dataLicense.getLicenseId()); // check error when setting wrong license AnyLicenseInfo ngplLicense = LicenseInfoFactory.parseSPDXLicenseString("NGPL"); try { doc.setDataLicense((SpdxListedLicense)ngplLicense); fail("Incorrect license allowed to be set for data license"); } catch(InvalidSPDXAnalysisException e) { // expected - do nothing } }
Example #3
Source File: SPARQLExecutionResultTest.java From hypergraphql with Apache License 2.0 | 6 votes |
@Test void toString_should_produce_intelligible_results() { final Model model = ModelFactory.createDefaultModel(); model.add( model.createStatement( model.createResource("http://data.hypergraphql.org/resources/123456"), model.createProperty("http://data.hypergraphql.org/ontology/", "name"), model.createLiteral("Test", "en") ) ); final SPARQLExecutionResult result = new SPARQLExecutionResult(generateSimpleResultSet(), model); final String toString = result.toString(); final String expectedToS = "RESULTS\nModel : \n" + "<ModelCom {http://data.hypergraphql.org/resources/123456 " + "@http://data.hypergraphql.org/ontology/name \"Test\"@en} | " + "[http://data.hypergraphql.org/resources/123456, http://data.hypergraphql.org/ontology/name, \"Test\"@en]>\n" + "ResultSet : \n{one=[1]}"; assertEquals(expectedToS, toString); }
Example #4
Source File: LicenseException.java From tools with Apache License 2.0 | 6 votes |
/** * Searches the model for a exception with the ID * @param model * @param id * @return Node containing the exception or Null if none found */ public static Node findException(Model model, String id) { Property idProperty = model.createProperty(SpdxRdfConstants.SPDX_NAMESPACE, SpdxRdfConstants.PROP_LICENSE_EXCEPTION_ID); Property typeProperty = model.getProperty(SpdxRdfConstants.RDF_NAMESPACE, SpdxRdfConstants.RDF_PROP_TYPE); Property exceptionTypeProperty = model.getProperty(SpdxRdfConstants.SPDX_NAMESPACE, SpdxRdfConstants.CLASS_SPDX_LICENSE_EXCEPTION); Triple m = Triple.createMatch(null, idProperty.asNode(), null); ExtendedIterator<Triple> tripleIter = model.getGraph().find(m); while (tripleIter.hasNext()) { Triple t = tripleIter.next(); if (t.getObject().toString(false).equals(id)) { Triple typeMatch = Triple.createMatch(t.getSubject(), typeProperty.asNode(), exceptionTypeProperty.asNode()); ExtendedIterator<Triple> typeTripleIter = model.getGraph().find(typeMatch); if (typeTripleIter.hasNext()) { return t.getSubject(); } } } return null; }
Example #5
Source File: TestAnnotation.java From tools with Apache License 2.0 | 6 votes |
/** * Test method for {@link org.spdx.rdfparser.model.Annotation#setAnnotationDate(java.lang.String)}. * @throws InvalidSPDXAnalysisException */ @Test public void testSetDate() throws InvalidSPDXAnalysisException { Annotation a = new Annotation(ANNOTATOR1, OTHER_ANNOTATION, date, COMMENT1); assertEquals(ANNOTATOR1, a.getAnnotator()); assertEquals(OTHER_ANNOTATION, a.getAnnotationType()); assertEquals(date, a.getAnnotationDate()); assertEquals(COMMENT1, a.getComment()); final Model model = ModelFactory.createDefaultModel(); IModelContainer modelContainer = new ModelContainerForTest(model, "http://testnamespace.com"); Resource r = a.createResource(modelContainer); a.setAnnotationDate(oldDate); assertEquals(oldDate, a.getAnnotationDate()); Annotation copy = new Annotation(modelContainer, r.asNode()); assertEquals(oldDate, copy.getAnnotationDate()); }
Example #6
Source File: SPARQLEndpointService.java From hypergraphql with Apache License 2.0 | 6 votes |
void iterateFutureResults ( final Set<Future<SPARQLExecutionResult>> futureSPARQLResults, final Model unionModel, Map<String, Set<String>> resultSet ) { for (Future<SPARQLExecutionResult> futureExecutionResult : futureSPARQLResults) { try { SPARQLExecutionResult result = futureExecutionResult.get(); unionModel.add(result.getModel()); resultSet.putAll(result.getResultSet()); } catch (InterruptedException | ExecutionException e) { e.printStackTrace(); } } }
Example #7
Source File: TestSPDXDocument.java From tools with Apache License 2.0 | 6 votes |
/** * Test method for {@link org.spdx.rdfparser.SPDXDocument#setDocumentComment(java.lang.String)}. * @throws InvalidSPDXAnalysisException * @throws IOException */ @Test public void testSetDocumentComment() throws InvalidSPDXAnalysisException, IOException { Model model = ModelFactory.createDefaultModel(); SPDXDocument doc = new SPDXDocument(model); String testUri = "https://olex.openlogic.com/package_versions/download/4832?path=openlogic/zlib/1.2.3/zlib-1.2.3-all-src.zip&package_version_id=1082"; doc.createSpdxAnalysis(testUri); String beforeComment = doc.getDocumentComment(); if (beforeComment != null) { fail("Comment should not exist"); } String COMMENT_STRING = "This is a comment"; doc.setDocumentComment(COMMENT_STRING); String afterComment = doc.getDocumentComment(); assertEquals(COMMENT_STRING, afterComment); }
Example #8
Source File: SHACLPaths.java From shacl with Apache License 2.0 | 6 votes |
/** * Attempts to parse a given string into a Jena Path. * Throws an Exception if the string cannot be parsed. * @param string the string to parse * @param model the Model to operate on (for prefixes) * @return a Path or a Resource if this is a URI */ public static Object getJenaPath(String string, Model model) throws QueryParseException { Query query = ARQFactory.get().createQuery(model, "ASK { ?a \n" + string + "\n ?b }"); Element element = query.getQueryPattern(); if(element instanceof ElementGroup) { Element e = ((ElementGroup)element).getElements().get(0); if(e instanceof ElementPathBlock) { Path path = ((ElementPathBlock) e).getPattern().get(0).getPath(); if(path instanceof P_Link && ((P_Link)path).isForward()) { return model.asRDFNode(((P_Link)path).getNode()); } else { return path; } } else if(e instanceof ElementTriplesBlock) { return model.asRDFNode(((ElementTriplesBlock) e).getPattern().get(0).getPredicate()); } } throw new QueryParseException("Not a SPARQL 1.1 Path expression", 2, 1); }
Example #9
Source File: SPDXChecksum.java From tools with Apache License 2.0 | 6 votes |
/** * Creates a resource from this SPDX Checksum * @param model * @return */ public Resource createResource(Model model) { this.model = model; Resource type = model.createResource(SpdxRdfConstants.SPDX_NAMESPACE + SpdxRdfConstants.CLASS_SPDX_CHECKSUM); Resource r = model.createResource(type); if (algorithm != null) { Property algProperty = model.createProperty(SpdxRdfConstants.SPDX_NAMESPACE, SpdxRdfConstants.PROP_CHECKSUM_ALGORITHM); r.addProperty(algProperty, this.algorithm); } if (this.value != null) { Property valueProperty = model.createProperty(SpdxRdfConstants.SPDX_NAMESPACE, SpdxRdfConstants.PROP_CHECKSUM_VALUE); r.addProperty(valueProperty, this.value); } this.checksumNode = r.asNode(); this.checksumResource = r; return r; }
Example #10
Source File: TestRdfModelObject.java From tools with Apache License 2.0 | 6 votes |
@Test public void testAddAnyLicenseInfos() throws InvalidSPDXAnalysisException { final Model model = ModelFactory.createDefaultModel(); IModelContainer modelContainer = new ModelContainerForTest(model, "http://testnamespace.com"); Resource r = model.createResource(); EmptyRdfModelObject empty = new EmptyRdfModelObject(modelContainer, r.asNode()); AnyLicenseInfo[] result = empty.findAnyLicenseInfoPropertyValues(TEST_NAMESPACE, TEST_PROPNAME1); assertEquals(0, result.length); SpdxListedLicense lic1 = LicenseInfoFactory.getListedLicenseById(STANDARD_LICENSE_ID1); String licId2 = "LicRef-2"; String licenseText2 = "License text 2"; ExtractedLicenseInfo lic2 = new ExtractedLicenseInfo(licId2, licenseText2); empty.addPropertyValue(TEST_NAMESPACE, TEST_PROPNAME1, lic1); result = empty.findAnyLicenseInfoPropertyValues(TEST_NAMESPACE, TEST_PROPNAME1); assertEquals(1, result.length); assertEquals(lic1, result[0]); empty.addPropertyValue(TEST_NAMESPACE, TEST_PROPNAME1, lic2); result = empty.findAnyLicenseInfoPropertyValues(TEST_NAMESPACE, TEST_PROPNAME1); assertEquals(2, result.length); assertTrue(UnitTestHelper.isArraysEqual(new AnyLicenseInfo[] {lic1, lic2}, result)); }
Example #11
Source File: ComponentParameterWriter.java From RDFUnit with Apache License 2.0 | 6 votes |
@Override public Resource write(Model model) { Resource resource = ElementWriter.copyElementResourceInModel(componentParameter, model); // rdf:type sh:ComponentParameter resource.addProperty(RDF.type, SHACL.ParameterCls); // sh:path sh:argX resource.addProperty(SHACL.path, componentParameter.getPredicate()) ; //Optional if (componentParameter.isOptional()) { resource.addProperty(SHACL.optional, ResourceFactory.createTypedLiteral("true", XSDDatatype.XSDboolean)) ; } return resource; }
Example #12
Source File: SkolemizerTest.java From Processor with Apache License 2.0 | 6 votes |
/** * Test of getResource method, of class Skolemizer. */ @Test public void testGetResource() { Model model = ModelFactory.createDefaultModel(); Resource second = model.createResource(). addLiteral(DCTerms.title, "Second"); Resource first = model.createResource(). addLiteral(DCTerms.title, "First"). addProperty(FOAF.primaryTopic, second); Resource secondResult = skolemizer.getResource(first, "primaryTopic"); assertEquals(second, secondResult); Resource resultFail1 = skolemizer.getResource(first, "title"); assertNull(resultFail1); // title is a literal, not a resource Resource resultFail2 = skolemizer.getResource(first, "primaryTopic.title"); assertNull(resultFail2); // title is a literal, not a resource Resource resultFail3 = skolemizer.getResource(first, "whatever"); assertNull(resultFail3); // no such property }
Example #13
Source File: SolidContactsExport.java From data-transfer-project with Apache License 2.0 | 6 votes |
private List<VCard> parseAddressBook(Resource selfResource, SolidUtilities utilities) throws IOException { String peopleUri = selfResource.getProperty(NAME_EMAIL_INDEX_PROPERTY).getResource().getURI(); Model peopleModel = utilities.getModel(peopleUri); List<VCard> vcards = new ArrayList<>(); ResIterator subjects = peopleModel.listSubjects(); while (subjects.hasNext()) { Resource subject = subjects.nextResource(); Model personModel = utilities.getModel(subject.getURI()); Resource personResource = SolidUtilities.getResource(subject.getURI(), personModel); if (personResource == null) { throw new IllegalStateException(subject.getURI() + " not found in " + subject.toString()); } vcards.add(parsePerson(personResource)); } return vcards; }
Example #14
Source File: ARQFactory.java From shacl with Apache License 2.0 | 6 votes |
/** * Creates a new Query from a partial query (possibly lacking * PREFIX declarations), using the ARQ syntax specified by <code>getSyntax</code>. * @param model the Model to operate on * @param partialQuery the (partial) query string * @return the Query */ public Query createQuery(Model model, String partialQuery) { PrefixMapping pm = new PrefixMappingImpl(); String defaultNamespace = JenaUtil.getNsPrefixURI(model, ""); if(defaultNamespace != null) { pm.setNsPrefix("", defaultNamespace); } Map<String,String> extraPrefixes = ExtraPrefixes.getExtraPrefixes(); for(String prefix : extraPrefixes.keySet()) { String ns = extraPrefixes.get(prefix); if(ns != null && pm.getNsPrefixURI(prefix) == null) { pm.setNsPrefix(prefix, ns); } } // Get all the prefixes from the model at once. Map<String, String> map = model.getNsPrefixMap(); map.remove(""); pm.setNsPrefixes(map); return doCreateQuery(partialQuery, pm); }
Example #15
Source File: JenaTransformationRepairPosLength.java From trainbenchmark with Eclipse Public License 1.0 | 6 votes |
@Override public void activate(final Collection<JenaPosLengthMatch> matches) throws IOException { final Model model = driver.getModel(); final Property lengthProperty = model.getProperty(BASE_PREFIX + LENGTH); for (final JenaPosLengthMatch match : matches) { final Resource segment = match.getSegment(); final int length = match.getLength().getInt(); final int newLength = -length + 1; final Selector selector = new SimpleSelector(segment, lengthProperty, (RDFNode) null); final StmtIterator statementsToRemove = model.listStatements(selector); if (statementsToRemove.hasNext()) { final Statement oldStatement = statementsToRemove.next(); model.remove(oldStatement); } final Statement newStatement = model.createLiteralStatement(segment, lengthProperty, newLength); model.add(newStatement); } }
Example #16
Source File: RdfStreamReader.java From RDFUnit with Apache License 2.0 | 5 votes |
@Override public void read(Model model) throws RdfReaderException { try { RDFDataMgr.read(model, inputStream, null, RDFLanguages.nameToLang(format)); } catch (Exception e) { throw new RdfReaderException(e.getMessage(), e); } }
Example #17
Source File: Spatial.java From arctic-sea with Apache License 2.0 | 5 votes |
@Override public Resource addToResource(Model model, Resource parent) { for (Location location : locations) { parent.addProperty(getProperty(), location.createResource(model, parent)); return parent; } return super.addToResource(model, parent); }
Example #18
Source File: PathEvaluator.java From shacl with Apache License 2.0 | 5 votes |
/** * Constructs a PathEvaluator for an arbitrary SPARQL path (except single forward properties). * @param path the path * @param shapesModel the shapes Model */ public PathEvaluator(Path path, Model shapesModel) { this.jenaPath = path; isInverse = jenaPath instanceof P_Inverse && ((P_Inverse)jenaPath).getSubPath() instanceof P_Link; if(isInverse) { P_Link link = (P_Link) ((P_Inverse)jenaPath).getSubPath(); predicate = shapesModel.getProperty(link.getNode().getURI()); } }
Example #19
Source File: TestExternalDocumentRef.java From tools with Apache License 2.0 | 5 votes |
@Test public void testSetExternalDocumentId() throws InvalidSPDXAnalysisException { ExternalDocumentRef edf = new ExternalDocumentRef(DOCUMENT_URI1, CHECKSUM1, DOCUMENT_ID1); assertEquals(DOCUMENT_ID1, edf.getExternalDocumentId()); Model model = ModelFactory.createDefaultModel(); IModelContainer modelContainer = new ModelContainerForTest(model, "http://testnamespace.com"); Resource r = edf.createResource(modelContainer); assertEquals(DOCUMENT_ID1, edf.getExternalDocumentId()); edf.setExternalDocumentId(DOCUMENT_ID2); assertEquals(DOCUMENT_ID2, edf.getExternalDocumentId()); ExternalDocumentRef edf2 = new ExternalDocumentRef(modelContainer, r.asNode()); assertEquals(DOCUMENT_ID2, edf2.getExternalDocumentId()); }
Example #20
Source File: TestRdfModelObject.java From tools with Apache License 2.0 | 5 votes |
@Test public void testAddPropertyValue() throws InvalidSPDXAnalysisException { final Model model = ModelFactory.createDefaultModel(); IModelContainer modelContainer = new ModelContainerForTest(model, "http://testnamespace.com"); Resource r = model.createResource(); EmptyRdfModelObject empty = new EmptyRdfModelObject(modelContainer, r.asNode()); Annotation[] result = empty.findAnnotationPropertyValues(TEST_NAMESPACE, TEST_PROPNAME1); assertEquals(0, result.length); String annotator1 = "Annotator 1"; AnnotationType annType1 = AnnotationType.annotationType_other; DateFormat format = new SimpleDateFormat(SpdxRdfConstants.SPDX_DATE_FORMAT); String annDate1 = format.format(new Date()); String annComment1 = "Annotation Comment 1"; Annotation an1 = new Annotation(annotator1, annType1, annDate1, annComment1); String annotator2 = "Annotator 2"; AnnotationType annType2 = AnnotationType.annotationType_review; String annDate2 = format.format(new Date(10101)); String annComment2 = "Annotation Comment 2"; Annotation an2 = new Annotation(annotator2, annType2, annDate2, annComment2); empty.addPropertyValue(TEST_NAMESPACE, TEST_PROPNAME1, an1); result = empty.findAnnotationPropertyValues(TEST_NAMESPACE, TEST_PROPNAME1); assertEquals(1, result.length); assertEquals(an1, result[0]); empty.addPropertyValue(TEST_NAMESPACE, TEST_PROPNAME1, an2); result = empty.findAnnotationPropertyValues(TEST_NAMESPACE, TEST_PROPNAME1); assertEquals(2, result.length); if (result[0].equals(an1)) { assertEquals(result[1], an2); } else { assertEquals(result[0], an2); } }
Example #21
Source File: TagRdfUnitTestGenerator.java From RDFUnit with Apache License 2.0 | 5 votes |
@Override public Collection<? extends GenericTestCase> generate(SchemaSource source) { Model m = source.getModel(); try (QueryExecutionFactoryModel qef = new QueryExecutionFactoryModel(m)) { Set<TestCase> tests = testGenerators.stream() .parallel() .flatMap(tg -> generate(qef, source, tg).stream()) .collect(Collectors.toSet()); log.info("{} generated {} tests using {} TAGs", source.getUri(), tests.size(), testGenerators.size()); return tests; } }
Example #22
Source File: Skolemizer.java From Processor with Apache License 2.0 | 5 votes |
public Model build(Model model) { if (model == null) throw new IllegalArgumentException("Model cannot be null"); Map<Resource, String> resourceURIMap = new HashMap<>(); ResIterator resIt = model.listSubjects(); try { while (resIt.hasNext()) { Resource resource = resIt.next(); if (resource.isAnon()) { URI uri = build(resource); if (uri != null) resourceURIMap.put(resource, uri.toString()); } } } finally { resIt.close(); } Iterator<Map.Entry<Resource, String>> entryIt = resourceURIMap.entrySet().iterator(); while (entryIt.hasNext()) { Map.Entry<Resource, String> entry = entryIt.next(); ResourceUtils.renameResource(entry.getKey(), entry.getValue()); } return model; }
Example #23
Source File: SparqlValidatorReaderTest.java From RDFUnit with Apache License 2.0 | 5 votes |
@Parameterized.Parameters(name= "{index}: Validator: {0}") public static Collection<Object[]> resources() throws RdfReaderException { Model model = RdfReaderFactory.createResourceReader("/org/aksw/rdfunit/shacl/sampleSparqlBasedConstraints.ttl").read(); Collection<Object[]> parameters = new ArrayList<>(); for (RDFNode node: model.listObjectsOfProperty(SHACL.sparql).toList()) { parameters.add(new Object[] {node}); } return parameters; }
Example #24
Source File: TarqlQueryExecution.java From tarql with BSD 2-Clause "Simplified" License | 5 votes |
public void exec(Model model) throws IOException { for (Query q: tq.getQueries()) { modifyQuery(q, table); QueryExecution ex = createQueryExecution(q, model); ex.execConstruct(model); } if (tarql.NS.equals(model.getNsPrefixURI("tarql"))) { model.removeNsPrefix("tarql"); } }
Example #25
Source File: ValidationUtil.java From shacl with Apache License 2.0 | 5 votes |
public static Model ensureToshTriplesExist(Model shapesModel) { // Ensure that the SHACL, DASH and TOSH graphs are present in the shapes Model if(!shapesModel.contains(TOSH.hasShape, RDF.type, (RDFNode)null)) { // Heuristic Model unionModel = SHACLSystemModel.getSHACLModel(); MultiUnion unionGraph = new MultiUnion(new Graph[] { unionModel.getGraph(), shapesModel.getGraph() }); shapesModel = ModelFactory.createModelForGraph(unionGraph); } return shapesModel; }
Example #26
Source File: labelSearch.java From xcurator with Apache License 2.0 | 5 votes |
private static Model make() { String BASE = "http://example/" ; Model model = ModelFactory.createDefaultModel() ; model.setNsPrefix("", BASE) ; Resource r1 = model.createResource(BASE+"r1") ; Resource r2 = model.createResource(BASE+"r2") ; r1.addProperty(RDFS.label, "abc") ; r2.addProperty(RDFS.label, "def") ; return model ; }
Example #27
Source File: RdfMultipleReader.java From RDFUnit with Apache License 2.0 | 5 votes |
@Override public void read(Model model) throws RdfReaderException { for (RdfReader r : readers) { try { r.read(model); } catch (RdfReaderException e) { throw new RdfReaderException("Cannot read from reader", e); } } }
Example #28
Source File: EarlReporter.java From teamengine with Apache License 2.0 | 5 votes |
/** * Creates EARL statements for the entire collection of test suite results. * Each test subset is defined by a {@literal <test>} tag in the suite * definition; these correspond to earl:TestRequirement resources in the * model. * * @param model * An RDF Model containing EARL statements. * @param results * A Map containing the actual test results, where the key is the * name of a test subset (conformance class). */ void processSuiteResults(Model model, Map<String, ISuiteResult> results) { for (Map.Entry<String, ISuiteResult> entry : results.entrySet()) { String testName = entry.getKey(); String testReqName = testName.replaceAll("\\s", "-"); // can return existing resource in model Resource testReq = model.createResource(testReqName); ITestContext testContext = entry.getValue().getTestContext(); int nPassed = testContext.getPassedTests().size(); int nSkipped = testContext.getSkippedTests().size(); int nFailed = testContext.getFailedTests().size(); testReq.addLiteral(CITE.testsPassed, new Integer(nPassed)); testReq.addLiteral(CITE.testsFailed, new Integer(nFailed)); testReq.addLiteral(CITE.testsSkipped, new Integer(nSkipped)); if (nPassed + nFailed == 0) { testReq.addProperty(DCTerms.description, "A precondition was not met. All tests in this set were skipped."); } if(isBasicConformanceClass(testName)){ if(nFailed > 0){ areCoreConformanceClassesPassed = false; } } processTestResults(model, testContext.getFailedTests()); processTestResults(model, testContext.getSkippedTests()); processTestResults(model, testContext.getPassedTests()); } }
Example #29
Source File: FunctionTestCaseType.java From shacl with Apache License 2.0 | 5 votes |
private Graph parseGraph(RDFNode node) { Model model = JenaUtil.createDefaultModel(); if(node.isLiteral()) { String str = node.asLiteral().getLexicalForm(); model.read(new ByteArrayInputStream(str.getBytes()), "urn:x:dummy", FileUtils.langTurtle); } return model.getGraph(); }
Example #30
Source File: RDFToTopicMapConverter.java From ontopia with Apache License 2.0 | 5 votes |
private RDFToTopicMapConverter(Model model, TopicMapIF topicmap) throws JenaException, MalformedURLException { this.topicmap = topicmap; this.builder = topicmap.getBuilder(); buildMappings(model); }