queryTemplates.get(i)))); cpl.add(i, conceptProvider);
private GraphNode getScriptList( @QueryParam(value = "resource") NonLiteral resource) { AccessController.checkPermission(new ScriptManagerAppPermission()); if(resource == null) { resource = new BNode(); } BNode resultResource = new BNode(); MGraph contentGraph = cgProvider.getContentGraph(); MGraph additionGraph = new SimpleMGraph(); UnionMGraph resultGraph = new UnionMGraph(additionGraph, contentGraph); RdfList list = RdfList.createEmptyList(resultResource, additionGraph); resultGraph.add(new TripleImpl(resource, SCRIPTMANAGER.scriptList, resultResource)); resultGraph.add(new TripleImpl(resultResource, RDF.type, SCRIPTMANAGER.ScriptList)); Iterator<Triple> it = contentGraph.filter(null, RDF.type, SCRIPT.Script); while (it.hasNext()) { list.add(it.next().getSubject()); } return new GraphNode(resultResource, new UnionMGraph(resultGraph, contentGraph)); }
private GraphNode addLanguages(GraphNode node, NonLiteral platformInstance, List<LanguageDescription> languages, boolean copyToNode) { TripleCollection graph = node.getGraph(); BNode listNode = new BNode(); RdfList list = new RdfList(listNode, graph); LockableMGraph configGraph = getConfigGraph(); Lock readLock = configGraph.getLock().readLock(); for (LanguageDescription languageDescription : languages) { NonLiteral languageUri = (NonLiteral) languageDescription.getResource().getNode(); list.add(languageUri); if (copyToNode) { readLock.lock(); try { graph.addAll(new GraphNode(languageUri, configGraph).getNodeContext()); } finally { readLock.unlock(); } } } node.addProperty(PLATFORM.instance, platformInstance); graph.add(new TripleImpl(platformInstance, RDF.type, PLATFORM.Instance)); graph.add(new TripleImpl(platformInstance, PLATFORM.languages, listNode)); graph.add(new TripleImpl(listNode, RDF.type, LANGUAGE.LanguageList)); if (!copyToNode) { node = new GraphNode(node.getNode(), new UnionMGraph(graph, configGraph)); } return node; }
mGraph.add(new TripleImpl(node, RDF.type, GLOBALMENU.MenuItem)); list.add(node);
private NonLiteral itemsAsRdfList(SortedSet<GlobalMenuItem> menus, TripleCollection mGraph) { NonLiteral result = new BNode(); RdfList list = new RdfList(result, mGraph); for (GlobalMenuItem item : menus) { BNode node = new BNode(); final String label = item.getLabel(); Literal labelLiteral = new PlainLiteralImpl(label); mGraph.add(new TripleImpl(node, RDFS.label,labelLiteral)); final String description = item.getDescription(); if (description != null) { Literal descLiteral = new PlainLiteralImpl(description); mGraph.add(new TripleImpl(node, DCTERMS.description, descLiteral)); } final String path = item.getPath(); if (path != null) { Literal pathLiteral = LiteralFactory.getInstance(). createTypedLiteral(path); mGraph.add(new TripleImpl(node, GLOBALMENU.path, pathLiteral)); } mGraph.add(new TripleImpl(node, RDF.type, GLOBALMENU.MenuItem)); list.add(node); } return result; } }