public static List<ObjectProperty> getAdditionalFauxSubpropertiesForList(List<ObjectProperty> propList, Individual subject, Model displayModel, Model tboxModel) { List<ObjectProperty> additionalProps = new ArrayList<ObjectProperty>(); Model union = ModelFactory.createUnion(displayModel, tboxModel); for (ObjectProperty op : propList) { additionalProps.addAll(getAdditionalFauxSubproperties(op, subject, tboxModel, union)); } return additionalProps; }
@Override protected Model makeUnion(Model baseModel, Model plusModel) { return ModelFactory.createUnion(baseModel, plusModel); } }
private Resource completedClone( Resource root, Resource newRoot, Model fragment ) { Model typed = fragment.add( newRoot, RDF.type, JA.Content ); return newRoot.inModel( ModelFactory.createUnion( root.getModel(), typed ) ); }
private Resource completedClone( Resource root, Resource newRoot, Model fragment ) { Model typed = fragment.add( newRoot, RDF.type, JA.Content ); return newRoot.inModel( ModelFactory.createUnion( root.getModel(), typed ) ); }
@Override protected OntModel makeOntUnion(OntModel baseModel, OntModel plusModel) { return ModelFactory.createOntologyModel(OWL_MEM, ModelFactory.createUnion(baseModel, plusModel)); } }
/** * This constructor is used for the unit tests only * * @param tboxModel - input. This model contains both asserted and inferred TBox axioms * @param aboxModel - input. This model contains asserted ABox statements * @param inferenceModel - output. This is the model in which inferred (materialized) * ABox statements are maintained (added or retracted). */ public SimpleReasoner(OntModel tboxModel, OntModel aboxModel, Model inferenceModel) { this.searchIndexer = null; this.tboxModel = tboxModel; this.aboxModel = aboxModel; this.inferenceModel = inferenceModel; this.fullModel = VitroModelFactory.createUnion(aboxModel, VitroModelFactory.createOntologyModel(inferenceModel)); Dataset ds = DatasetFactory.createMem(); ds.addNamedModel(ModelNames.ABOX_ASSERTIONS, aboxModel); ds.addNamedModel(ModelNames.ABOX_INFERENCES, inferenceModel); ds.addNamedModel(ModelNames.TBOX_ASSERTIONS, tboxModel); ds.setDefaultModel(ModelFactory.createUnion(fullModel, tboxModel)); recomputer = new ABoxRecomputer(tboxModel, aboxModel, new RDFServiceModel(ds), this, searchIndexer); }
OntModelSpec.OWL_MEM, ModelFactory.createUnion( getOntModelSelector().getApplicationMetadataModel(), getOntModelSelector().getFullModel()));
@Test public void graph_post_2() { try ( RDFConnection conn = connection() ) { conn.load(model1); conn.load(model2); Model m = conn.fetch(); Model m0 = ModelFactory.createUnion(model2, model1); assertTrue("Models are not isomorphic", isomorphic(m0, m)); } }
@Test public void named_graph_post_2() { try ( RDFConnection conn = connection() ) { conn.load(graphName, model1); conn.load(graphName, model2); Model m = conn.fetch(graphName); Model m0 = ModelFactory.createUnion(model2, model1); assertTrue("Models are not isomorphic", isomorphic(m0, m)); } }
private Model getMostSpecificTypes(Resource individual, Model assertedTypes) { String queryStr = "CONSTRUCT { \n" + " <" + individual.getURI() + "> <" + VitroVocabulary.MOST_SPECIFIC_TYPE + "> ?type \n" + "} WHERE { \n" + " <" + individual.getURI() + "> a ?type .\n" + " FILTER (isURI(?type)) \n" + " FILTER NOT EXISTS { \n" + " <" + individual.getURI() + "> a ?type2 . \n" + " ?type2 <" + RDFS.subClassOf.getURI() + "> ?type. \n" + " FILTER (?type != ?type2) \n" + " FILTER NOT EXISTS { ?type <" + OWL.equivalentClass + "> ?type2 } \n" + " } \n" + " FILTER NOT EXISTS { \n" + " <" + individual.getURI() + "> <" + VitroVocabulary.MOST_SPECIFIC_TYPE + "> ?type \n" + " } \n" + "} \n"; Model union = ModelFactory.createUnion(assertedTypes, tboxModel); tboxModel.enterCriticalSection(Lock.READ); try { Query q = QueryFactory.create(queryStr); QueryExecution qe = QueryExecutionFactory.create(q, union); return qe.execConstruct(); } finally { tboxModel.leaveCriticalSection(); } }
OntModelSpec.OWL_MEM, ModelFactory.createUnion( getOntModelSelector().getApplicationMetadataModel(), getOntModelSelector().getFullModel()));
private Model getInferredTypes(Resource individual, Model assertedTypes) { new TypeList(assertedTypes, RDF.type); String queryStr = "CONSTRUCT { \n" + " <" + individual.getURI() + "> a ?type \n" + "} WHERE { \n" + " <" + individual.getURI() + "> a ?assertedType .\n" + " { ?assertedType <" + RDFS.subClassOf.getURI() + "> ?type } \n" + " UNION \n" + " { ?assertedType <" + OWL.equivalentClass.getURI() + "> ?type } \n" + " FILTER (isURI(?type)) \n" + " FILTER NOT EXISTS { \n" + " <" + individual.getURI() + "> a ?type \n" + " } \n" + "} \n"; Model union = ModelFactory.createUnion(assertedTypes, tboxModel); tboxModel.enterCriticalSection(Lock.READ); try { Query q = QueryFactory.create(queryStr); QueryExecution qe = QueryExecutionFactory.create(q, union); return qe.execConstruct(); } finally { tboxModel.leaveCriticalSection(); } }
private void processCreate(VitroRequest request, EditProcessObject epo, OntModel origModel) { Model dynamicUnion = ModelFactory.createUnion(temp, origModel); OntModel ontModel = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM, dynamicUnion);
configModel.read(fis, null, "N3"); Model userChangesUnion = ModelFactory.createUnion(configModel, valuesToMigrate);
/** * test that a union model is a model over the union of the two underlying * graphs. (We don't check that Union works - that's done in the Union * tests, we hope.) */ public void testCreateUnion() { final Model m1 = ModelFactory.createDefaultModel(); final Model m2 = ModelFactory.createDefaultModel(); final Model m = ModelFactory.createUnion(m1, m2); JenaTestBase.assertInstanceOf(Union.class, m.getGraph()); Assert.assertSame(m1.getGraph(), ((Union) m.getGraph()).getL()); Assert.assertSame(m2.getGraph(), ((Union) m.getGraph()).getR()); }
/** * test that a union model is a model over the union of the two underlying * graphs. (We don't check that Union works - that's done in the Union * tests, we hope.) */ public void testCreateUnion() { final Model m1 = ModelFactory.createDefaultModel(); final Model m2 = ModelFactory.createDefaultModel(); final Model m = ModelFactory.createUnion(m1, m2); JenaTestBase.assertInstanceOf(Union.class, m.getGraph()); Assert.assertSame(m1.getGraph(), ((Union) m.getGraph()).getL()); Assert.assertSame(m2.getGraph(), ((Union) m.getGraph()).getR()); }
@Test public void testSubmodelUpdate1() { final String ns = "urn:test:"; final Resource a = ResourceFactory.createResource(ns + "a"); final Resource A = ResourceFactory.createResource(ns + "A"); final Resource B = ResourceFactory.createResource(ns + "B"); final Model m1 = ModelFactory.createDefaultModel(); m1.add(a, RDF.type, A); final Model m2 = ModelFactory.createDefaultModel(); m2.add(B, RDF.type, OWL.Class); final Model union = ModelFactory.createUnion(m1, m2); final OntModel model = ModelFactory.createOntologyModel(PelletReasonerFactory.THE_SPEC, union); ((PelletInfGraph) model.getGraph()).setAutoDetectChanges(true); assertTrue(model.contains(a, RDF.type, A)); assertFalse(model.contains(a, RDF.type, B)); m2.add(A, RDFS.subClassOf, B); assertTrue(model.contains(a, RDF.type, A)); assertTrue(model.contains(a, RDF.type, B)); }