summaryrefslogtreecommitdiff
path: root/offapi/com
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-06-26 15:19:36 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-06-28 12:47:35 +0200
commit47e04cf31c6165dd55dc20962ad9c72962b958bd (patch)
treec8c996c05d9fd8e2f611d5accc280678bcabd0de /offapi/com
parentb399dba597c90777c0edf2c5b19d029b3bff23df (diff)
tdf#125706 and tdf#125665 writer, speed up RDF
The RDF stuff is sloooooooow, so (a) add some caching and (b) fold a very hot UNO_QUERY call. To add the caching we need to add a new UNO interface, since XEnumeration is not amenable to being cached. Add an optimised getStatementsGraph_NoLock2 that skips the intermediate enumeration object, and consequently a lot of locking/unlocking. Cache by OUString key, to avoid expensive OUString<->OString conversion when looking up entries in the cache. For the test document in tdf#125706, this takes the time from 7s to 5s for me. For the test document in tdf#125665, this takes the load time from 60s to 7s for me. Change-Id: I207387e975b4f107834edd0974134c481fb4012d Reviewed-on: https://gerrit.libreoffice.org/74740 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'offapi/com')
-rw-r--r--offapi/com/sun/star/rdf/XNamedGraph2.idl134
1 files changed, 134 insertions, 0 deletions
diff --git a/offapi/com/sun/star/rdf/XNamedGraph2.idl b/offapi/com/sun/star/rdf/XNamedGraph2.idl
new file mode 100644
index 000000000000..e90254a577d3
--- /dev/null
+++ b/offapi/com/sun/star/rdf/XNamedGraph2.idl
@@ -0,0 +1,134 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef __com_sun_star_rdf_XNamedGraph_idl__
+#define __com_sun_star_rdf_XNamedGraph_idl__
+
+#include <com/sun/star/rdf/XNamedGraph.idl>
+
+
+
+module com { module sun { module star { module rdf {
+
+/** represents an RDF named graph that is stored in an RDF Repository.
+
+ @since LibreOffice 6.4
+ */
+interface XNamedGraph2 : XNamedGraph
+{
+
+ /** gets objects for matching RDF statements from a graph.
+
+ <p>this call caches its results (as opposed to getStatements in XNamedGraph
+ which cannot because it returns a mutable object).
+
+ <p>
+ Note that the ODF elements that can have metadata attached all
+ implement the interface XMetadatable, which inherits
+ from XResource, meaning that you can simply pass them
+ in as arguments here, and it will magically work.
+ </p>
+
+ <p>
+ Any parameter may be `NULL`, which acts as a wildcard.
+ For example, to get all statements about myURI:
+ <code>getStatements2(myURI, null, null)</code>
+ </p>
+
+ @param Subject
+ the subject of the RDF triple.
+
+ @param Predicate
+ the predicate of the RDF triple.
+
+ @param Object
+ the object of the RDF triple.
+
+ @returns
+ a sequence of XURIs for the objects in RDF statements
+ in the graph that match
+ the parameters, represented as an
+ enumeration of Statement
+
+ @throws com::sun::star::container::NoSuchElementException
+ if this graph does not exist in the repository any more
+
+ @throws RepositoryException
+ if an error occurs when accessing the repository.
+ */
+ sequence<com::sun::star::rdf::XURI> getStatementsObjects(
+ [in] XResource Subject,
+ [in] XURI Predicate,
+ [in] XNode Object)
+ raises( com::sun::star::container::NoSuchElementException,
+ RepositoryException );
+
+ /** returns true if there are matching RDF statements from a graph.
+
+ <p>this call caches its results (as opposed to getStatements in XNamedGraph
+ which cannot because it returns a mutable object).
+
+ <p>
+ Note that the ODF elements that can have metadata attached all
+ implement the interface XMetadatable, which inherits
+ from XResource, meaning that you can simply pass them
+ in as arguments here, and it will magically work.
+ </p>
+
+ <p>
+ Any parameter may be `NULL`, which acts as a wildcard.
+ For example, to get all statements about myURI:
+ <code>getStatements2(myURI, null, null)</code>
+ </p>
+
+ @param Subject
+ the subject of the RDF triple.
+
+ @param Predicate
+ the predicate of the RDF triple.
+
+ @param Object
+ the object of the RDF triple.
+
+ @returns
+ a sequence of XURIs for the objects in RDF statements
+ in the graph that match
+ the parameters, represented as an
+ enumeration of Statement
+
+ @throws com::sun::star::container::NoSuchElementException
+ if this graph does not exist in the repository any more
+
+ @throws RepositoryException
+ if an error occurs when accessing the repository.
+ */
+ boolean hasStatements(
+ [in] XResource Subject,
+ [in] XURI Predicate,
+ [in] XNode Object)
+ raises( com::sun::star::container::NoSuchElementException,
+ RepositoryException );
+};
+
+
+}; }; }; };
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */